From 140d73aa23a098c5b33ee519081809eb60fbc0a2 Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 17 Aug 2006 13:53:45 +0000 Subject: [PATCH] agc_pl contents and pl.gif for polish - pl agc translation git-svn-id: svn://192.168.202.10@182 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_1-X/trunk/LANG_agc/agc/images/pl.gif | Bin 0 -> 276 bytes .../LANG_agc/agc_pl/active_list_refresh.php | 482 ++ .../trunk/LANG_agc/agc_pl/astguiclient.php | 2899 +++++++++ .../LANG_agc/agc_pl/call_log_display.php | 196 + .../LANG_agc/agc_pl/conf_exten_check.php | 262 + agc_1-X/trunk/LANG_agc/agc_pl/dbconnect.php | 16 + .../trunk/LANG_agc/agc_pl/inbound_popup.php | 351 ++ .../LANG_agc/agc_pl/live_exten_check.php | 277 + .../trunk/LANG_agc/agc_pl/manager_send.php | 908 +++ .../LANG_agc/agc_pl/park_calls_display.php | 146 + .../trunk/LANG_agc/agc_pl/vdc_db_query.php | 1512 +++++ agc_1-X/trunk/LANG_agc/agc_pl/vicidial.php | 5444 +++++++++++++++++ .../trunk/LANG_agc/agc_pl/voicemail_check.php | 140 + agc_1-X/trunk/agc/images/pl.gif | Bin 0 -> 276 bytes 14 files changed, 12633 insertions(+) create mode 100644 agc_1-X/trunk/LANG_agc/agc/images/pl.gif create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/active_list_refresh.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/astguiclient.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/call_log_display.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/conf_exten_check.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/dbconnect.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/inbound_popup.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/live_exten_check.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/manager_send.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/park_calls_display.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/vdc_db_query.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/vicidial.php create mode 100644 agc_1-X/trunk/LANG_agc/agc_pl/voicemail_check.php create mode 100644 agc_1-X/trunk/agc/images/pl.gif diff --git a/agc_1-X/trunk/LANG_agc/agc/images/pl.gif b/agc_1-X/trunk/LANG_agc/agc/images/pl.gif new file mode 100644 index 0000000000000000000000000000000000000000..cde0790592ab20556bb06754b81dd7cf5b9e46b3 GIT binary patch literal 276 zcmV+v0qg!pNk%w1VIBY!0K@;sK9K^(ZFa-rn{S4deFq z|M2kt4-fzU|Nj60A^8LV00000EC2ui03HAo000G%peK%`cL4y$p;zg?WRWC>F*9&p z4w%qDg2+Kf^e`$5h-5(+7IO^3B!iep2G86;u*qbS&a7)-5lAErOIS=|I2sj#K(l6x zD40kihzSr?fPpFi4-^Fj6b~taf(adukdYk<3Nw_Fn2sNtoSmMZppT%Vq@ALrsGp~) atRJhbsIRc3va_KMwx|w{n7zK4Apkoeh=KM1 literal 0 HcmV?d00001 diff --git a/agc_1-X/trunk/LANG_agc/agc_pl/active_list_refresh.php b/agc_1-X/trunk/LANG_agc/agc_pl/active_list_refresh.php new file mode 100644 index 00000000..8bc6a67f --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/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 Nazwa uż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 zewnę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_1-X/trunk/LANG_agc/agc_pl/astguiclient.php b/agc_1-X/trunk/LANG_agc/agc_pl/astguiclient.php new file mode 100644 index 00000000..3cef1095 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/agc_pl/astguiclient.php @@ -0,0 +1,2899 @@ + 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 +# + +require("dbconnect.php"); + +#require_once("htglobalize.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 = '1.1.12'; +$build = '60619-1103'; + +### 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=':'; +$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: 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       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]; + fwrite ($fp, "VICIWybierz|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + else + { + fwrite ($fp, "VICIWybierz|FAIL|$date|$user|$pass|$ip|$browser|\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: 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       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 "web client 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 systememie, spróbuj jeszcze raz:
 
Login telefonu:
Hasło telefonu:

WERSJA: $version       BUILD: $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"; ?> +
Główny panelPanel aktywnych liniPanel konferencyjnySprawdź pocztę głosowąRozmowa
+
+ + +

Logout
+
+ + +
TRUNK Rozłącz

+ Active Trunks Menu
+ Rozłącz Trunk   |   + Przejmij Trunk   |   + Podsłuchaj Trunk   |   + Odswież   |   + Wróć do Głównego okna +
+
+ + +
Rozłącz

+ MenĂş Local Activa
+ Rozłącz lokalną   |   + Przejmij lokalną   |   + Podsłuchaj lokalną   |   + Odswież   |   + Wróć do Głównego okna +
+
+ + + + + + + +
Rozmowa przeniesiona
Kanały do przeniesienia: Kanał
Numer wenę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ł
Numer wenę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

+
+
+ + + + + + + + + + + + + + + +
  +
Poczta głosowa     Nowy:     Stary:             Wybieranie ręczne       Wybierz
Zawieszone rozmowy: 0                Numery wewnętrzne
Rozmowy wychodzące:
Rozmowy przychodzące:
astGUIclient WERSJA: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
Ulubione       edytuj
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
Ulubione

 
Zatwierdzenie zmain wymaga logoutu
Powrót do głónego okna - anulowanie wprowadzonych zmian
+
+ +
+ + + + + + + + + + + + + +
+PRZERWA | START     Szybkość odswieżania: 1000 ms Szybciej | Wolniej

+
Inicjalizuje..
+
Aktywne numery wewnętrzne
+Odswież | +ORDER | +
Linie zewnętrzne
+Odswież | +ORDER | +
Numery wewnętrzne
+Odswież | +ORDER | +
+ Data tutaj

+
+ Data tutaj

Operacje na Trunk +
+ Data tutaj

Operacje na lokalnych +
+
+ + + + +
+ + +Lista konferencji + + + +
+Wybierz numer konferencji w celu uzyskania o niej informacji +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_1-X/trunk/LANG_agc/agc_pl/call_log_display.php b/agc_1-X/trunk/LANG_agc/agc_pl/call_log_display.php new file mode 100644 index 00000000..e5e93485 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/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 Nazwa uż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_1-X/trunk/LANG_agc/agc_pl/conf_exten_check.php b/agc_1-X/trunk/LANG_agc/agc_pl/conf_exten_check.php new file mode 100644 index 00000000..a6f08d61 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/agc_pl/conf_exten_check.php @@ -0,0 +1,262 @@ + 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 +# + +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 = '0.0.9'; +$build = '60619-1201'; +$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 Nazwa uż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') + { + 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); + $Astatus=$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 + { + $Astatus='N'; + $RingCalls='N'; + } + } + else + { + $Astatus='N'; + $RingCalls='N'; + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Status: ' . $Astatus . '|CampCalls: ' . $RingCalls . "|\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 zarejestrował się $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_1-X/trunk/LANG_agc/agc_pl/dbconnect.php b/agc_1-X/trunk/LANG_agc/agc_pl/dbconnect.php new file mode 100644 index 00000000..fb6d5917 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/agc_pl/dbconnect.php @@ -0,0 +1,16 @@ + diff --git a/agc_1-X/trunk/LANG_agc/agc_pl/inbound_popup.php b/agc_1-X/trunk/LANG_agc/agc_pl/inbound_popup.php new file mode 100644 index 00000000..79323235 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/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 Nazwa uż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"; +?> + + +Przyhodzące rozmowa"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

Przyhodzące 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]
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_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 "CUSTOM - \n"; + + echo "
Numery wybrane: $row[8]
Notatki: $row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "Rozłącz - \n"; + echo "Prześlij do 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_1-X/trunk/LANG_agc/agc_pl/live_exten_check.php b/agc_1-X/trunk/LANG_agc/agc_pl/live_exten_check.php new file mode 100644 index 00000000..cdf065c5 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/agc_pl/live_exten_check.php @@ -0,0 +1,277 @@ + 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 +# + +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 = '1.1.12'; +$build = '60619-1203'; +$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 Nazwa uż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); + $KanałA[$loop_count] = "$row[0]"; + $KanałB[$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: $KanałA[$counter] ~"; + echo "KanałB: $KanałB[$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: $KanałA[$counter] ~"; + echo "KanałB: $KanałB[$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: $KanałA[$counter] ~"; + echo "KanałB: $KanałB[$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: $KanałA[$counter] ~"; + echo "KanałB: $KanałB[$counter] ~"; + echo "KanałBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "KanałA: $KanałA[$counter] ~"; + echo "KanałB: $KanałB[$counter] ~"; + echo "KanałBtrunk: $KanałA[$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_1-X/trunk/LANG_agc/agc_pl/manager_send.php b/agc_1-X/trunk/LANG_agc/agc_pl/manager_send.php new file mode 100644 index 00000000..0a48cd30 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/agc_pl/manager_send.php @@ -0,0 +1,908 @@ + 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','RedirectVD','HangupConfDial') +# - $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',...) +# + +# changes +# 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 +# + +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"];} + +$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 = '0.0.24'; +$build = '60619-1158'; +$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 Nazwa uż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 "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 "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 wprowadzona\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=="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 wprowadzona\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 wprowadzona\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 wprowadzona\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 wprowadzona $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 +# - 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;} + if (eregi("CLOSER",$campaign)) + { + $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=="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"; + } + 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 wprowadzona\n"; + } + } + + 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 wprowadzona\n"; + } + } + $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 wprowadzona\n"; + } + } + 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"; + } + 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"; + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + } + } +} + + +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 wprowadzona\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 wprowadzona\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 wprowadzona\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) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + 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 wprowadzona\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) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename')"; + 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 zakończy się po 60 minutach\n"; + } +} + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_1-X/trunk/LANG_agc/agc_pl/park_calls_display.php b/agc_1-X/trunk/LANG_agc/agc_pl/park_calls_display.php new file mode 100644 index 00000000..0458ac80 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/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 Nazwa uż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_1-X/trunk/LANG_agc/agc_pl/vdc_db_query.php b/agc_1-X/trunk/LANG_agc/agc_pl/vdc_db_query.php new file mode 100644 index 00000000..068a5868 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/agc_pl/vdc_db_query.php @@ -0,0 +1,1512 @@ + 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') +# - $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') + +# changes +# 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 +# + +$version = '0.0.34'; +$build = '60623-1414'; + +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"];} + + +$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]=''; + +$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 Nazwa uż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 odpytujący bazę danych"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +################################################################################ +### 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); + } + } + 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 + { + ### 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) && (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + 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(); + $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(); + $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]"); + $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++; + + ### 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' 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";} + + ### 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: $Local_out_prefix$phone_code$phone_number','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); + } + + $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"; + + 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 + { + ### 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";} + + ### 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: $Local_out_prefix$phone_code$phone_number','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); + + 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 "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 nie jest prawidłowy\n"; + exit; + } + else + { + ##### 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) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N');"; + 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"; + } + + # ##### 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 nie jest prawidłowy\n"; + exit; + } + else + { + if ($start_epoch < 1000) + { + if (eregi("CLOSER",$campaign)) + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT start_epoch FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user';"; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $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);} + + if (eregi("CLOSER",$campaign)) + { + $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); + } + if ($auto_dial_level > 0) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where 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' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + ##### 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); + + } +} + + +################################################################################ +### 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') +{ + $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"; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + 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]"); + $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]"); + } + + ### 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 + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + + if (eregi("CLOSER",$campaign)) + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL' 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 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 ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + + $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]; + } + 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) {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|\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|\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"; + } + + $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"; + + 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|CBHStary", $dispo)) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + 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 + { + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log values('','$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $vul_insert = mysql_affected_rows($link); + + ##### 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 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','RH123459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel\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); + + 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); + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + + ### RozmowaBACK ENTRY + if ( ($dispo_choice == 'CBHStary') and (strlen($CallBackDatETimE)>10) ) + { + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + } + + 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=''; + 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 + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$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 informacje zostały zaktualizowane\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 status='$stage',lead_id='',uniqueid=0,callerid='',channel='', random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + if ($agent_log == 'NO') + {$donothing=1;} + else + { + $pause_sec=0; + $stmt = "select pause_epoch,pause_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); + $pause_sec = (($StarTtime - $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_sec='$pause_sec',pause_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } + } + } + echo 'Agent ' . $user . ' jest w 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"; +} + + +################################################################################ +### 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 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 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_1-X/trunk/LANG_agc/agc_pl/vicidial.php b/agc_1-X/trunk/LANG_agc/agc_pl/vicidial.php new file mode 100644 index 00000000..ce9275b9 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/agc_pl/vicidial.php @@ -0,0 +1,5444 @@ + 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 +# +# CHANGES +# 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 +# 60816-1715 - Fixed customer time display bug and client DST setting +# + +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; + +$version = '1.1.87'; +$build = '60816-1715'; + +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(0, 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 +$clientDST = '1'; # set to 1 to check for DST na server for agent time + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen + +# 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 + +$US='_'; +$CL=':'; +$AT='@'; +$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 ($relogin == 'YES') +{ +echo "web client VICIWybierz: Powtóre 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óre zalogowanie
 
Login telefonu:
Hasło telefonu:
Login użytkownika:
Hasło użytkownika:
Kampania: $camp_form_code

WERSJA: $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 "web client 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

WERSJA: $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";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + + echo "web client 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

WERSJA: $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 "web client 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:

WERSJA: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$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";} + $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 from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $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]; + 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++;} + + ##### 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";} + $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;"; + $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;"; + $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;"; + $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 dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,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 FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $status_A = $row[0]; + $status_B = $row[1]; + $status_C = $row[2]; + $status_D = $row[3]; + $status_E = $row[4]; + $park_ext = $row[5]; + $park_file_name = $row[6]; + $web_form_address = $row[7]; + $allow_closers = $row[8]; + $auto_dial_level = $row[9]; + $dial_timeout = $row[10]; + $dial_prefix = $row[11]; + $campaign_cid = $row[12]; + $campaign_vdad_exten = $row[13]; + $campaign_rec_exten = $row[14]; + $campaign_recording = $row[15]; + $campaign_rec_filename = $row[16]; + $campaign_script = $row[17]; + $get_call_launch = $row[18]; + $campaign_am_message_exten = $row[19]; + $xferconf_a_dtmf = $row[20]; + $xferconf_a_number = $row[21]; + $xferconf_b_dtmf = $row[22]; + $xferconf_b_number = $row[23]; + $alt_number_dialing=$row[24]; + $VC_scheduled_callbacks=$row[25]; + $wrapup_sekundy=$row[26]; + $wrapup_message=$row[27]; + $closer_campaigns=$row[28]; + $use_internal_dnc=$row[29]; + + 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'"; + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if (eregi("CLOSER", $VD_campaign)) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 20;"; + $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 number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $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 + { + 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 "web client 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

WERSJA: $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";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client 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 systememie, spróbuj jeszcze raz:
 
Login telefonu:
Hasło telefonu:

WERSJA: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client VICIWybierz\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]; + $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]; + + 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";} + $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"; + + $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";} + $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";} + $rslt=mysql_query($stmt, $link); + + if ( (eregi("CLOSER", $VD_campaign)) || ($campaign_leads_to_call > 0) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log values('','$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE')"; + if ($DB) {echo "|$stmt|\n";} + $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;"; + $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;"; + $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';"; + $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";} + $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";} + $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";} + $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; + + ### use manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + ### 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";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if ($auto_dial_level > 0) + { + 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) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + if (eregi("CLOSER", $VD_campaign)) + { + print "\n"; + } + } + else + { + print "\n"; + + + + } + } + else + { + echo "web client 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 nowych numerów\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\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "web client 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\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $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) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id(); + 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;"; + $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(0,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"; + + +?> + +
+ + +
+ + + +LOGOUT\n"; ?> +
+
+ + + + + + + + +
VICIWybierzSCRIPT   LIVE     ID sesji: Rozmowa
+
+ + + + +

VICIWybierz
+
+ + +Wybieranie ręczne
+
+ + +X Aktywne zadzwoń później
+
+ + +
Zadzwoń później dla agenta :
Wybierz link zadzwoń później żeby połączyć się teraz.. +
+
+
  + Odswież +                 + Wróć +
+
+ + +
Nowy Wybieranie ręczne LEAD FOR :

Wpisz poniżej informacje o numerze pod który chcesz zadzwonić. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list 999

+ + + + + + + + + + + + + + + +
Dial Code:   (This is usually a 1 in the USA-Canada)
Telefon Number:   (maksymalnie 10 cyfr)
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 którego nie został dodany do listy wpisz numer .....
 
Dial Override:   (tylko cyfry)
+
+ Wybierz teraz +                 + Wróć +
+
+ + + + +Twój Status:
Calls Dialing: +
+ + + + + +
+ + Transfer - Konferencja
+ INTERNAL CLOSER + CLOSER LOCAL + CODE + Hangup Xfer Line + Rozłącz obie linie + +
+ + Numer do wybrania   + sekundy   + channel + + OVERRIDE   + D1 + D2 +
+ + Dial With Customer + Park Customer Dial + LEAVE 3-WAY Rozmowa + Dial Blind Transfer + Blind Transfer VMail Message +
+
+
+ + + + +
Opcja na numerze:

+ -
+
+
+ + + + + + + +
Klawisze skrótu: + Kiedy aktywne, naciśnij guzik na klawiaturze w celu wybrania opcji dla tej rozmowy. Rozmowa zostanie automatycznie rozłączona a opcja ustawiona:
+ + + + + +
+
+ + +
Nie ma telefonu w Twojej sesji:
+ Wróć +

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

+ Finish and Disposition Call + +
+
+ + +
Call Wrapup + sekundy remaining in wrapup

+ +

+ Finish Wrapup and Move On + +
+
+ + +

LOGOUT
+
+ + +
+
+ + +
 
+
+ + +
Zmiany wprowadzone w informacjach o kliencie będą zapisane tylko podczas trwania połączenia. Nie po rozłączaniu!.
+
+ + +
DISPOSITION Rozmowa :       Rozłącz się ponownie       minimalizuj
+ Koniec rozmowy, wybierz opcję +
+ Zatrzymaj dzwonienie
+ Wyczyść formularz | + Zatwierdź +

+ WEB FORM Zatwierdź +

  +
+
+ + + +
Wybierz datę zadzwoń później :
+ + + Wybierz datę poniżej   +     + Hour: +   + Minutes: +   + +  
+ Tylko moje zadzwoń później
";} + ?> + Notatki:

+ + Zatwierdź

+ +

  +
+
+ + +
CLOSER INBOUND GROUP SELECTION
+ Closer Inbound Group Selection +
+ BLENDED RozmowaING(wychodzące aktywowane)
+ Reset | + Zatwierdź +



  +
+
+ + + + Kanał + Kanał + Tylko moje zadzwoń później
";} + ?> +
+ + + + + + + +
Rozmowa przeniesiona
Kanały do przeniesienia: Kanał
Numer wenę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
+
+ + + + +
VICIWybierz SCRIPT
+
+ + + + + + + + + + + + + + + + + +
Status:
+
+Wybierz kolejny numer
+ Podgląd numeru
+ Zadzwoń pod drugi numer
+ + +Plik nagrania:
+
+
+Nagrywaj ID:
+
+ +Rozpocznij nagrywanie
+
+Web Formularz
+
+Zawieszona rozmowa
+Transfer - Konferencja
+
+Odłącz kilenta
+
+Wyślij tonowo
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n";} +else + {echo "\n";} +?> + +
sekundy:   Kanał:   Cust Time:
Informacje o kliencie:
Tytuł:   Pierwsze:   MI:   Ostatnie:
Adres1:
Adres2:   Adres3:
Miasto:   Stan:   Kod pocztowy:
Powiat:   Vendedor ID:
Telefon:   Prefix:   Drugi telefon:
Pokaż:   Email:
Komentarz:
+ +
+


  + +
+ + + + +
wersja web client VICIWybierz:     BUILD:               Serwer:              
+Pokaż informacje o konferencjach
+ 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +Klawisze skrótu nieaktywne + +
+ + + +
+ + + + +
+ + + + + + + + + + + + diff --git a/agc_1-X/trunk/LANG_agc/agc_pl/voicemail_check.php b/agc_1-X/trunk/LANG_agc/agc_pl/voicemail_check.php new file mode 100644 index 00000000..7cfd2ff7 --- /dev/null +++ b/agc_1-X/trunk/LANG_agc/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 Nazwa uż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 "skrzka głosowa $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_1-X/trunk/agc/images/pl.gif b/agc_1-X/trunk/agc/images/pl.gif new file mode 100644 index 0000000000000000000000000000000000000000..cde0790592ab20556bb06754b81dd7cf5b9e46b3 GIT binary patch literal 276 zcmV+v0qg!pNk%w1VIBY!0K@;sK9K^(ZFa-rn{S4deFq z|M2kt4-fzU|Nj60A^8LV00000EC2ui03HAo000G%peK%`cL4y$p;zg?WRWC>F*9&p z4w%qDg2+Kf^e`$5h-5(+7IO^3B!iep2G86;u*qbS&a7)-5lAErOIS=|I2sj#K(l6x zD40kihzSr?fPpFi4-^Fj6b~taf(adukdYk<3Nw_Fn2sNtoSmMZppT%Vq@ALrsGp~) atRJhbsIRc3va_KMwx|w{n7zK4Apkoeh=KM1 literal 0 HcmV?d00001