From 2ff46b533cdb6a609f3c6684ada5569372f8ae64 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 21 Apr 2010 13:32:47 +0000 Subject: [PATCH] updated french agent build in trunk git-svn-id: svn://192.168.202.10@1415 3d104415-ff17-0410-8863-d5cf3c621b8a --- LANG_www/agc_fr/active_list_refresh.php | 2 +- LANG_www/agc_fr/astguiclient.php | 2 +- LANG_www/agc_fr/call_log_display.php | 2 +- LANG_www/agc_fr/conf_exten_check.php | 6 +- LANG_www/agc_fr/dbconnect.php | 71 +- LANG_www/agc_fr/inbound_popup.php | 2 +- LANG_www/agc_fr/live_exten_check.php | 2 +- LANG_www/agc_fr/manager_send.php | 43 +- LANG_www/agc_fr/park_calls_display.php | 2 +- LANG_www/agc_fr/vdc_db_query.php | 883 ++++- LANG_www/agc_fr/vdc_script_display.php | 29 +- LANG_www/agc_fr/vicidial.php | 4220 ++++++++++++----------- LANG_www/agc_fr/voicemail_check.php | 2 +- 13 files changed, 3145 insertions(+), 2121 deletions(-) diff --git a/LANG_www/agc_fr/active_list_refresh.php b/LANG_www/agc_fr/active_list_refresh.php index 2e9c0760..0d81835a 100644 --- a/LANG_www/agc_fr/active_list_refresh.php +++ b/LANG_www/agc_fr/active_list_refresh.php @@ -126,7 +126,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/LANG_www/agc_fr/astguiclient.php b/LANG_www/agc_fr/astguiclient.php index 5b578b49..fdfb77f3 100644 --- a/LANG_www/agc_fr/astguiclient.php +++ b/LANG_www/agc_fr/astguiclient.php @@ -145,7 +145,7 @@ if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) { header ("Content-type: text/html; charset=utf-8"); - echo "astGUIclient Client Web: Login\n"; + echo "astGUIclient Client Web: Ouverture de Session\n"; echo "\n"; echo "\n"; echo "\n"; diff --git a/LANG_www/agc_fr/call_log_display.php b/LANG_www/agc_fr/call_log_display.php index 8a52cf2b..b31579b9 100644 --- a/LANG_www/agc_fr/call_log_display.php +++ b/LANG_www/agc_fr/call_log_display.php @@ -74,7 +74,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/LANG_www/agc_fr/conf_exten_check.php b/LANG_www/agc_fr/conf_exten_check.php index f9bf57a4..8c09a0ce 100644 --- a/LANG_www/agc_fr/conf_exten_check.php +++ b/LANG_www/agc_fr/conf_exten_check.php @@ -135,12 +135,12 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; - if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } - else +else { if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) diff --git a/LANG_www/agc_fr/dbconnect.php b/LANG_www/agc_fr/dbconnect.php index 89d88689..e02ca392 100644 --- a/LANG_www/agc_fr/dbconnect.php +++ b/LANG_www/agc_fr/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/LANG_www/agc_fr/inbound_popup.php b/LANG_www/agc_fr/inbound_popup.php index 1b734c3b..f5c0101a 100644 --- a/LANG_www/agc_fr/inbound_popup.php +++ b/LANG_www/agc_fr/inbound_popup.php @@ -86,7 +86,7 @@ if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/LANG_www/agc_fr/live_exten_check.php b/LANG_www/agc_fr/live_exten_check.php index 85224fc3..a20eefa0 100644 --- a/LANG_www/agc_fr/live_exten_check.php +++ b/LANG_www/agc_fr/live_exten_check.php @@ -75,7 +75,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/LANG_www/agc_fr/manager_send.php b/LANG_www/agc_fr/manager_send.php index 335adb6a..51a8de0e 100644 --- a/LANG_www/agc_fr/manager_send.php +++ b/LANG_www/agc_fr/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # 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 @@ -94,10 +94,10 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.2.0-47'; +$build = '100327-0846'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=85; $one_mysql_log=0; @@ -239,7 +239,7 @@ $auth=$row[0]; if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } else @@ -734,39 +734,6 @@ if ($ACTION=="RedirectVD") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02024',$user,$server_ip,$session_name,$one_mysql_log);} } - else - { - if (strlen($lead_id) > 1) - { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } - } - - } $ACTION="Redirect"; } } diff --git a/LANG_www/agc_fr/park_calls_display.php b/LANG_www/agc_fr/park_calls_display.php index bc20d026..64c8dc1a 100644 --- a/LANG_www/agc_fr/park_calls_display.php +++ b/LANG_www/agc_fr/park_calls_display.php @@ -65,7 +65,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) ) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/LANG_www/agc_fr/vdc_db_query.php b/LANG_www/agc_fr/vdc_db_query.php index 704cf078..c592b38b 100644 --- a/LANG_www/agc_fr/vdc_db_query.php +++ b/LANG_www/agc_fr/vdc_db_query.php @@ -12,7 +12,7 @@ # - $pass # optional variables: # - $format - ('text','debug') -# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields') +# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields','CALLLOGview','LEADINFOview') # - $stage - ('start','finish','lookup','new') # - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') # - $conf_exten - ('8600011',...) @@ -87,6 +87,7 @@ # - $agent_territories - ('ABC001','ABC002'...) # - $alt_num_status - ('0','1') # - $DiaL_SecondS - ('0','1','2',...) +# - $date - ('2010-02-19') # # CHANGELOG: # 50629-1044 - First build of script @@ -231,15 +232,25 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-152'; +$build = '100420-1006'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=332; $one_mysql_log=0; require("dbconnect.php"); @@ -419,6 +430,8 @@ if (isset($_GET["alt_num_status"])) {$alt_num_status=$_GET["alt_num_status"]; elseif (isset($_POST["alt_num_status"])) {$alt_num_status=$_POST["alt_num_status"];} if (isset($_GET["DiaL_SecondS"])) {$DiaL_SecondS=$_GET["DiaL_SecondS"];} elseif (isset($_POST["DiaL_SecondS"])) {$DiaL_SecondS=$_POST["DiaL_SecondS"];} +if (isset($_GET["date"])) {$date=$_GET["date"];} + elseif (isset($_POST["date"])) {$date=$_POST["date"];} header ("Content-type: text/html; charset=utf-8"); @@ -435,6 +448,61 @@ $MT[0]=''; $agents='@agents'; $US='_'; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Utilisateur busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Invalide number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STATUT INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Entrant calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Invalide call reference value.", +88 => "Incompatible destination.", +95 => "Invalide message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Invalide information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery sur timer expiry.", +103 => "Parameter non-existent or not implemented - passed sur (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; @@ -458,7 +526,7 @@ if ($non_latin < 1) $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); + $phone_number = ereg_replace("[^0-9a-zA-Z]","",$phone_number); } else { @@ -489,7 +557,7 @@ else if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Username/Mot de passe: |$user|$pass|\n"; + echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; exit; } else @@ -1009,7 +1077,8 @@ if ($ACTION == 'manDiaLnextCaLL') else { ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $eac_phone=''; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00015',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1017,7 +1086,8 @@ if ($ACTION == 'manDiaLnextCaLL') if ($vla_cc_ct > 0) { $row=mysql_fetch_row($rslt); - $calls_today = $row[0]; + $calls_today = $row[0]; + $eac_phone = $row[1]; } else {$calls_today ='0';} @@ -1810,15 +1880,52 @@ if ($ACTION == 'manDiaLnextCaLL') } } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where use_custom_cid='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00313',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $uccid_ct = mysql_num_rows($rslt); + if ($uccid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_custom_cid = $row[0]; + } + if ($use_custom_cid > 0) + { + $temp_CID = preg_replace("/\D/",'',$security); + if (strlen($temp_CID) > 6) + {$CCID = "$temp_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);} + ### check for extension append in campaign + $use_eac=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where extension_appended_cidname='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00322',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $eacid_ct = mysql_num_rows($rslt); + if ($eacid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_eac = $row[0]; + } + # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; - if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} - else {$CIDstring = "$MqueryCID";} + $EAC=''; + if ($use_eac > 0) + { + $eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone); + $EAC=" $eac_extension"; + } + if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";} + else {$CIDstring = "$MqueryCID$EAC";} ### whether to omit phone_code or not if (eregi('Y',$omit_phone_code)) @@ -1859,28 +1966,49 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00036',$user,$server_ip,$session_name,$one_mysql_log);} - #### update vicidial_agent_log if not MANUAL dial_method - if ($dial_method != 'MANUAL') - { - $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00301',$user,$server_ip,$session_name,$one_mysql_log);} - $VDpr_ct = mysql_num_rows($rslt); - if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) - { - $row=mysql_fetch_row($rslt); - $agent_log_id = $row[5]; - $pause_sec = (($StarTtime - $row[0]) + $row[1]); + # #### update vicidial_agent_log if not MANUAL dial_method + # if ($dial_method != 'MANUAL') + # { + # $pause_sec=0; + # $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00302',$user,$server_ip,$session_name,$one_mysql_log);} + # $VDpr_ct = mysql_num_rows($rslt); + # if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + # { + # $row=mysql_fetch_row($rslt); + # $agent_log_id = $row[5]; + # $pause_sec = (($StarTtime - $row[0]) + $row[1]); + # + # $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + # if ($format=='debug') {echo "\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} + # } + # } - $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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00302',$user,$server_ip,$session_name,$one_mysql_log);} - } + + $val_pause_epoch=0; + $val_pause_sec=0; + $stmt = "SELECT pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00323',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) + { + $row=mysql_fetch_row($rslt); + $val_pause_epoch = $row[0]; + $val_pause_sec = ($StarTtime - $val_pause_epoch); } + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00324',$user,$server_ip,$session_name,$one_mysql_log);} + + if ($agent_dialed_number > 0) { $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$phone_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; @@ -2174,7 +2302,7 @@ if ($ACTION == 'manDiaLonly') else { ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00043',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2182,12 +2310,26 @@ if ($ACTION == 'manDiaLonly') if ($vla_cc_ct > 0) { $row=mysql_fetch_row($rslt); - $calls_today =$row[0]; + $calls_today = $row[0]; + $eac_phone = $row[1]; } else {$calls_today ='0';} $calls_today++; + ### check for extension append in campaign + $use_eac=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where extension_appended_cidname='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00325',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $eacid_ct = mysql_num_rows($rslt); + if ($eacid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_eac = $row[0]; + } + ### prepare variables to place manual call from VICIDiaL $CCID_on=0; $CCID=''; $local_DEF = 'Local/'; @@ -2231,14 +2373,38 @@ if ($ACTION == 'manDiaLonly') } } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where use_custom_cid='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00314',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $uccid_ct = mysql_num_rows($rslt); + if ($uccid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_custom_cid = $row[0]; + } + if ($use_custom_cid > 0) + { + $temp_CID = preg_replace("/\D/",'',$security); + if (strlen($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} + } $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";} + $EAC=''; + if ($use_eac > 0) + { + $eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone); + $EAC=" $eac_extension"; + } + if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";} + else {$CIDstring = "$MqueryCID$EAC";} if ( ($usegroupalias > 0) and (strlen($account)>1) ) { @@ -2288,27 +2454,91 @@ if ($ACTION == 'manDiaLonly') echo "$MqueryCID\n"; - #### update vicidial_agent_log if not MANUAL dial_method - if ($dial_method != 'MANUAL') +# #### update vicidial_agent_log if not MANUAL dial_method +# if ($dial_method != 'MANUAL') +# { +# $pause_sec=0; +# $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00304',$user,$server_ip,$session_name,$one_mysql_log);} +# $VDpr_ct = mysql_num_rows($rslt); +# if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) +# { +# $row=mysql_fetch_row($rslt); +# $agent_log_id = $row[5]; +# $pause_sec = (($StarTtime - $row[0]) + $row[1]); +# +# $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} +# } +# } + + $val_pause_epoch=0; + $val_pause_sec=0; + $val_dispo_epoch=0; + $val_dispo_sec=0; + $val_wait_epoch=0; + $val_wait_sec=0; + $stmt = "SELECT dispo_epoch,wait_epoch,pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00326',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) { - $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; - if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $val_dispo_epoch = $row[0]; + $val_wait_epoch = $row[1]; + $val_pause_epoch = $row[2]; + $val_dispo_sec = ($StarTtime - $val_dispo_epoch); + $val_wait_sec = ($StarTtime - $val_wait_epoch); + $val_pause_sec = ($StarTtime - $val_pause_epoch); + } + if ($val_dispo_epoch > 1000) + { + $stmt="UPDATE vicidial_agent_log set status='ALTNUM',dispo_sec='$val_dispo_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} - $VDpr_ct = mysql_num_rows($rslt); - if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00327',$user,$server_ip,$session_name,$one_mysql_log);} + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00328',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) { $row=mysql_fetch_row($rslt); - $agent_log_id = $row[5]; - $pause_sec = (($StarTtime - $row[0]) + $row[1]); - - $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00304',$user,$server_ip,$session_name,$one_mysql_log);} + $user_group = trim("$row[0]"); } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','ANDIAL');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00329',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id',last_state_change='$NOW_TIME' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00330',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); } + else + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00331',$user,$server_ip,$session_name,$one_mysql_log);} + } + + echo "$agent_log_id\n"; + if ($agent_dialed_number > 0) { @@ -2326,8 +2556,7 @@ if ($ACTION == 'manDiaLonly') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00048',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); - $i=0; - while ($i < $qm_conf_ct) + if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; @@ -2336,7 +2565,6 @@ if ($ACTION == 'manDiaLonly') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; - $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -2433,9 +2661,10 @@ if ($ACTION == 'manDiaLlookCaLL') $dialstatus =$row[0]; $hangup_cause =$row[1]; - $channel = $dialstatus . "-" . $hangup_cause; + $channel = $dialstatus; + $hangup_cause_msg = "Cause: " . $hangup_cause . " - " . hangup_cause_description($hangup_cause); - $call_output = "$uniqueid\n$channel\nERROR"; + $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg; $call_good++; ### Delete call record @@ -2465,7 +2694,7 @@ if ($ACTION == 'manDiaLlookCaLL') if ( ($now_dead_epoch > 1000) and ($now_dead_epoch < $StarTtime) ) {$dead_epochSQL = ",dead_epoch='$StarTtime'";} } - $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' $dead_epochSQL where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' $dead_epochSQL where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00054',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2635,13 +2864,13 @@ if ($stage == "end") $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); ##### look for the start epoch in the vicidial_closer_log table - $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id,status FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $VDIDselect = "VDCL_LID $lead_id $phone_number $user $four_hours_ago"; } else { ##### look for the start epoch in the vicidial_log table - $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } $rslt=mysql_query($stmt, $link); @@ -2655,6 +2884,7 @@ if ($stage == "end") $VDterm_reason = $row[1]; $VDvicidial_id = $row[2]; $VDcampaign_id = $row[3]; + $VDstatus = $row[4]; $length_in_sec = ($StarTtime - $start_epoch); } else @@ -2696,7 +2926,9 @@ if ($stage == "end") if ($VLA_inOUT == 'INBOUND') { - $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec', status='$status_dispo' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $vcl_statusSQL=''; + if ($VDstatus == 'INCALL') {$vcl_statusSQL = ",status='$status_dispo'";} + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vcl_statusSQL where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00062',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2704,6 +2936,10 @@ if ($stage == "end") if ($affected_rows > 0) { echo "$uniqueid\n$channel\n"; + + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|INBND_LOG_4|$VDstatus|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$start_epoch|$stmt|\n"); + # fclose($fp); } else { @@ -3322,7 +3558,7 @@ if ($stage == "end") if (strlen($SQLterm) > 0) { ##### update the duration and end time in the vicidial_log table - $stmt="UPDATE vicidial_closer_log set $SQLterm, status='$status_dispo' where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00092',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3584,7 +3820,7 @@ if ($stage == "end") } } } - $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',dispo_epoch='$StarTtime' $talk_epochSQL $dead_secSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',dispo_epoch='$StarTtime',uniqueid='$uniqueid' $talk_epochSQL $dead_secSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00102',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3830,7 +4066,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00248',$user,$server_ip,$session_name,$one_mysql_log);} $VDAP_cid_ct = mysql_num_rows($rslt); - if ($VDACP_cid_ct > 0) + if ($VDAP_cid_ct > 0) { $row=mysql_fetch_row($rslt); $Xalt_phone_count =$row[0]; @@ -3840,7 +4076,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00249',$user,$server_ip,$session_name,$one_mysql_log);} $VDAPct_cid_ct = mysql_num_rows($rslt); - if ($VDACPct_cid_ct > 0) + if ($VDAPct_cid_ct > 0) { $row=mysql_fetch_row($rslt); $COUNTalt_phone_count =$row[0]; @@ -4457,6 +4693,7 @@ if ($ACTION == 'VDADcheckINCOMING') if ($DB > 0) {echo "$SCUfile[0]
\n";} ##### BEGIN special filtering and response for Vtiger account balance function ##### + # http://vtiger/vicidial/api.php?mode=callxfer&contactwsid=--A--vendor_lead_code--B--&minuteswarning=3 $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00294',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4466,27 +4703,57 @@ if ($ACTION == 'VDADcheckINCOMING') $row=mysql_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } - if ( ($enable_vtiger_integration > 0) and (ereg('callxfer',$VDCL_start_call_url)) and (ereg('contactwsid',$VDCL_start_call_url)) ) + if ( ( ($enable_vtiger_integration > 0) and (ereg('callxfer',$VDCL_start_call_url)) and (ereg('contactwsid',$VDCL_start_call_url)) ) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) { $SCUoutput=''; foreach ($SCUfile as $SCUline) {$SCUoutput .= "$SCUline";} # {"result":true,"durationLimit":3071} - if (strlen($SCUoutput) > 4) + if ( (strlen($SCUoutput) > 4) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) { - $SCUresponse = explode('durationLimit',$SCUoutput); - $durationLimit = preg_replace('/\D/','',$SCUresponse[1]); - $durationLimitSEC = ( ( ($durationLimit + 0) - 3) * 60); # minutes - 3 for 3-minute-warning + $minuteswarning=3; # default to 3 + if (preg_match("/minuteswarning/",$VDCL_start_call_url)) + { + $minuteswarningARY = explode('minuteswarning=',$VDCL_start_call_url); + $minuteswarning = preg_replace('/&.*/','',$minuteswarningARY[1]); + } + ### add this to the Start Call URL for callcard calls to be logged "&minuteswarning=1&callcard=1" + if (preg_match("/callcard=/",$VDCL_start_call_url)) + { + $stmt="SELECT balance_minutes_start FROM callcard_log where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00315',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $bms_ct = mysql_num_rows($rslt); + if ($bms_ct > 0) + { + $row=mysql_fetch_row($rslt); + $durationLimit = $row[0]; + + $stmt="UPDATE callcard_log set agent_time='$NOW_TIME',agent='$user' where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00316',$user,$server_ip,$session_name,$one_mysql_log);} + $ccl_update = mysql_affected_rows($link); + } + } + else + { + $SCUresponse = explode('durationLimit',$SCUoutput); + $durationLimit = preg_replace('/\D/','',$SCUresponse[1]); + } + if (strlen($durationLimit) < 1) {$durationLimit = 0;} + $durationLimitSEC = ( ( ($durationLimit + 0) - $minuteswarning) * 60); # minutes - 3 for 3-minute-warning if ($durationLimitSEC < 5) {$durationLimitSEC = 5;} - $stmt="UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='3 minute warning for customer',external_timer_action_seconds='$durationLimitSEC' where user='$user';"; + $stmt="UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='$minuteswarning minute warning for customer',external_timer_action_seconds='$durationLimitSEC' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00295',$user,$server_ip,$session_name,$one_mysql_log);} $vla_update_timer = mysql_affected_rows($link); $fp = fopen ("./call_url_log.txt", "a"); - fwrite ($fp, "$VDCL_start_call_url\n$SCUoutput\n$durationLimit|$durationLimitSEC|$vla_update_timer\n"); + fwrite ($fp, "$VDCL_start_call_url\n$SCUoutput\n$durationLimit|$durationLimitSEC|$vla_update_timer|$minuteswarning|$uniqueid|\n"); fclose($fp); } } @@ -4630,7 +4897,7 @@ if ($ACTION == 'userLOGout') { ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages,queuemetrics_loginout FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00138',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -4645,6 +4912,7 @@ if ($ACTION == 'userLOGout') $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $allow_sipsak_messages = $row[6]; + $queuemetrics_loginout = $row[7]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -4656,6 +4924,10 @@ if ($ACTION == 'userLOGout') if ($enable_queuemetrics_logging > 0) { + $QM_LOGOFF = 'AGENTLOGOFF'; + if ($queuemetrics_loginout=='CALLBACK') + {$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); @@ -4665,7 +4937,7 @@ if ($ACTION == 'userLOGout') # $rslt=mysql_query($stmt, $linkB); # $affected_rows = mysql_affected_rows($linkB); - $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + $stmt = "SELECT time_id,data1 FROM queue_log where agent='Agent/$user' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00139',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -4676,13 +4948,14 @@ if ($ACTION == 'userLOGout') { $row=mysql_fetch_row($rslt); $logintime = $row[0]; + $loginphone = $row[1]; $i++; } $time_logged_in = ($StarTtime - $logintime); if ($time_logged_in > 1000000) {$time_logged_in=1;} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QM_LOGOFF',data1='$loginphone',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00140',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4713,7 +4986,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "SELECT dispo_call_url from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT dispo_call_url,queuemetrics_callstatus_override from vicidial_campaigns vc,vicidial_live_agents vla where vla.campaign_id=vc.campaign_id and vla.user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00284',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4721,7 +4994,8 @@ if ($ACTION == 'updateDISPO') if ($VC_dcu_ct > 0) { $row=mysql_fetch_row($rslt); - $dispo_call_url =$row[0]; + $dispo_call_url = $row[0]; + $queuemetrics_callstatus_override = $row[1]; } ### reset the API fields in vicidial_live_agents record @@ -4752,6 +5026,10 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142',$user,$server_ip,$session_name,$one_mysql_log);} + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|DISPO_CALL |$MDnextCID|$stage|$campaign|$lead_id|$dispo_choice|$user|$uniqueid|$auto_dial_level|$agent_log_id|\n"); + # fclose($fp); + $stmt = "SELECT count(*) from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -4763,6 +5041,16 @@ if ($ACTION == 'updateDISPO') if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00144',$user,$server_ip,$session_name,$one_mysql_log);} + $VCLaffected_rows = mysql_affected_rows($link); + + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|DISPO_CALL2|$VCLaffected_rows|$stmt|\n"); + # fclose($fp); + + $stmt = "UPDATE vicidial_live_inbound_agents set last_call_finish=NOW() where group_id='$stage' and user='$user' limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00322',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "SELECT dispo_call_url from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} @@ -4836,7 +5124,7 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00250',$user,$server_ip,$session_name,$one_mysql_log);} $VDAP_cid_ct = mysql_num_rows($rslt); - if ($VDACP_cid_ct > 0) + if ($VDAP_cid_ct > 0) { $row=mysql_fetch_row($rslt); $Xalt_phone_count =$row[0]; @@ -4846,7 +5134,7 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00251',$user,$server_ip,$session_name,$one_mysql_log);} $VDAPct_cid_ct = mysql_num_rows($rslt); - if ($VDACPct_cid_ct > 0) + if ($VDAPct_cid_ct > 0) { $row=mysql_fetch_row($rslt); $COUNTalt_phone_count =$row[0]; @@ -4996,7 +5284,7 @@ if ($ACTION == 'updateDISPO') } } } - $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',status='$dispo_choice' $dispo_epochSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',status='$dispo_choice',uniqueid='$uniqueid' $dispo_epochSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00151',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5543,7 +5831,7 @@ if ($ACTION == 'updateDISPO') ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_callstatus FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00159',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5557,10 +5845,11 @@ if ($ACTION == 'updateDISPO') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_callstatus = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### - if ($enable_queuemetrics_logging > 0) + if ( ($enable_queuemetrics_logging > 0) and ( ( ($queuemetrics_callstatus > 0) or ($queuemetrics_callstatus_override=='YES') ) and ($queuemetrics_callstatus_override!='NO') ) ) { $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); @@ -5576,8 +5865,10 @@ if ($ACTION == 'updateDISPO') mysql_close($linkB); } - - ### Issue Dispo Call URL if defined + + ############################################ + ### BEGIN Issue Dispo Call URL if defined + ############################################ if (strlen($dispo_call_url) > 7) { $talk_time=0; @@ -5787,7 +6078,91 @@ if ($ACTION == 'updateDISPO') fwrite ($fp, "$dispo_call_url\n$SCUoutput\n"); fclose($fp); } + + ### add this to the Dispo URL for callcard calls to be logged "&callcard=--A--talk_time_min--B--" + if (preg_match("/callcard/",$dispo_call_url)) + { + $stmt="SELECT balance_minutes_start,card_id FROM callcard_log where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00317',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $bms_ct = mysql_num_rows($rslt); + $fp = fopen ("./call_url_log.txt", "a"); + fwrite ($fp, "$dispo_call_url\n$stmt|$bms_ct\n"); + fclose($fp); + + if ($bms_ct > 0) + { + $row=mysql_fetch_row($rslt); + $balance_minutes_start = $row[0]; + $card_id = $row[1]; + + $current_minutes = ($balance_minutes_start - $talk_time_min); + + $stmt="UPDATE callcard_log set agent_talk_sec='$talk_time',agent_talk_min='$talk_time_min',dispo_time='$NOW_TIME',agent_dispo='$dispo' where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00318',$user,$server_ip,$session_name,$one_mysql_log);} + $ccl_update = mysql_affected_rows($link); + + $stmt="UPDATE callcard_accounts set balance_minutes='$current_minutes' where card_id='$card_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00319',$user,$server_ip,$session_name,$one_mysql_log);} + $cca_update = mysql_affected_rows($link); + + $stmt="UPDATE callcard_accounts_details set balance_minutes='$current_minutes' where card_id='$card_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00320',$user,$server_ip,$session_name,$one_mysql_log);} + $ccad_update = mysql_affected_rows($link); + } + } } + ############################################ + ### END Issue Dispo Call URL if defined + ############################################ + + + ##### check if system is set to generate logfile for dispos + $stmt="SELECT enable_agc_dispo_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00311',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $enable_agc_dispo_log_ct = mysql_num_rows($rslt); + if ($enable_agc_dispo_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_dispo_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_dispo_log > 0) ) + { + $talk_time = 0; + $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00312',$user,$server_ip,$session_name,$one_mysql_log);} + $VAL_talk_ct = mysql_num_rows($rslt); + if ($VAL_talk_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = $row[0]; + $dead_sec = $row[1]; + $talk_time = ($talk_sec - $dead_sec); + if ($talk_time < 1) + { + $talk_time = 0; + } + } + + # DATETIME|campaign|lead_id|phone_number|user|type|Call_ID||province|talk_sec| + # 2010-02-19 11:11:11|TESTCAMP|65432|3125551212|1234|D|Y09876543210987654||note|123| + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|D|$MDnextCID||$province|$talk_sec|\n"); + fclose($fp); + } + echo 'Lead ' . $lead_id . ' a été changé en ' . $dispo_choice . " Statut\nNext agent_log_id:\n" . $agent_log_id . "\n"; } @@ -6144,7 +6519,7 @@ if ($ACTION == 'PauseCodeSubmit') ### if this is the first pause code entry in a pause session, simply update and log to queue_log if ($stage < 1) { - $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id >= '$agent_log_id' and user='$user' and ( (sub_status is NULL) or (sub_status='') )order by agent_log_id limit 2;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00175',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6157,7 +6532,7 @@ if ($ACTION == 'PauseCodeSubmit') $stmt = "select pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -6167,12 +6542,12 @@ if ($ACTION == 'PauseCodeSubmit') $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00307',$user,$server_ip,$session_name,$one_mysql_log);} $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00309',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00308',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -6184,14 +6559,14 @@ if ($ACTION == 'PauseCodeSubmit') $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','$status');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00307',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00309',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); $agent_log_id = mysql_insert_id($link); $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id',last_state_change='$NOW_TIME' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00308',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00310',$VD_login,$server_ip,$session_name,$one_mysql_log);} $VLAaffected_rows_update = mysql_affected_rows($link); } @@ -6289,6 +6664,8 @@ if ($ACTION == 'AGENTSview') echo "
"; ### Gather agents data and statuses + $agentviewlistSQL=''; + $j=0; $stmt="SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user $AGENTviewSQL order by vu.full_name;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -6302,6 +6679,7 @@ if ($ACTION == 'AGENTSview') $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; if ( ($status=='READY') or ($status=='CLOSER') ) { @@ -6337,10 +6715,12 @@ if ($ACTION == 'AGENTSview') if ($comments=='AgentXferViewSelect') { - echo ""; - if ($agent_status_view_time > 0) - {echo "";} - echo ""; + $AXVSuserORDRE[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = $call_time; + $AXVSstatuscolor[$j] = $statuscolor; + $j++; } else { @@ -6353,8 +6733,89 @@ if ($ACTION == 'AGENTSview') } $loop_count++; } + $agentviewlistSQL = eregi_replace(".$","",$agentviewlistSQL); + if (strlen($agentviewlistSQL)<3) + {$agentviewlistSQL = "''";} + + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + { + $stmt="SELECT user,full_name from vicidial_users where user NOT IN($agentviewlistSQL) order by full_name;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00301',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$agents_count = mysql_num_rows($rslt);} + $loop_count=0; + while ($agents_count > $loop_count) + { + $row=mysql_fetch_row($rslt); + $user = $row[0]; + $full_name = $row[1]; + + if ($comments=='AgentXferViewSelect') + { + $AXVSuserORDRE[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = '0:00'; + $AXVSstatuscolor[$j] = 'white'; + $j++; + } + else + { + echo ""; + if ($agent_status_view_time > 0) + {echo "";} + echo ""; + } + $loop_count++; + } + } + + ### BEGIN Display the agent transfer select view ### + $k=0; + if ($comments=='AgentXferViewSelect') + { + echo "
  $row[0] - $row[2]   $call_time  
  "; + echo "$user - $full_name"; + echo "   0:00  
"; + echo "
"; + + $AXVSrecords=100; + $AXVScolumns=1; + $AXVSfontsize='12px'; + if ($j > 30) {$AXVScolumns++;} + if ($j > 60) {$AXVScolumns++; $AXVSfontsize='11px';} + if ($j > 90) {$AXVScolumns++; $AXVSfontsize='10px';} + if ($j > 120) {$AXVScolumns++; $AXVSfontsize='9px';} + $AXVSrecords = ($j / $AXVScolumns); + $AXVSrecords = round($AXVSrecords, 0); + $m=0; + + sort($AXVSuserORDRE); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserORDRE[$k]); + $i = $order_split[1]; + + echo ""; + if ($agent_status_view_time > 0) + {echo "";} + echo ""; + + $k++; + $m++; + if ($m >= $AXVSrecords) + { + echo "
  $AXVSuser[$i] - $AXVSfull_name[$i]   $AXVScall_time[$i]  
  "; + $m=0; + } + } + echo "
"; + } + echo "

\n"; echo "    -READY      -INCALL      -PAUSED  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} echo "\n"; } @@ -6552,6 +7013,201 @@ if ($ACTION == 'CALLSINQUEUEview') } +################################################################################ +### CALLLOGview - display one day calls for an agent +################################################################################ +if ($ACTION == 'CALLLOGview') + { + if (strlen($date) < 10) + {$date = $NOW_DATE;} + if (strlen($stage) < 3) + {$stage = '670';} + + $date_array = explode("-",$date); + $day_next = mktime(7, 0, 0, $date_array[1], ($date_array[2] + 1), $date_array[0]); + $next_day_date = date("Y-m-d",$day_next); + $day_old = mktime(7, 0, 0, $date_array[1], ($date_array[2] - 1), $date_array[0]); + $past_day_date = date("Y-m-d",$day_old); + $week_old = mktime(7, 0, 0, $date_array[1], ($date_array[2] - 7), $date_array[0]); + $past_week_date = date("Y-m-d",$week_old); + + echo "
\n"; + echo ""; + echo " << $past_week_date     "; + echo " < $past_day_date     "; + if ($NOW_DATE != $date) + {echo " $next_day_date >     ";} + echo " "; + echo "GO       "; + echo "close"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + + $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments from vicidial_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLstart_epoch[$g] = $row[0]; + $ALLcall_date[$g] = $row[1]; + $ALLcampaign_id[$g] = $row[2]; + $ALLlength_in_sec[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLphone_code[$g] = $row[5]; + $ALLphone_number[$g] = $row[6]; + $ALLlead_id[$g] = $row[7]; + $ALLhangup_reason[$g] = $row[8]; + $ALLalt_dial[$g] = $row[9]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + $g++; + $u++; + } + + $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds from vicidial_closer_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$in_logs_to_print|$stmt|";} + + $u=0; + while ($in_logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLstart_epoch[$g] = $row[0]; + $ALLcall_date[$g] = $row[1]; + $ALLcampaign_id[$g] = $row[2]; + $ALLlength_in_sec[$g] = ($row[3] - $row[9]); + if ($ALLlength_in_sec[$g] < 0) {$ALLlength_in_sec[$g]=0;} + $ALLstatus[$g] = $row[4]; + $ALLphone_code[$g] = $row[5]; + $ALLphone_number[$g] = $row[6]; + $ALLlead_id[$g] = $row[7]; + $ALLhangup_reason[$g] = $row[8]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {echo "";} + + $u=0; + while ($g > $u) + { + $sort_split = explode("-----",$ALLsort[$u]); + $i = $sort_split[1]; + + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
  #     DATE/TIME     LENGTH     STATUT     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     COMPOSER  
No calls sur this day
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Close Call Log"; + echo "
"; + } + + +################################################################################ +### LEADINFOview - display the information for a lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + echo "
\n"; + echo ""; + + $stmt="select status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where lead_id='$lead_id'limit 1;"; + $rslt=mysql_query($stmt, $link); + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + # echo ""; + # echo ""; + } + + echo "
Statut:   $row[0]
CodeVendeur:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Appelé SInce Nom Reset:   $row[4]
Téléphone Code:   $row[5]
Téléphone Number:   $row[6] -         DIAL
Titre:   $row[7]
Prenom Name:   $row[8]
Mi:  $row[9]
Nom Name:   $row[10]
Adresse 1:   $row[11]
Adresse 2:   $row[12]
Adresse 3:   $row[13]
Ville:   $row[14]
État:   $row[15]
Province:   $row[16]
Postal Code:   $row[17]
Country:   $row[18]
Sexe:  $row[19]
Tel. 2nd:   $row[20] -         DIAL
Email:   $row[21]
Visualiser:   $row[22]
Commentaires:  $row[23]
Appelé Count:   $row[24]
Nom Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
"; + echo "
"; + echo "Close Info Box"; + echo "
"; + } + } + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +7228,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +7258,27 @@ if ($ACTION == 'CALLSINQUEUEgrab') } echo "SUCCESS: Call $stage grabbed for $user"; - exit; } else { echo "ERROR: Call $stage could not be grabbed for $user\n"; - exit; } + + $stmtD="SELECT * from vicidial_auto_calls where auto_call_id='$stage';"; + $rslt=mysql_query($stmtD, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00321',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$DEBUGvac_count = mysql_num_rows($rslt);} + if ($DEBUGvac_count > 0) + { + $row=mysql_fetch_row($rslt); + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|GRAB_CALL |$stmtU|$VACaffected_rows|$stmtD|$row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|$row[14]|$row[15]|$row[16]|$row[17]|$row[18]|\n"); + fclose($fp); + } + } + exit; } } @@ -6673,7 +7343,14 @@ if ($ACTION == 'CalLBacKCounT') $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status IN('LIVE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00332',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $cbcount_live=$row[0]; + + echo "$cbcount|$cbcount_live"; } @@ -6712,7 +7389,13 @@ echo "\n\n\n"; exit; - +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) +{ +global $hangup_cause_dictionary; +if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } +else { return "Unidentified Hangup Cause Code."; } +} ##### MySQL Error Logging ##### diff --git a/LANG_www/agc_fr/vdc_script_display.php b/LANG_www/agc_fr/vdc_script_display.php index 8c9bb87d..9af96d86 100644 --- a/LANG_www/agc_fr/vdc_script_display.php +++ b/LANG_www/agc_fr/vdc_script_display.php @@ -11,10 +11,11 @@ # 91204-1913 - Added recording_filename and recording_id variables # 91211-1103 - Added user_custom_... variables # 100116-0702 - Added preset variables +# 100127-1611 - Added ignore_list_script_override option # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.2.0-6'; +$build = '100127-1611'; require("dbconnect.php"); @@ -177,7 +178,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +252,19 @@ if (strlen($in_script) < 1) else {$call_script = $in_script;} +$ignore_list_script_override='N'; +$stmt = "SELECT ignore_list_script_override FROM vicidial_inbound_groups where group_id='$group';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$ilso_ct = mysql_num_rows($rslt); +if ($ilso_ct > 0) + { + $row=mysql_fetch_row($rslt); + $ignore_list_script_override = $row[0]; + } +if ($ignore_list_script_override=='Y') + {$ignore_list_script=1;} + if ($ignore_list_script < 1) { $stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';"; @@ -262,6 +275,12 @@ if ($ignore_list_script < 1) {$call_script = $agent_script_override;} } +$stmt="SELECT list_name,list_description from vicidial_lists where list_id='$list_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$list_name = $row[0]; +$list_description = $row[1]; + $stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -275,6 +294,8 @@ if (eregi("iframe src",$script_text)) $vendor_id = eregi_replace(' ','+',$vendor_id); $vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code); $list_id = eregi_replace(' ','+',$list_id); + $list_name = eregi_replace(' ','+',$list_name); + $list_description = eregi_replace(' ','+',$list_description); $gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now); $phone_code = eregi_replace(' ','+',$phone_code); $phone_number = eregi_replace(' ','+',$phone_number); @@ -348,6 +369,8 @@ $script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text); $script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text); $script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); $script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--list_name--B--',"$list_name",$script_text); +$script_text = eregi_replace('--A--list_description--B--',"$list_description",$script_text); $script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); $script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); $script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); diff --git a/LANG_www/agc_fr/vicidial.php b/LANG_www/agc_fr/vicidial.php index 61e9babf..1e8ded52 100644 --- a/LANG_www/agc_fr/vicidial.php +++ b/LANG_www/agc_fr/vicidial.php @@ -272,14 +272,28 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-268'; +$build = '100420-1009'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=64; $one_mysql_log=0; @@ -361,7 +375,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +394,7 @@ if ($qm_conf_ct > 0) $outbound_autodial_active = $row[8]; $enable_second_webform = $row[9]; $user_territories_active = $row[10]; + $static_agent_url = $row[11]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,48 +402,50 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### -$conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording -$dtmf_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 -$callholdstatus = '1'; # set to 1 to show calls sur hold count -$agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count - $campagentstatctmax = '3'; # Number of secondes for campaign call and agent stats -$show_campname_pulldown = '1'; # set to 1 to show campaign name sur login pulldown -$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL -$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server -$clientDST = '1'; # set to 1 to check for DST sur server for agent time -$no_delete_sessions = '1'; # set to 1 to not delete sessions at logout -$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels -$PreseT_DiaL_LinKs = '0'; # set to 1 to show a COMPOSER link for Dial Presets -$LogiNAJAX = '1'; # set to 1 to do lookups sur campaigns for login -$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" -$hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Raccrocher -$LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout -$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login -$DefaulTAlTDiaL = '0'; # set to 1 to enable ALT COMPOSER by default if enabled for the campaign -$AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option -$disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +if (file_exists('options.php')) + { + require('options.php'); + } +else + { + $conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording + $dtmf_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 + $callholdstatus = '1'; # set to 1 to show calls sur hold count + $agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count + $campagentstatctmax = '3'; # Number of secondes for campaign call and agent stats + $show_campname_pulldown = '1'; # set to 1 to show campaign name sur login pulldown + $webform_sessionname = '1'; # set to 1 to include the session_name in webform URL + $local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server + $clientDST = '1'; # set to 1 to check for DST sur server for agent time + $no_delete_sessions = '1'; # set to 1 to not delete sessions at logout + $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels + $PreseT_DiaL_LinKs = '0'; # set to 1 to show a COMPOSER link for Dial Presets + $LogiNAJAX = '1'; # set to 1 to do lookups sur campaigns for login + $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + $hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Raccrocher + $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout + $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login + $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT COMPOSER by default if enabled for the campaign + $AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option + $disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen -$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window -$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 -$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 -$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 -$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 -$SIDEBAR_COLOR = '#F6F6F6'; + $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 + $stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window + $BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 + $BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 + $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 + $SIDEBAR_COLOR = '#F6F6F6'; + } $US='_'; @@ -447,6 +464,8 @@ 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); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} header ("Content-type: text/html; charset=utf-8"); @@ -660,66 +679,27 @@ else } if ($relogin == 'YES') -{ -echo "Agent web client: S'identifier à nouveau\n"; -echo "\n"; -echo "\n"; -echo "Timeclock
\n"; -echo "\n"; -echo "\n"; -echo "\n";echo "\n";echo "
English Français
\n"; -echo "
\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "


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

VERSION: $version       BUILD: $build
\n"; -echo "\n\n"; -echo "\n\n"; -echo "\n\n"; -exit; -} - -if ($user_login_first == 1) -{ - if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) { - echo "Agent web client: Ouverture de Campagne\n"; + echo "Agent web client: S'identifier à nouveau\n"; echo "\n"; echo "\n"; echo "Timeclock
\n"; echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Français
\n"; - echo "
\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; - #echo "\n"; - #echo "\n"; - echo "

Ouverture de Session

"; - echo ""; + echo "


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

VERSION: $version       BUILD: $build
\n"; echo "\n\n"; @@ -735,19 +715,12 @@ 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 and active='Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01005',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $phone_login=$row[0]; - $phone_pass=$row[1]; - echo "Agent web client: Login\n"; +if ($user_login_first == 1) + { + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Agent web client: Ouverture de Campagne\n"; echo "\n"; echo "\n"; echo "Timeclock
\n"; @@ -758,15 +731,14 @@ echo "\n"; echo "\n"; echo "\n"; - echo "


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

Ouverture de Session

"; + echo "
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; - echo "\n"; - echo ""; - echo "\n"; echo ""; echo "\n"; echo ""; @@ -781,253 +753,1417 @@ echo "
Ouverture de Session Ouverture de Campagne
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:
Ouverture de Session:
Mot de passe Utilisateur: \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 and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + echo "Agent web client: Ouverture de Session\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


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

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


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

VERSION: $version       BUILD: $build
\n"; -echo "\n\n"; -echo "\n\n"; -echo "\n\n"; -exit; -} + { + echo "Agent web client: Ouverture de Session téléphonique\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


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

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } else -{ -if ($WeBRooTWritablE > 0) - {$fp = fopen ("./vicidial_auth_entries.txt", "a");} -$VDloginDISPLAY=0; + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) - { - $VDloginDISPLAY=1; - } - else - { - $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01006',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $auth=$row[0]; - - if($auth>0) { - $login=strtoupper($VD_login); - $password=strtoupper($VD_pass); - ##### grab the full name of the agent - $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';"; + if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01006',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - $LOGfullname = $row[0]; - $user_level = $row[1]; - $VU_hotkeys_active = $row[2]; - $VU_agent_choose_ingroups = $row[3]; - $VU_scheduled_callbacks = $row[4]; - $agentonly_callbacks = $row[5]; - $agentcall_manual = $row[6]; - $VU_vicidial_recording = $row[7]; - $VU_vicidial_transfers = $row[8]; - $VU_closer_default_blended = $row[9]; - $VU_user_group = $row[10]; - $VU_vicidial_recording_override = $row[11]; - $VU_alter_custphone_override = $row[12]; - $VU_alert_enabled = $row[13]; - $VU_agent_shift_enforcement_override = $row[14]; - $VU_shift_override_flag = $row[15]; - $VU_allow_alerts = $row[16]; - $VU_closer_campaigns = $row[17]; - $VU_agent_choose_territories = $row[18]; - $VU_custom_one = $row[19]; - $VU_custom_two = $row[20]; - $VU_custom_three = $row[21]; - $VU_custom_four = $row[22]; - $VU_custom_five = $row[23]; + $auth=$row[0]; - if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';} - else {$VU_alert_enabled = 'OFF';} - $AgentAlert_allowed = $VU_allow_alerts; - - ### Gather timeclock and shift enforcement restriction settings - $stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts,agent_status_viewable_groups,agent_status_view_time from vicidial_user_groups where user_group='$VU_user_group';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $forced_timeclock_login = $row[0]; - $shift_enforcement = $row[1]; - $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[2]); - $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL); - $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')"; - $agent_status_viewable_groups = $row[3]; - $agent_status_viewable_groupsSQL = eregi_replace(' ','',$agent_status_viewable_groups); - $agent_status_viewable_groupsSQL = eregi_replace(' ',"','",$agent_status_viewable_groupsSQL); - $agent_status_viewable_groupsSQL = "user_group IN('$agent_status_viewable_groupsSQL')"; - $agent_status_view = 0; - if (strlen($agent_status_viewable_groups) > 2) - {$agent_status_view = 1;} - $agent_status_view_time=0; - if ($row[4] == 'Y') - {$agent_status_view_time=1;} - - ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR - if ( (ereg('Y',$forced_timeclock_login)) or ( (ereg('ADMIN_EXEMPT',$forced_timeclock_login)) and ($VU_user_level < 8) ) ) + if($auth>0) { - $last_agent_event=''; - $HHMM = date("Hi"); - $HHteod = substr($timeclock_end_of_day,0,2); - $MMteod = substr($timeclock_end_of_day,2,2); - - if ($HHMM < $timeclock_end_of_day) - {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));} - else - {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));} - - $EoDdate = date("Y-m-d H:i:s", $EoD); - - ##### grab timeclock logged-in time for each user ##### - $stmt="SELECT event from vicidial_timeclock_log where user='$VD_login' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;"; + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,agent_call_log_view_override,agent_choose_blended from vicidial_users where user='$VD_login' and pass='$VD_pass'"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01053',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $events_to_parse = mysql_num_rows($rslt); - if ($events_to_parse > 0) - { - $rowx=mysql_fetch_row($rslt); - $last_agent_event = $rowx[0]; - } - if ($DB>0) {echo "|$stmt|$events_to_parse|$last_agent_event|";} - if ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) ) - { - $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "Vous devez vous connecter pour timeclock LE PREMIER
"; - } - } - ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_hotkeys_active = $row[2]; + $VU_agent_choose_ingroups = $row[3]; + $VU_scheduled_callbacks = $row[4]; + $agentonly_callbacks = $row[5]; + $agentcall_manual = $row[6]; + $VU_vicidial_recording = $row[7]; + $VU_vicidial_transfers = $row[8]; + $VU_closer_default_blended = $row[9]; + $VU_user_group = $row[10]; + $VU_vicidial_recording_override = $row[11]; + $VU_alter_custphone_override = $row[12]; + $VU_alert_enabled = $row[13]; + $VU_agent_shift_enforcement_override = $row[14]; + $VU_shift_override_flag = $row[15]; + $VU_allow_alerts = $row[16]; + $VU_closer_campaigns = $row[17]; + $VU_agent_choose_territories = $row[18]; + $VU_custom_one = $row[19]; + $VU_custom_two = $row[20]; + $VU_custom_three = $row[21]; + $VU_custom_four = $row[22]; + $VU_custom_five = $row[23]; + $VU_agent_call_log_view_override = $row[24]; + $VU_agent_choose_blended = $row[25]; - ### BEGIN - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR - if ( ( (ereg("START|ALL",$shift_enforcement)) and (!ereg("OFF",$VU_agent_shift_enforcement_override)) ) or (ereg("START|ALL",$VU_agent_shift_enforcement_override)) ) - { - $shift_ok=0; - if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) - { - $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "ERREUR: Il n'y a pas de changements activée pour votre groupe d'utilisateurs
"; - } - else + + if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';} + else {$VU_alert_enabled = 'OFF';} + $AgentAlert_allowed = $VU_allow_alerts; + + ### Gather timeclock and shift enforcement restriction settings + $stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts,agent_status_viewable_groups,agent_status_view_time,agent_call_log_view,agent_xfer_consultative,agent_xfer_dial_override,agent_xfer_vm_transfer,agent_xfer_blind_transfer,agent_xfer_dial_with_customer,agent_xfer_park_customer_dial,agent_fullscreen from vicidial_user_groups where user_group='$VU_user_group';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $forced_timeclock_login = $row[0]; + $shift_enforcement = $row[1]; + $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[2]); + $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL); + $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')"; + $agent_status_viewable_groups = $row[3]; + $agent_status_viewable_groupsSQL = eregi_replace(' ','',$agent_status_viewable_groups); + $agent_status_viewable_groupsSQL = eregi_replace(' ',"','",$agent_status_viewable_groupsSQL); + $agent_status_viewable_groupsSQL = "user_group IN('$agent_status_viewable_groupsSQL')"; + $agent_status_view = 0; + if (strlen($agent_status_viewable_groups) > 2) + {$agent_status_view = 1;} + $agent_status_view_time=0; + if ($row[4] == 'Y') + {$agent_status_view_time=1;} + if ($row[5] == 'Y') + {$agent_call_log_view=1;} + if ($row[6] == 'Y') + {$agent_xfer_consultative=1;} + if ($row[7] == 'Y') + {$agent_xfer_dial_override=1;} + if ($row[8] == 'Y') + {$agent_xfer_vm_transfer=1;} + if ($row[9] == 'Y') + {$agent_xfer_blind_transfer=1;} + if ($row[10] == 'Y') + {$agent_xfer_dial_with_customer=1;} + if ($row[11] == 'Y') + {$agent_xfer_park_customer_dial=1;} + if ($VU_agent_call_log_view_override == 'Y') + {$agent_call_log_view=1;} + if ($VU_agent_call_log_view_override == 'N') + {$agent_call_log_view=0;} + $agent_fullscreen = $row[12]; + + ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + if ( (ereg('Y',$forced_timeclock_login)) or ( (ereg('ADMIN_EXEMPT',$forced_timeclock_login)) and ($VU_user_level < 8) ) ) { + $last_agent_event=''; $HHMM = date("Hi"); - $wday = date("w"); + $HHteod = substr($timeclock_end_of_day,0,2); + $MMteod = substr($timeclock_end_of_day,2,2); - $stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id"; + if ($HHMM < $timeclock_end_of_day) + {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));} + else + {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));} + + $EoDdate = date("Y-m-d H:i:s", $EoD); + + ##### grab timeclock logged-in time for each user ##### + $stmt="SELECT event from vicidial_timeclock_log where user='$VD_login' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $shifts_to_print = mysql_num_rows($rslt); - - $o=0; - while ( ($shifts_to_print > $o) and ($shift_ok < 1) ) + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01053',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $events_to_parse = mysql_num_rows($rslt); + if ($events_to_parse > 0) { $rowx=mysql_fetch_row($rslt); - $shift_id = $rowx[0]; - $shift_start_time = $rowx[1]; - $shift_length = $rowx[2]; - $shift_weekdays = $rowx[3]; - - if (eregi("$wday",$shift_weekdays)) - { - $HHshift_length = substr($shift_length,0,2); - $MMshift_length = substr($shift_length,3,2); - $HHshift_start_time = substr($shift_start_time,0,2); - $MMshift_start_time = substr($shift_start_time,2,2); - $HHshift_end_time = ($HHshift_length + $HHshift_start_time); - $MMshift_end_time = ($MMshift_length + $MMshift_start_time); - if ($MMshift_end_time > 59) - { - $MMshift_end_time = ($MMshift_end_time - 60); - $HHshift_end_time++; - } - if ($HHshift_end_time > 23) - {$HHshift_end_time = ($HHshift_end_time - 24);} - $HHshift_end_time = sprintf("%02s", $HHshift_end_time); - $MMshift_end_time = sprintf("%02s", $MMshift_end_time); - $shift_end_time = "$HHshift_end_time$MMshift_end_time"; - - if ( - ( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or - ( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or - ( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) ) - ) - {$shift_ok++;} - } - $o++; + $last_agent_event = $rowx[0]; } - - if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) ) + if ($DB>0) {echo "|$stmt|$events_to_parse|$last_agent_event|";} + if ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) ) { $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "ERREUR: Vous n'êtes pas autorisés à se connecter à l'extérieur de votre quart de travail
"; + $VDdisplayMESSAGE = "Vous devez vous connecter pour timeclock LE PREMIER
"; } } - if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) ) + ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + + ### BEGIN - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR + if ( ( (ereg("START|ALL",$shift_enforcement)) and (!ereg("OFF",$VU_agent_shift_enforcement_override)) ) or (ereg("START|ALL",$VU_agent_shift_enforcement_override)) ) { - $VDdisplayMESSAGE.= "

MANAGER OVERRIDE:
\n"; - $VDdisplayMESSAGE.= "
\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "GestionnaireOuverture de Session:
\n"; - $VDdisplayMESSAGE.= "GestionnaireMot de passe:
\n"; - $VDdisplayMESSAGE.= "
\n"; + $shift_ok=0; + if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "ERREUR: Il n'y a pas de changements activée pour votre groupe d'utilisateurs
"; + } + else + { + $HHMM = date("Hi"); + $wday = date("w"); + + $stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $shifts_to_print = mysql_num_rows($rslt); + + $o=0; + while ( ($shifts_to_print > $o) and ($shift_ok < 1) ) + { + $rowx=mysql_fetch_row($rslt); + $shift_id = $rowx[0]; + $shift_start_time = $rowx[1]; + $shift_length = $rowx[2]; + $shift_weekdays = $rowx[3]; + + if (eregi("$wday",$shift_weekdays)) + { + $HHshift_length = substr($shift_length,0,2); + $MMshift_length = substr($shift_length,3,2); + $HHshift_start_time = substr($shift_start_time,0,2); + $MMshift_start_time = substr($shift_start_time,2,2); + $HHshift_end_time = ($HHshift_length + $HHshift_start_time); + $MMshift_end_time = ($MMshift_length + $MMshift_start_time); + if ($MMshift_end_time > 59) + { + $MMshift_end_time = ($MMshift_end_time - 60); + $HHshift_end_time++; + } + if ($HHshift_end_time > 23) + {$HHshift_end_time = ($HHshift_end_time - 24);} + $HHshift_end_time = sprintf("%02s", $HHshift_end_time); + $MMshift_end_time = sprintf("%02s", $MMshift_end_time); + $shift_end_time = "$HHshift_end_time$MMshift_end_time"; + + if ( + ( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or + ( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or + ( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) ) + ) + {$shift_ok++;} + } + $o++; + } + + if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) ) + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "ERREUR: Vous n'êtes pas autorisés à se connecter à l'extérieur de votre quart de travail
"; + } + } + if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) ) + { + $VDdisplayMESSAGE.= "

MANAGER OVERRIDE:
\n"; + $VDdisplayMESSAGE.= "
\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "GestionnaireOuverture de Session:
\n"; + $VDdisplayMESSAGE.= "GestionnaireMot de passe:
\n"; + $VDdisplayMESSAGE.= "
\n"; + } + } + ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR + + + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "Agent web client: Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ouverture de Session: \n
"; + echo "Mot de passe:
\n"; + echo "Campagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01009',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01010',$VD_login,$server_ip,$session_name,$one_mysql_log);} + 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 80;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + 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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + 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 campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = stripslashes($row[2]); + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = '8320'; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_seconds = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + $disable_alter_custphone = $row[33]; + $display_queue_count = $row[34]; + $manual_dial_filter = $row[35]; + $CopY_tO_ClipboarD = $row[36]; + $use_campaign_dnc = $row[37]; + $three_way_call_cid = $row[38]; + $dial_method = $row[39]; + $three_way_dial_prefix = $row[40]; + $web_form_target = $row[41]; + $vtiger_screen_login = $row[42]; + $agent_allow_group_alias = $row[43]; + $default_group_alias = $row[44]; + $quick_transfer_button = $row[45]; + $prepopulate_transfer_preset = $row[46]; + $view_calls_in_queue = $row[47]; + $view_calls_in_queue_launch = $row[48]; + $call_requeue_button = $row[49]; + $pause_after_each_call = $row[50]; + $no_hopper_dialing = $row[51]; + $agent_dial_owner_only = $row[52]; + $agent_display_dialable_leads = $row[53]; + $web_form_address_two = $row[54]; + $agent_select_territories = $row[55]; + $crm_popup_login = $row[56]; + $crm_login_address = $row[57]; + $timer_action = $row[58]; + $timer_action_message = $row[59]; + $timer_action_seconds = $row[60]; + $start_call_url = $row[61]; + $dispo_call_url = $row[62]; + $xferconf_c_number = $row[63]; + $xferconf_d_number = $row[64]; + $xferconf_e_number = $row[65]; + $use_custom_cid = $row[66]; + $scheduled_callbacks_alert = $row[67]; + $scheduled_callbacks_count = $row[68]; + + if ($user_territories_active < 1) + {$agent_select_territories = 0;} + if (preg_match("/Y/",$agent_select_territories)) + {$agent_select_territories=1;} + else + {$agent_select_territories=0;} + + if (preg_match("/Y/",$agent_display_dialable_leads)) + {$agent_display_dialable_leads=1;} + else + {$agent_display_dialable_leads=0;} + + if (preg_match("/Y/",$no_hopper_dialing)) + {$no_hopper_dialing=1;} + else + {$no_hopper_dialing=0;} + + if ( (preg_match("/Y/",$call_requeue_button)) and ($auto_dial_level > 0) ) + {$call_requeue_button=1;} + else + {$call_requeue_button=0;} + + if ( (preg_match("/AUTO/",$view_calls_in_queue_launch)) and ($auto_dial_level > 0) ) + {$view_calls_in_queue_launch=1;} + else + {$view_calls_in_queue_launch=0;} + + if ( (!preg_match("/NONE/",$view_calls_in_queue)) and ($auto_dial_level > 0) ) + {$view_calls_in_queue=1;} + else + {$view_calls_in_queue=0;} + + if (preg_match("/Y/",$pause_after_each_call)) + {$dispo_check_all_pause=1;} + + $quick_transfer_button_enabled=0; + if (preg_match("/IN_GROUP|PRESET_1|PRESET_2|PRESET_3|PRESET_4|PRESET_5/",$quick_transfer_button)) + {$quick_transfer_button_enabled=1;} + + $preset_populate=''; + $prepopulate_transfer_preset_enabled=0; + if (preg_match("/PRESET_1|PRESET_2|PRESET_3|PRESET_4|PRESET_5/",$prepopulate_transfer_preset)) + { + $prepopulate_transfer_preset_enabled=1; + if (preg_match("/PRESET_1/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_a_number;} + if (preg_match("/PRESET_2/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_b_number;} + if (preg_match("/PRESET_3/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_c_number;} + if (preg_match("/PRESET_4/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_d_number;} + if (preg_match("/PRESET_5/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_e_number;} + } + + $default_group_alias_cid=''; + if (strlen($default_group_alias)>1) + { + $stmt = "select caller_id_number from groups_alias where group_alias_id='$default_group_alias';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01055',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidnum_ct = mysql_num_rows($rslt); + if ($VDIG_cidnum_ct > 0) + { + $row=mysql_fetch_row($rslt); + $default_group_alias_cid = $row[0]; + } + } + + $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VD_campaign' and user='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $default_web_vars = $row[0]; + } + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + echo "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($VU_alter_custphone_override=='ALLOW_ALTER') + {$disable_alter_custphone='N';} + if (strlen($three_way_dial_prefix) < 1) + {$three_way_dial_prefix = $dial_prefix ;} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + { + $alt_phone_dialing='0'; + $DefaulTAlTDiaL='0'; + } + if ($display_queue_count=='N') + {$callholdstatus='0';} + if ( ($dial_method == 'INBOUND_MAN') or ($outbound_autodial_active < 1) ) + {$VU_closer_default_blended=0;} + + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ( (ereg('Y',$agent_pause_codes_active)) or (ereg('FORCE',$agent_pause_codes_active)) ) + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01014',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 600;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01015',$VD_login,$server_ip,$session_name,$one_mysql_log);} + 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); + } + else + {$closer_campaigns = "''";} + + ##### gather territory listings for this agent if select territories is enabled + $VARterritories=''; + if ($agent_select_territories > 0) + { + $stmt="SELECT territory from vicidial_user_territories where user='$VD_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01062',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $territory_ct = mysql_num_rows($rslt); + $territoryCT=0; + while ($territoryCT < $territory_ct) + { + $row=mysql_fetch_row($rslt); + $territories[$territoryCT] =$row[0]; + $VARterritories = "$VARterritories'$territories[$territoryCT]',"; + $territoryCT++; + } + $VARterritories = substr("$VARterritories", 0, -1); + echo "\n"; + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 600;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01016',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + if (ereg('Y',$agent_allow_group_alias)) + { + ##### grab the active group aliases + $stmt="SELECT group_alias_id,group_alias_name,caller_id_number FROM groups_alias WHERE active='Y' order by group_alias_id limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01054',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_group_aliases = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_group_aliases) + { + $row=mysql_fetch_row($rslt); + $group_alias_id[$i] = $row[0]; + $group_alias_name[$i] = $row[1]; + $caller_id_number[$i] = $row[2]; + $VARgroup_alias_ids = "$VARgroup_alias_ids'$group_alias_id[$i]',"; + $VARgroup_alias_names = "$VARgroup_alias_names'$group_alias_name[$i]',"; + $VARcaller_id_numbers = "$VARcaller_id_numbers'$caller_id_number[$i]',"; + $i++; + $j++; + } + $VD_group_aliases_ct = ($VD_group_aliases_ct+$VD_group_aliases); + $VARgroup_alias_ids = substr("$VARgroup_alias_ids", 0, -1); + $VARgroup_alias_names = substr("$VARgroup_alias_names", 0, -1); + $VARcaller_id_numbers = substr("$VARcaller_id_numbers", 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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01017',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + echo "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Campagne inactive, réessayez
"; } } - ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR - - - - if ($WeBRooTWritablE > 0) + else { - fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); - fclose($fp); + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "L'ouverture de session a èchoué, réessayez
"; } - $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++;} + } + if ($VDloginDISPLAY) + { + echo "Agent web client: Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

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

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } - $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { $row=mysql_fetch_row($rslt); - $LOGallowed_campaigns =$row[0]; + $alias_found = "$row[0]"; + } + if ($alias_found > 0) + { + $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_name = "$row[0]"; + $phone_login = "$row[1]"; + } + } - if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + $pa=0; + if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) + { + $phoneSQL = "("; + $phones_auto = explode(',',$phone_login); + $phones_auto_ct = count($phones_auto); + while($pa < $phones_auto_ct) + { + if ($pa > 0) + {$phoneSQL .= " or ";} + $desc = ($phones_auto_ct - $pa); # traverse in reverse order + $phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')"; + $pa++; + } + $phoneSQL .= ")"; + } + else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";} + + $authphone=0; + #$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; + $stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01020',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Agent web client: Ouverture de Session téléphonique Error\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


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

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ### go through the entered phones to figure out which server has fewest agents + ### logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + while($pb < $phones_auto_ct) + { + ### find the server_ip of each phone_login + $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; + if ($DB) {echo "|$stmtx|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmtx, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01021',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + + ### get number of agents logged in to each server + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01022',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + + ### find out whether the server is set to active + $stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y' and active_agent_login_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01023',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out whether the server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowx[0]' and last_update > '$past_minutes_date';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01024',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowz=mysql_fetch_row($rslt); + + $pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]| "; + + if ( ($rowy[0] > 0) && ($rowz[0] > 0) ) + { + if ( ($pb_count >= $row[0]) || (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Agent web client\n"; + $stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret,is_webphone,use_external_server_ip from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01025',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $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]; + $outbound_cid=$row[65]; + $enable_sipsak_messages=$row[66]; + $is_webphone=$row[73]; + $use_external_server_ip=$row[74]; + + $no_empty_session_warnings=0; + if ($phone_login == 'nophone') + { + $no_empty_session_warnings=1; + } + if ($PhonESComPIP == '1') + { + if (strlen($computer_ip) < 4) + { + $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01026',$VD_login,$server_ip,$session_name,$one_mysql_log);} + } + } + if ($PhonESComPIP == '2') + { + $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01027',$VD_login,$server_ip,$session_name,$one_mysql_log);} + } + if ($clientDST) + { + $local_gmt = ($local_gmt + $isdst); + } + if ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + $SIP_user = "$protocol/$extension"; + $SIP_user_DiaL = "$protocol/$extension"; + if ( (ereg('8300',$dialplan_number)) and (strlen($dialplan_number)<5) and ($protocol == 'Local') ) + { + $SIP_user = "$protocol/$extension$VD_login"; + } + + $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01028',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $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"; + echo "\n"; + } + echo "\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"; + echo "\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 a web form address two is not set, use the first one + if (strlen($web_form_address_two)>0) + { + $VICIDiaL_web_form_address_two = "$web_form_address_two"; + echo "\n"; + } + else + { + $VICIDiaL_web_form_address_two = "$VICIDiaL_web_form_address"; + echo "\n"; + $VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two); + } + $VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two); + + # If closers are allowed sur this campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + echo "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + echo "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01029',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01030',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + if ( ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ### insert an entry into the user log for the login event + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01031',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + ##### 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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01032',$VD_login,$server_ip,$session_name,$one_mysql_log);} + 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) + {echo "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null));"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01033',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_conferences set extension='$SIP_user', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01034',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and ( (extension='$SIP_user') or (extension='$VD_login') );"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $session_id = $row[0]; + } + echo "\n"; + } + + ### mark leads that were not dispositioned during previous calls as ERI + $stmt="UPDATE vicidial_list set status='ERI', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01037',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01038',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01039',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\n"; + + # echo "You have logged in as user: $VD_login sur phone: $SIP_user Campagne:: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages,queuemetrics_loginout FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01040',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $vicidial_agent_disable = $row[6]; + $allow_sipsak_messages = $row[7]; + $queuemetrics_loginout = $row[8]; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'LIN-'; + echo "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; + } + + $webphone_content=''; + if ($is_webphone != 'Y') + { + ### insert a NOUVEAU record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user_DiaL','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: \"$SIqueryCID\" <$campaign_cid>','','','','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01041',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\n"; + } + else + { + ### build Iframe variable content for webphone here + $webphone_server_ip = $server_ip; + if ($use_external_server_ip=='Y') + { + ##### find external_server_ip if enabled for this phone account + $stmt="SELECT external_server_ip FROM servers where server_ip='$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $exip_ct = mysql_num_rows($rslt); + if ($exip_ct > 0) + { + $row=mysql_fetch_row($rslt); + $webphone_server_ip =$row[0]; + } + } + ##### find webphone_url in system_settings and generate IFRAME code for it ##### + $stmt="SELECT webphone_url FROM system_settings LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $wu_ct = mysql_num_rows($rslt); + if ($wu_ct > 0) + { + $row=mysql_fetch_row($rslt); + $webphone_url =$row[0]; + } + + ### base64 encode variables + $b64_phone_login = base64_encode($extension); + $b64_phone_pass = base64_encode($phone_pass); + $b64_session_name = base64_encode($session_name); + $b64_server_ip = base64_encode($webphone_server_ip); + $b64_callerid = base64_encode($outbound_cid); + $b64_protocol = base64_encode($protocol); + + $WebPhonEurl = "$webphone_url?phone_login=$b64_phone_login&phone_login=$b64_phone_login&phone_pass=$b64_phone_pass&server_ip=$b64_server_ip&callerid=$b64_callerid&protocol=$b64_protocol"; + $webphone_content = ""; + } + + ##### grab the campaign_weight and number of calls today sur that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01042',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vca_ct = mysql_num_rows($rslt); + if ($vca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_weight = $row[0]; + $calls_today = $row[1]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01043',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\n"; + } + + if ($auto_dial_level > 0) + { + echo "\n"; + + + $closer_chooser_string=''; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01044',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $QM_LOGIN = 'AGENTLOGIN'; + $QM_PHONE = "$VD_login@agents"; + if ($queuemetrics_loginout=='CALLBACK') + { + $QM_LOGIN = 'AGENTCALLBACKLOGIN'; + $QM_PHONE = "$SIP_user_DiaL"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01045',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + echo "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01046',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + echo "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + + if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) + { + print "\n"; + } + } + else + { + print "\n"; + + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level', '$campaign_weight', '$calls_today','$NOW_TIME','N','N');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01047',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + echo "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $QM_LOGIN = 'AGENTLOGIN'; + $QM_PHONE = "$VD_login@agents"; + if ($queuemetrics_loginout=='CALLBACK') + { + $QM_LOGIN = 'AGENTCALLBACKLOGIN'; + $QM_PHONE = "$SIP_user_DiaL"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01048',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + echo "\n"; + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01049',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + echo "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + } + } + else { echo "Agent web client: Ouverture de Campagne\n"; echo "\n"; @@ -1036,7 +2172,33 @@ $VDloginDISPLAY=0; echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Français
\n"; - echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "Aucune fiche client n'est éligible pour cette campagne\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ouverture de Session: \n
"; + echo "Mot de passe:
\n"; + echo "Campagne: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Agent web client: Ouverture de Campagne\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "Sorry, there are no available sessions\n"; echo "
\n"; echo "\n"; echo "\n"; @@ -1054,1154 +2216,97 @@ echo "
0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01009',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $CAMPactive=$row[0]; - if($CAMPactive>0) + if (ereg('MSIE',$browser)) { - 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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01010',$VD_login,$server_ip,$session_name,$one_mysql_log);} - 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 80;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01011',$VD_login,$server_ip,$session_name,$one_mysql_log);} - 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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01012',$VD_login,$server_ip,$session_name,$one_mysql_log);} - 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 campaign settings - $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $row=mysql_fetch_row($rslt); - $park_ext = $row[0]; - $park_file_name = $row[1]; - $web_form_address = stripslashes($row[2]); - $allow_closers = $row[3]; - $auto_dial_level = $row[4]; - $dial_timeout = $row[5]; - $dial_prefix = $row[6]; - $campaign_cid = $row[7]; - $campaign_vdad_exten = $row[8]; - $campaign_rec_exten = $row[9]; - $campaign_recording = $row[10]; - $campaign_rec_filename = $row[11]; - $campaign_script = $row[12]; - $get_call_launch = $row[13]; - $campaign_am_message_exten = '8320'; - $xferconf_a_dtmf = $row[15]; - $xferconf_a_number = $row[16]; - $xferconf_b_dtmf = $row[17]; - $xferconf_b_number = $row[18]; - $alt_number_dialing = $row[19]; - $VC_scheduled_callbacks = $row[20]; - $wrapup_seconds = $row[21]; - $wrapup_message = $row[22]; - $closer_campaigns = $row[23]; - $use_internal_dnc = $row[24]; - $allcalls_delay = $row[25]; - $omit_phone_code = $row[26]; - $agent_pause_codes_active = $row[27]; - $no_hopper_leads_logins = $row[28]; - $campaign_allow_inbound = $row[29]; - $manual_dial_list_id = $row[30]; - $default_xfer_group = $row[31]; - $xfer_groups = $row[32]; - $disable_alter_custphone = $row[33]; - $display_queue_count = $row[34]; - $manual_dial_filter = $row[35]; - $CopY_tO_ClipboarD = $row[36]; - $use_campaign_dnc = $row[37]; - $three_way_call_cid = $row[38]; - $dial_method = $row[39]; - $three_way_dial_prefix = $row[40]; - $web_form_target = $row[41]; - $vtiger_screen_login = $row[42]; - $agent_allow_group_alias = $row[43]; - $default_group_alias = $row[44]; - $quick_transfer_button = $row[45]; - $prepopulate_transfer_preset = $row[46]; - $view_calls_in_queue = $row[47]; - $view_calls_in_queue_launch = $row[48]; - $call_requeue_button = $row[49]; - $pause_after_each_call = $row[50]; - $no_hopper_dialing = $row[51]; - $agent_dial_owner_only = $row[52]; - $agent_display_dialable_leads = $row[53]; - $web_form_address_two = $row[54]; - $agent_select_territories = $row[55]; - $crm_popup_login = $row[56]; - $crm_login_address = $row[57]; - $timer_action = $row[58]; - $timer_action_message = $row[59]; - $timer_action_seconds = $row[60]; - $start_call_url = $row[61]; - $dispo_call_url = $row[62]; - $xferconf_c_number = $row[63]; - $xferconf_d_number = $row[64]; - $xferconf_e_number = $row[65]; - - if ($user_territories_active < 1) - {$agent_select_territories = 0;} - if (preg_match("/Y/",$agent_select_territories)) - {$agent_select_territories=1;} - else - {$agent_select_territories=0;} - - if (preg_match("/Y/",$agent_display_dialable_leads)) - {$agent_display_dialable_leads=1;} - else - {$agent_display_dialable_leads=0;} - - if (preg_match("/Y/",$no_hopper_dialing)) - {$no_hopper_dialing=1;} - else - {$no_hopper_dialing=0;} - - if ( (preg_match("/Y/",$call_requeue_button)) and ($auto_dial_level > 0) ) - {$call_requeue_button=1;} - else - {$call_requeue_button=0;} - - if ( (preg_match("/AUTO/",$view_calls_in_queue_launch)) and ($auto_dial_level > 0) ) - {$view_calls_in_queue_launch=1;} - else - {$view_calls_in_queue_launch=0;} - - if ( (!preg_match("/NONE/",$view_calls_in_queue)) and ($auto_dial_level > 0) ) - {$view_calls_in_queue=1;} - else - {$view_calls_in_queue=0;} - - if (preg_match("/Y/",$pause_after_each_call)) - {$dispo_check_all_pause=1;} - - $quick_transfer_button_enabled=0; - if (preg_match("/IN_GROUP|PRESET_1|PRESET_2|PRESET_3|PRESET_4|PRESET_5/",$quick_transfer_button)) - {$quick_transfer_button_enabled=1;} - - $preset_populate=''; - $prepopulate_transfer_preset_enabled=0; - if (preg_match("/PRESET_1|PRESET_2|PRESET_3|PRESET_4|PRESET_5/",$prepopulate_transfer_preset)) - { - $prepopulate_transfer_preset_enabled=1; - if (preg_match("/PRESET_1/",$prepopulate_transfer_preset)) - {$preset_populate = $xferconf_a_number;} - if (preg_match("/PRESET_2/",$prepopulate_transfer_preset)) - {$preset_populate = $xferconf_b_number;} - if (preg_match("/PRESET_3/",$prepopulate_transfer_preset)) - {$preset_populate = $xferconf_c_number;} - if (preg_match("/PRESET_4/",$prepopulate_transfer_preset)) - {$preset_populate = $xferconf_d_number;} - if (preg_match("/PRESET_5/",$prepopulate_transfer_preset)) - {$preset_populate = $xferconf_e_number;} - } - - $default_group_alias_cid=''; - if (strlen($default_group_alias)>1) - { - $stmt = "select caller_id_number from groups_alias where group_alias_id='$default_group_alias';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01055',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VDIG_cidnum_ct = mysql_num_rows($rslt); - if ($VDIG_cidnum_ct > 0) - { - $row=mysql_fetch_row($rslt); - $default_group_alias_cid = $row[0]; - } - } - - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VD_campaign' and user='$VD_login';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VDIG_cidogwv = mysql_num_rows($rslt); - if ($VDIG_cidogwv > 0) - { - $row=mysql_fetch_row($rslt); - $default_web_vars = $row[0]; - } - - if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) - { - $campaign_recording = $VU_vicidial_recording_override; - echo "\n"; - } - if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) - {$scheduled_callbacks='1';} - if ($VU_vicidial_recording=='0') - {$campaign_recording='NEVER';} - if ($VU_alter_custphone_override=='ALLOW_ALTER') - {$disable_alter_custphone='N';} - if (strlen($three_way_dial_prefix) < 1) - {$three_way_dial_prefix = $dial_prefix ;} - if ($alt_number_dialing=='Y') - {$alt_phone_dialing='1';} - else - { - $alt_phone_dialing='0'; - $DefaulTAlTDiaL='0'; - } - if ($display_queue_count=='N') - {$callholdstatus='0';} - if ( ($dial_method == 'INBOUND_MAN') or ($outbound_autodial_active < 1) ) - {$VU_closer_default_blended=0;} - - $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); - $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); - $closer_campaigns = "'$closer_campaigns'"; - - if ( (ereg('Y',$agent_pause_codes_active)) or (ereg('FORCE',$agent_pause_codes_active)) ) - { - ##### grab the pause codes for this campaign - $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01014',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $VD_pause_codes = mysql_num_rows($rslt); - $j=0; - while ($j < $VD_pause_codes) - { - $row=mysql_fetch_row($rslt); - $pause_codes[$i] =$row[0]; - $pause_code_names[$i] =$row[1]; - $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; - $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; - $i++; - $j++; - } - $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); - $VARpause_codes = substr("$VARpause_codes", 0, -1); - $VARpause_code_names = substr("$VARpause_code_names", 0, -1); - } - - ##### grab the inbound groups to choose from if campaign contains CLOSER - $VARingroups="''"; - if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) - { - $VARingroups=''; - $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 600;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01015',$VD_login,$server_ip,$session_name,$one_mysql_log);} - 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); - } - else - {$closer_campaigns = "''";} - - ##### gather territory listings for this agent if select territories is enabled - $VARterritories=''; - if ($agent_select_territories > 0) - { - $stmt="SELECT territory from vicidial_user_territories where user='$VD_login';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01062',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $territory_ct = mysql_num_rows($rslt); - $territoryCT=0; - while ($territoryCT < $territory_ct) - { - $row=mysql_fetch_row($rslt); - $territories[$territoryCT] =$row[0]; - $VARterritories = "$VARterritories'$territories[$territoryCT]',"; - $territoryCT++; - } - $VARterritories = substr("$VARterritories", 0, -1); - echo "\n"; - } - - ##### grab the allowable inbound groups to choose from for transfer options - $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); - $xfer_groups = preg_replace("/ /","','",$xfer_groups); - $xfer_groups = "'$xfer_groups'"; - $VARxfergroups="''"; - if ($allow_closers == 'Y') - { - $VARxfergroups=''; - $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 600;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01016',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $xfer_ct = mysql_num_rows($rslt); - $XFgrpCT=0; - while ($XFgrpCT < $xfer_ct) - { - $row=mysql_fetch_row($rslt); - $VARxfergroups = "$VARxfergroups'$row[0]',"; - $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; - if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} - $XFgrpCT++; - } - $VARxfergroups = substr("$VARxfergroups", 0, -1); - $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); - } - - if (ereg('Y',$agent_allow_group_alias)) - { - ##### grab the active group aliases - $stmt="SELECT group_alias_id,group_alias_name,caller_id_number FROM groups_alias WHERE active='Y' order by group_alias_id limit 1000;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01054',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $VD_group_aliases = mysql_num_rows($rslt); - $j=0; - while ($j < $VD_group_aliases) - { - $row=mysql_fetch_row($rslt); - $group_alias_id[$i] = $row[0]; - $group_alias_name[$i] = $row[1]; - $caller_id_number[$i] = $row[2]; - $VARgroup_alias_ids = "$VARgroup_alias_ids'$group_alias_id[$i]',"; - $VARgroup_alias_names = "$VARgroup_alias_names'$group_alias_name[$i]',"; - $VARcaller_id_numbers = "$VARcaller_id_numbers'$caller_id_number[$i]',"; - $i++; - $j++; - } - $VD_group_aliases_ct = ($VD_group_aliases_ct+$VD_group_aliases); - $VARgroup_alias_ids = substr("$VARgroup_alias_ids", 0, -1); - $VARgroup_alias_names = substr("$VARgroup_alias_names", 0, -1); - $VARcaller_id_numbers = substr("$VARcaller_id_numbers", 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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01017',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $row=mysql_fetch_row($rslt); - $campaign_leads_to_call = $row[0]; - echo "\n"; - + $useIE=1; + echo "\n"; } - else + else { - $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "Campagne inactive, réessayez
"; - } - } - else - { - if ($WeBRooTWritablE > 0) - { - fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); - fclose($fp); - } - $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "L'ouverture de session a èchoué, réessayez
"; - } - } - if ($VDloginDISPLAY) - { - echo "Agent web client: Ouverture de Campagne\n"; - echo "\n"; - echo "\n"; - echo "
Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Français
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "

$VDdisplayMESSAGE

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

VERSION: $version       BUILD: $build
\n"; - echo "\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - -$original_phone_login = $phone_login; - -# code for parsing load-balanced agent phone allocation where agent interface -# will send multiple phones-table logins so that the script can determine the -# server that has the fewest agents logged into it. -# login: ca101,cb101,cc101 - $alias_found=0; -$stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; -$rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01018',$VD_login,$server_ip,$session_name,$one_mysql_log);} -$alias_ct = mysql_num_rows($rslt); -if ($alias_ct > 0) - { - $row=mysql_fetch_row($rslt); - $alias_found = "$row[0]"; - } -if ($alias_found > 0) - { - $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01019',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $alias_ct = mysql_num_rows($rslt); - if ($alias_ct > 0) - { - $row=mysql_fetch_row($rslt); - $alias_name = "$row[0]"; - $phone_login = "$row[1]"; - } - } - -$pa=0; -if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) - { - $phoneSQL = "("; - $phones_auto = explode(',',$phone_login); - $phones_auto_ct = count($phones_auto); - while($pa < $phones_auto_ct) - { - if ($pa > 0) - {$phoneSQL .= " or ";} - $desc = ($phones_auto_ct - $pa); # traverse in reverse order - $phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')"; - $pa++; - } - $phoneSQL .= ")"; - } -else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";} - -$authphone=0; -#$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; -$stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;"; -if ($DB) {echo "|$stmt|\n";} -$rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01020',$VD_login,$server_ip,$session_name,$one_mysql_log);} -$row=mysql_fetch_row($rslt); -$authphone=$row[0]; -if (!$authphone) - { - echo "Agent web client: Ouverture de Session téléphonique Error\n"; - echo "\n"; - echo "\n"; - echo "Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Français
\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "


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

VERSION: $version       BUILD: $build
\n"; - echo "\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } -else - { -### go through the entered phones to figure out which server has fewest agents -### logged in and use that phone login account - if ($pa > 0) - { - $pb=0; - $pb_login=''; - $pb_server_ip=''; - $pb_count=0; - $pb_log=''; - while($pb < $phones_auto_ct) - { - ### find the server_ip of each phone_login - $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; - if ($DB) {echo "|$stmtx|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} - $rslt=mysql_query($stmtx, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01021',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $rowx=mysql_fetch_row($rslt); - - ### get number of agents logged in to each server - $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01022',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - - ### find out whether the server is set to active - $stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y' and active_agent_login_server='Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01023',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $rowy=mysql_fetch_row($rslt); - - ### find out whether the server_updater is running - $stmt="SELECT count(*) from server_updater where server_ip = '$rowx[0]' and last_update > '$past_minutes_date';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01024',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $rowz=mysql_fetch_row($rslt); - - $pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]| "; - - if ( ($rowy[0] > 0) && ($rowz[0] > 0) ) - { - if ( ($pb_count >= $row[0]) || (strlen($pb_server_ip) < 4) ) - { - $pb_count=$row[0]; - $pb_server_ip=$rowx[0]; - $phone_login=$phones_auto[$pb]; - } - } - $pb++; - } - echo "\n"; - } - echo "Agent web client\n"; - $stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01025',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $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]; - $outbound_cid=$row[65]; - $enable_sipsak_messages=$row[66]; - - $no_empty_session_warnings=0; - if ($phone_login == 'nophone') - { - $no_empty_session_warnings=1; - } - if ($PhonESComPIP == '1') - { - if (strlen($computer_ip) < 4) - { - $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01026',$VD_login,$server_ip,$session_name,$one_mysql_log);} - } - } - if ($PhonESComPIP == '2') - { - $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01027',$VD_login,$server_ip,$session_name,$one_mysql_log);} - } - if ($clientDST) - { - $local_gmt = ($local_gmt + $isdst); - } - if ($protocol == 'EXTERNAL') - { - $protocol = 'Local'; - $extension = "$dialplan_number$AT$ext_context"; - } - $SIP_user = "$protocol/$extension"; - $SIP_user_DiaL = "$protocol/$extension"; - if ( (ereg('8300',$dialplan_number)) and (strlen($dialplan_number)<5) and ($protocol == 'Local') ) - { - $SIP_user = "$protocol/$extension$VD_login"; - } - - $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01028',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $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"; - echo "\n"; - } - echo "\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"; - echo "\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 a web form address two is not set, use the first one - if (strlen($web_form_address_two)>0) - { - $VICIDiaL_web_form_address_two = "$web_form_address_two"; - echo "\n"; - } - else - { - $VICIDiaL_web_form_address_two = "$VICIDiaL_web_form_address"; - echo "\n"; - $VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two); - } - $VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two); - - # If closers are allowed sur this campaign - if ($allow_closers=="Y") - { - $VICIDiaL_allow_closers = 1; - echo "\n"; - } - else - { - $VICIDiaL_allow_closers = 0; - echo "\n"; - } - - - $session_ext = eregi_replace("[^a-z0-9]", "", $extension); - if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} - $session_rand = (rand(1,9999999) + 10000000); - $session_name = "$StarTtimE$US$session_ext$session_rand"; - - if ($webform_sessionname) - {$webform_sessionname = "&session_name=$session_name";} - else - {$webform_sessionname = '';} - - $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01029',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - $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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01030',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - if ( ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) - { - ### insert an entry into the user log for the login event - $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01031',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - ##### 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 ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01032',$VD_login,$server_ip,$session_name,$one_mysql_log);} - 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) - {echo "\n";} - else - { - ##### grab the next available vicidial_conference room and reserve it - $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null));"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01033',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - if ($row[0] > 0) - { - $stmt="UPDATE vicidial_conferences set extension='$SIP_user', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01034',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and ( (extension='$SIP_user') or (extension='$VD_login') );"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01035',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $session_id = $row[0]; - } - echo "\n"; + $useIE=0; + echo "\n"; } - ### mark leads that were not dispositioned during previous calls as ERI - $stmt="UPDATE vicidial_list set status='ERI', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01050',$VD_login,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); - echo "\n"; + $agent_log_id = mysql_insert_id($link); + echo "\n"; - $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + ##### update vicidial_campaigns to show agent has logged in + $stmt="UPDATE vicidial_campaigns set campaign_logindate='$NOW_TIME' where campaign_id='$VD_campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01037',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01064',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VCaffected_rows = mysql_affected_rows($link); + echo "\n"; - $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($enable_queuemetrics_logging > 0) + { + $StarTtimEpause = ($StarTtimE + 1); + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimEpause',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEREASON',data1='LOGIN',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01063',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + echo "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id' where user='$VD_login';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01038',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01061',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); - $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + $stmt="UPDATE vicidial_users SET shift_override_flag='0' where user='$VD_login' and shift_override_flag='1';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01039',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01057',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VUaffected_rows = mysql_affected_rows($link); - # echo "You have logged in as user: $VD_login sur phone: $SIP_user Campagne:: $VD_campaign
\n"; - $VICIDiaL_is_logged_in=1; + $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"; - ### set the callerID for manager middleware-app to connect the phone to the user - $SIqueryCID = "S$CIDdate$session_id"; - - ############################################# - ##### START SYSTEM_SETTINGS LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name FROM vicidial_scripts WHERE active='Y' order by script_id limit 1000;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01040',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01051',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - $qm_conf_ct = mysql_num_rows($rslt); - if ($qm_conf_ct > 0) + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) { $row=mysql_fetch_row($rslt); - $enable_queuemetrics_logging = $row[0]; - $queuemetrics_server_ip = $row[1]; - $queuemetrics_dbname = $row[2]; - $queuemetrics_login = $row[3]; - $queuemetrics_pass = $row[4]; - $queuemetrics_log_id = $row[5]; - $vicidial_agent_disable = $row[6]; - $allow_sipsak_messages = $row[7]; - } - ##### END QUEUEMETRICS LOGGING LOOKUP ##### - ########################################### - - if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) - { - $SIPSAK_prefix = 'LIN-'; - echo "\n"; - passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); - $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; - } - - ### insert a NOUVEAU record to the vicidial_manager table to be processed - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user_DiaL','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: \"$SIqueryCID\" <$campaign_cid>','','','','','');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01041',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - - ##### grab the campaign_weight and number of calls today sur that campaign for the agent - $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01042',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $vca_ct = mysql_num_rows($rslt); - if ($vca_ct > 0) - { - $row=mysql_fetch_row($rslt); - $campaign_weight = $row[0]; - $calls_today = $row[1]; - $i++; - } - else - { - $campaign_weight = '0'; - $calls_today = '0'; - $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01043',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - } - - if ($auto_dial_level > 0) - { - echo "\n"; - - - $closer_chooser_string=''; - $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y','N');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01044',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - - if ($enable_queuemetrics_logging > 0) - { - $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); - mysql_select_db("$queuemetrics_dbname", $linkB); - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01045',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01046',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - mysql_close($linkB); - mysql_select_db("$VARDB_database", $link); - } - - - if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) - { - print "\n"; - } - } - else - { - print "\n"; - - $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level', '$campaign_weight', '$calls_today','$NOW_TIME','N','N');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01047',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - - if ($enable_queuemetrics_logging > 0) - { - $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); - mysql_select_db("$queuemetrics_dbname", $linkB); - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01048',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01049',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - mysql_close($linkB); - mysql_select_db("$VARDB_database", $link); - } + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = urlencode($row[1]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $e++; } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); } - else - { - echo "Agent web client: Ouverture de Campagne\n"; - echo "\n"; - echo "\n"; - echo "Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Français
\n"; - echo "Aucune fiche client n'est éligible pour cette campagne\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "Ouverture de Session: \n
"; - echo "Mot de passe:
\n"; - echo "Campagne: $camp_form_code
\n"; - echo "   \n"; - echo "\n"; - echo "
\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - if (strlen($session_id) < 1) - { - echo "Agent web client: Ouverture de Campagne\n"; - echo "\n"; - echo "\n"; - echo "Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Français
\n"; - echo "Sorry, there are no available sessions\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "Ouverture de Session: \n
"; - echo "Mot de passe:
\n"; - echo "Campagne: $camp_form_code
\n"; - echo "   \n"; - echo "\n"; - echo "
\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - - if (ereg('MSIE',$browser)) - { - $useIE=1; - echo "\n"; - } - else - { - $useIE=0; - echo "\n"; - } - - $StarTtimE = date("U"); - $NOW_TIME = date("Y-m-d H:i:s"); - ##### Agent is going to log in so insert the vicidial_agent_log entry now - $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01050',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - $agent_log_id = mysql_insert_id($link); - echo "\n"; - - ##### update vicidial_campaigns to show agent has logged in - $stmt="UPDATE vicidial_campaigns set campaign_logindate='$NOW_TIME' where campaign_id='$VD_campaign';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01064',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VCaffected_rows = mysql_affected_rows($link); - echo "\n"; - - if ($enable_queuemetrics_logging > 0) - { - $StarTtimEpause = ($StarTtimE + 1); - $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); - mysql_select_db("$queuemetrics_dbname", $linkB); - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimEpause',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEREASON',data1='LOGIN',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01063',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - mysql_close($linkB); - mysql_select_db("$VARDB_database", $link); - } - - $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id' where user='$VD_login';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01061',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VLAaffected_rows_update = mysql_affected_rows($link); - - $stmt="UPDATE vicidial_users SET shift_override_flag='0' where user='$VD_login' and shift_override_flag='1';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01057',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VUaffected_rows = mysql_affected_rows($link); - - $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 FROM vicidial_scripts WHERE active='Y' order by script_id limit 1000;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01051',$VD_login,$server_ip,$session_name,$one_mysql_log);} - 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] = urlencode($row[1]); - $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; - $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; - $e++; - } - $MMscriptids = substr("$MMscriptids", 0, -1); - $MMscriptnames = substr("$MMscriptnames", 0, -1); } -} ### SCREEN WIDTH AND HEIGHT CALCULATIONS ### @@ -2221,6 +2326,11 @@ if ($stretch_dimensions > 0) if ($JS_browser_height >= 340) {$BROWSER_HEIGHT = ($JS_browser_height - 40);} } +if ($agent_fullscreen=='Y') + { + $BROWSER_WIDTH = ($JS_browser_width - 10); + $BROWSER_HEIGHT = $JS_browser_height; + } $MASTERwidth=($BROWSER_WIDTH - 340); $MASTERheight=($BROWSER_HEIGHT - 200); if ($MASTERwidth < 430) {$MASTERwidth = '430';} @@ -2251,6 +2361,8 @@ $CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume co $SSheight = ($MASTERheight + 31); # 331 - script content $HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey $BPheight = ($MASTERheight - 250); # 50 - bottom buffer, Agent Xfer Span +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} ################################################################ @@ -2408,6 +2520,7 @@ $CCAL_OUT .= "
"; var VU_agent_choose_ingroups_DV = ''; var agent_choose_territories = ''; var agent_select_territories = ''; + var agent_choose_blended = ''; var VU_closer_campaigns = ''; var CallBackDatETimE = ''; var CallBackrecipient = ''; @@ -2538,6 +2651,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var dial_prefix = ''; var three_way_dial_prefix = ''; var campaign_cid = ''; + var use_custom_cid = ''; var campaign_vdad_exten = ''; var campaign_leads_to_call = ''; var epoch_sec = ; @@ -2748,7 +2862,24 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var timer_action=''; var timer_action_message=''; var timer_action_seconds=''; + var is_webphone=''; + var WebPhonEurl=''; var pause_code_counter=1; + var agent_call_log_view=''; + var scheduled_callbacks_alert=''; + var scheduled_callbacks_count=''; + var tmp_vicidial_id=''; + var agent_xfer_consultative=''; + var agent_xfer_dial_override=''; + var agent_xfer_vm_transfer=''; + var agent_xfer_blind_transfer=''; + var agent_xfer_dial_with_customer=''; + var agent_xfer_park_customer_dial=''; + var EAphone_code=''; + var EAphone_number=''; + var EAalt_phone_notes=''; + var EAalt_phone_active=''; + var EAalt_phone_count=''; var DiaLControl_auto_HTML = "\"
\"Résumé\""; var DiaLControl_auto_HTML_ready = "\"\"Résumé\""; var DiaLControl_auto_HTML_OFF = "\"\"Résumé\""; @@ -3030,6 +3161,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {threeway_cid = outbound_cid;} if (three_way_call_cid == 'CUSTOMER') {threeway_cid = document.vicidial_form.phone_number.value;} + if (three_way_call_cid == 'CUSTOM_CID') + {threeway_cid = document.vicidial_form.security_phrase.value;} if (three_way_call_cid == 'AGENT_CHOOSE') { threeway_cid = cid_choice; @@ -3428,7 +3561,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} dialedcall_send_hangup(); } - if ( (APIStatuS.length < 10) && (APIStatuS.length > 0) && (AgentDispoing > 0) ) + if ( (APIStatuS.length < 10) && (APIStatuS.length > 0) && (AgentDispoing > 1) ) { document.vicidial_form.DispoSelection.value = APIStatuS; DispoSelect_submit(); @@ -3515,7 +3648,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (InGroupChange > 0) { var external_blended = InGroupChangeBlend; - var external_igb_set_user = InGroupChangeUser; + var external_igb_set_user = InGroupChangeUtilisateur; external_igb_set_name = InGroupChangeName; manager_ingroups_set=1; @@ -3692,11 +3825,11 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (inOUT == 'OUT') { - var tmp_vicidial_id = document.vicidial_form.uniqueid.value; + tmp_vicidial_id = document.vicidial_form.uniqueid.value; } else { - var tmp_vicidial_id = 'IN'; + tmp_vicidial_id = 'IN'; } var xmlhttp=false; /*@cc_on @*/ @@ -3881,7 +4014,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} no_delete_VDAC=0; if (taskvar == 'XfeRVMAIL') { - var blindxferdialstring = campaign_am_message_exten; + var blindxferdialstring = campaign_am_message_exten + '*' + campaign + '*' + document.vicidial_form.phone_code.value + '*' + document.vicidial_form.phone_number.value + '*' + document.vicidial_form.lead_id.value; no_delete_VDAC=1; } if (blindxferdialstring.length<'2') @@ -4014,7 +4147,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (XFRDop == "NeWSessioN") { threeway_end=1; - document.vicidial_form.callchannel.value = ''; + document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; dialedcall_send_hangup(); @@ -4077,7 +4210,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if ( (taskvar == 'XfeRLOCAL') || (taskvar == 'XfeRBLIND') || (taskvar == 'XfeRVMAIL') ) { if (auto_dial_level == 0) {RedirecTxFEr = 1;} - document.vicidial_form.callchannel.value = ''; + document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; if( document.images ) { document.images['livecall'].src = image_livecall_OFF.src;} // alert(RedirecTxFEr + "|" + auto_dial_level); @@ -4289,12 +4422,38 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + var CBpre = ''; + var CBpost = ''; + // alert(xmlhttp.responseText); - var CBcounT = xmlhttp.responseText; + var CBcounTtotal = xmlhttp.responseText; + var CBcounTtotal_array=CBcounTtotal.split("|"); + var CBcounT = CBcounTtotal_array[0]; + if (scheduled_callbacks_count='LIVE') + {CBcounT = CBcounTtotal_array[1];} if (CBcounT == 0) {var CBprint = "NO";} - else {var CBprint = CBcounT;} - document.getElementById("CBstatusSpan").innerHTML ="" + CBprint + " RAPPELS EN COURS"; - + else + { + var CBprint = CBcounT; + + if (scheduled_callbacks_alert == 'BLINK') + { + CBpre = ''; + CBpost = ''; + } + if (scheduled_callbacks_alert == 'RED') + { + CBpre = ''; + CBpost = ''; + } + if (scheduled_callbacks_alert == 'BLINK_RED') + { + CBpre = ''; + CBpost = ''; + } + } + + document.getElementById("CBstatusSpan").innerHTML ="" + CBpre + '' + CBprint + '' + " RAPPELS EN COURS" + CBpost + ""; } } delete xmlhttp; @@ -4350,7 +4509,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var CB_calls = all_CBs_array[0]; var loop_ct=0; var conv_start=0; - var CB_HTML = ">" + var CB_HTML = "
# APPELBACK DATE/TIMENOMBRENAME STATUTCAMPAIGNLAST APPEL DATE/TIME COMMENTS
>>" while (loop_ct < CB_calls) { loop_ct++; @@ -4415,7 +4574,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // ################################################################################ // Open page to enter details for a new manual dial lead - function NeWManuaLDiaLCalL(TVfast) + function NeWManuaLDiaLCalL(TVfast,TVphone_code,TVphone_number) { if ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) ) { @@ -4429,6 +4588,13 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } else { + if (TVfast=='CALLLOG') + { + hideDiv('CalLLoGDisplaYBox'); + hideDiv('LeaDInfOBox'); + document.vicidial_form.MDDiaLCodE.value = TVphone_code; + document.vicidial_form.MDPhonENumbeR.value = TVphone_number; + } if (agent_allow_group_alias == 'Y') { document.getElementById("ManuaLDiaLGrouPSelecteD").innerHTML = "Groupe Alias: " + active_group_alias + ""; @@ -4602,7 +4768,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (XDalert == 'ERROR') { - var DiaLAlerTMessagE = "Call Rejected: " + XDchannel; + var XDerrorDesc = MDlookResponse_array[3]; + var DiaLAlerTMessagE = "Call Rejected: " + XDchannel + "\n" + XDerrorDesc; TimerActionRun("DiaLAlerT",DiaLAlerTMessagE); } if ( (XDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') && (MD_ring_secondS < 10) ) @@ -4645,7 +4812,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (MDalert == 'ERROR') { - var DiaLAlerTMessagE = "Call Rejected: " + MDchannel; + var MDerrorDesc = MDlookResponse_array[3]; + var DiaLAlerTMessagE = "Call Rejected: " + MDchannel + "\n" + MDerrorDesc; TimerActionRun("DiaLAlerT",DiaLAlerTMessagE); } if ( (MDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') ) @@ -4658,7 +4826,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} custchannellive=1; document.vicidial_form.uniqueid.value = MDlookResponse_array[0]; - document.vicidial_form.callchannel.value = MDlookResponse_array[1]; + document.getElementById("callchannel").innerHTML = MDlookResponse_array[1]; lastcustchannel = MDlookResponse_array[1]; if( document.images ) { document.images['livecall'].src = image_livecall_ON.src;} document.vicidial_form.SecondS.value = 0; @@ -5901,10 +6069,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {var call_prefix = dial_prefix;} - manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id; + manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id + "&security=" + document.vicidial_form.security_phrase.value; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); - xmlhttp.send(manDiaLonly_query); + xmlhttp.send(manDiaLonly_query); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) @@ -5915,7 +6083,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} MDOnextResponse = xmlhttp.responseText; var MDOnextResponse_array=MDOnextResponse.split("\n"); - MDnextCID = MDOnextResponse_array[0]; + MDnextCID = MDOnextResponse_array[0]; + agent_log_id = MDOnextResponse_array[1]; if (MDnextCID == " APPEL NOT PLACED") { alert("l'appel n'a pas été composé, une erreur s'est produite:\n" + MDOnextResponse); @@ -6201,7 +6370,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else { // alert("Channel has changed from:\n" + lastcustchannel + '|' + lastcustserverip + "\nto:\n" + reVDIC_data_VDAC[3] + '|' + reVDIC_data_VDAC[4]); - document.vicidial_form.callchannel.value = reVDIC_data_VDAC[3]; + document.getElementById("callchannel").innerHTML = reVDIC_data_VDAC[3]; lastcustchannel = reVDIC_data_VDAC[3]; document.vicidial_form.callserverip.value = reVDIC_data_VDAC[4]; lastcustserverip = reVDIC_data_VDAC[4]; @@ -6316,7 +6485,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { all_record = 'NO'; all_record_count=0; - document.vicidial_form.lead_id.value = ''; + // document.vicidial_form.lead_id.value = ''; var xmlhttprequestcheckauto=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) @@ -6436,7 +6605,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.vicidial_form.uniqueid.value = VDIC_data_VDAC[1]; CIDcheck = VDIC_data_VDAC[2]; CalLCID = VDIC_data_VDAC[2]; - document.vicidial_form.callchannel.value = VDIC_data_VDAC[3]; + document.getElementById("callchannel").innerHTML = VDIC_data_VDAC[3]; lastcustchannel = VDIC_data_VDAC[3]; document.vicidial_form.callserverip.value = VDIC_data_VDAC[4]; lastcustserverip = VDIC_data_VDAC[4]; @@ -7281,7 +7450,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} function DispoHanguPAgaiN() { form_cust_channel = AgaiNHanguPChanneL; - document.vicidial_form.callchannel.value = AgaiNHanguPChanneL; + document.getElementById("callchannel").innerHTML = AgaiNHanguPChanneL; document.vicidial_form.callserverip.value = AgaiNHanguPServeR; lastcustchannel = AgaiNHanguPChanneL; lastcustserverip = AgaiNHanguPServeR; @@ -7333,7 +7502,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {var group = VDCL_group_id;} else {var group = campaign;} - var form_cust_channel = document.vicidial_form.callchannel.value; + var form_cust_channel = document.getElementById("callchannel").innerHTML; var form_cust_serverip = document.vicidial_form.callserverip.value; var customer_channel = lastcustchannel; var customer_server_ip = lastcustserverip; @@ -7448,7 +7617,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } // DEACTIVATE CHANNEL-DEPENDANT BUTTONS AND VARIABLES - document.vicidial_form.callchannel.value = ''; + document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; lastcustchannel=''; lastcustserverip=''; @@ -7477,7 +7646,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.getElementById("ReQueueCall").innerHTML = "\"Re-Queue"; } - document.vicidial_form.custdatetime.value = ''; + document.getElementById("custdatetime").innerHTML = '                     '; if ( (auto_dial_level == 0) && (dial_method != 'INBOUND_MAN') ) { @@ -7887,7 +8056,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { leaving_threeway=0; blind_transfer=0; - document.vicidial_form.callchannel.value = ''; + document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; document.vicidial_form.xferchannel.value = ''; document.getElementById("DialWithCustomer").innerHTML ="\"Appel"; @@ -7929,7 +8098,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} leaving_threeway=0; blind_transfer=0; CheckDEADcallON=0; - document.vicidial_form.callchannel.value = ''; + document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; document.vicidial_form.xferchannel.value = ''; document.getElementById("DialWithCustomer").innerHTML ="\"Appel"; @@ -7968,7 +8137,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&comments=" + CallBackCommenTs; + DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&comments=" + CallBackCommenTs; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(DSupdate_query); @@ -8027,6 +8196,22 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} vtiger_callback_id='0'; recording_filename=''; recording_id=''; + document.vicidial_form.uniqueid.value=''; + MDuniqueid=''; + XDuniqueid=''; + tmp_vicidial_id=''; + EAphone_code=''; + EAphone_number=''; + EAalt_phone_notes=''; + EAalt_phone_active=''; + EAalt_phone_count=''; + XDnextCID=''; + XDcheck = ''; + MDnextCID=''; + XD_live_customer_call = 0; + XD_live_call_secondS = 0; + MD_channel_look=0; + MD_ring_secondS=0; if (manual_dial_in_progress==1) { @@ -8224,7 +8409,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { showDiv('CustomerGoneBox'); - document.vicidial_form.callchannel.value = ''; + document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; document.getElementById("CustomerGoneChanneL").innerHTML = lastcustchannel; if( document.images ) { document.images['livecall'].src = image_livecall_OFF.src;} @@ -8652,56 +8837,61 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } else { - var xmlhttp=false; - /*@cc_on @*/ - /*@if (@_jscript_version >= 5) - // JScript gives us Conditional compilation, we can cope with old IE versions. - // and security blocked creation of the objects. - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } catch (e) { - try { - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } catch (E) { - xmlhttp = false; - } - } - @end @*/ - if (!xmlhttp && typeof XMLHttpRequest!='undefined') + if (alt_dial_status_display==1) { - xmlhttp = new XMLHttpRequest(); + alert("You are in ALT dial mode, you must finish the lead before logging out.\n" + reselect_alt_dial); } - if (xmlhttp) - { - VDlogout_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=userLOGout&format=text&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&agent_log_id=" + agent_log_id + "&no_delete_sessions=" + no_delete_sessions + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages + "&LogouTKicKAlL=" + LogouTKicKAlL + "&ext_context=" + ext_context; - xmlhttp.open('POST', 'vdc_db_query.php'); - xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); - xmlhttp.send(VDlogout_query); - xmlhttp.onreadystatechange = function() - { - if (xmlhttp.readyState == 4 && xmlhttp.status == 200) - { - // alert(xmlhttp.responseText); - } + else + { + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); } - delete xmlhttp; + if (xmlhttp) + { + VDlogout_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=userLOGout&format=text&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&agent_log_id=" + agent_log_id + "&no_delete_sessions=" + no_delete_sessions + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages + "&LogouTKicKAlL=" + LogouTKicKAlL + "&ext_context=" + ext_context; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(VDlogout_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + // alert(xmlhttp.responseText); + } + } + delete xmlhttp; + } + + hideDiv('MainPanel'); + showDiv('LogouTBox'); + var logout_content=''; + if (tempreason=='SHIFT') + {logout_content='Votre Shift est au dessus ou a changé, vous avez été déconnecté de votre session

';} + + document.getElementById("LogouTBoxLink").innerHTML = logout_content + "APPUYER ICI POUR VOUS IDENTIFIER\n"; + + logout_stop_timeouts = 1; + + // window.location= agcPAGE + "?relogin=YES&session_epoch=" + epoch_sec + "&session_id=" + session_id + "&session_name=" + session_name + "&VD_login=" + user + "&VD_campaign=" + campaign + "&phone_login=" + phone_login + "&phone_pass=" + phone_pass + "&VD_pass=" + pass; } - - hideDiv('MainPanel'); - showDiv('LogouTBox'); - var logout_content=''; - if (tempreason=='SHIFT') - {logout_content='Votre Shift est au dessus ou a changé, vous avez été déconnecté de votre session

';} - - document.getElementById("LogouTBoxLink").innerHTML = logout_content + "APPUYER ICI POUR VOUS IDENTIFIER\n"; - - logout_stop_timeouts = 1; - - // window.location= agcPAGE + "?relogin=YES&session_epoch=" + epoch_sec + "&session_id=" + session_id + "&session_name=" + session_name + "&VD_login=" + user + "&VD_campaign=" + campaign + "&phone_login=" + phone_login + "&phone_pass=" + phone_pass + "&VD_pass=" + pass; - } } - } 0) @@ -9429,6 +9619,23 @@ function phone_number_format(formatphone) { } +// ################################################################################ +// Open or close the webphone view sidebar + function webphoneOpen(WVlocation,WVoperation) + { + if (WVoperation=='open') + { + document.getElementById("webphoneLink").innerHTML = "   WebTéléphone View -"; + showDiv(WVlocation); + } + else + { + document.getElementById("webphoneLink").innerHTML = "   WebTéléphone View +"; + hideDiv(WVlocation); + } + } + + // ################################################################################ // Populate the number to dial field with the selected user ID function AgentsXferSelect(AXuser,AXlocation) @@ -9505,6 +9712,104 @@ function phone_number_format(formatphone) { } +// ################################################################################ +// View Customer lead information + function VieWLeaDInfO(VLI_lead_id) + { + showDiv('LeaDInfOBox'); + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=LEADINFOview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&lead_id=" + VLI_lead_id + "&campaign=" + campaign + "&stage="; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(RAview_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + // alert(xmlhttp.responseText); + document.getElementById('LeaDInfOSpan').innerHTML = xmlhttp.responseText + "\n"; + } + } + delete xmlhttp; + } + } + + +// ################################################################################ +// Rafraichir the call log display + function VieWCalLLoG(logdate,formdate) + { + if ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) ) + { + alert("YOU MUST BE PAUSED TO VIEW YOUR APPEL LOG"); + } + else + { + showDiv('CalLLoGDisplaYBox'); + + if (formdate=='form') + {logdate = document.vicidial_form.calllogdate.value;} + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=CALLLOGview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&date=" + logdate + "&campaign=" + campaign + "&stage="; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(RAview_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + // alert(xmlhttp.responseText); + document.getElementById('CallLogSpan').innerHTML = xmlhttp.responseText + "\n"; + } + } + delete xmlhttp; + } + } + } + + // ################################################################################ // Move the Dispo frame out of the way and change the link to maximize function DispoMinimize() @@ -9709,7 +10014,7 @@ else { if (taskaction == 'DiaLAlerT') { - document.getElementById("TimerContentSpan").innerHTML = "DIAL ALERT:

" + taskdialalert + "
"; + document.getElementById("TimerContentSpan").innerHTML = "DIAL ALERT:

" + taskdialalert.replace("\n","
") + "
"; showDiv('TimerSpan'); } @@ -9805,7 +10110,11 @@ else hideDiv('AgentViewSpan'); hideDiv('AgentXferViewSpan'); hideDiv('TimerSpan'); + hideDiv('CalLLoGDisplaYBox'); + hideDiv('LeaDInfOBox'); hideDiv('agentdirectlink'); + if (is_webphone!='Y') + {hideDiv('webphoneSpan');} if (view_calls_in_queue_launch != '1') {hideDiv('callsinqueuedisplay');} if (agentonly_callbacks != '1') @@ -9815,6 +10124,8 @@ else // if ( (agentcall_manual != '1') && (starting_dial_level > 0) ) if (agentcall_manual != '1') {hideDiv('ManuaLDiaLButtons');} + if (agent_call_log_view != '1') + {hideDiv('CallLogButtons');} if (callholdstatus != '1') {hideDiv('AgentStatutCalls');} if (agentcallsstatus != '1') @@ -9831,7 +10142,18 @@ else {document.getElementById("AgentViewLink").innerHTML = "";} if (dispo_check_all_pause == '1') {document.vicidial_form.DispoSelectStop.checked=true;} - + if (agent_xfer_consultative < 1) + {hideDiv('consultative_checkbox');} + if (agent_xfer_dial_override < 1) + {hideDiv('dialoverride_checkbox');} + if (agent_xfer_vm_transfer < 1) + {hideDiv('DialBlindVMail');} + if (agent_xfer_blind_transfer < 1) + {hideDiv('DialBlindTransfer');} + if (agent_xfer_dial_with_customer < 1) + {hideDiv('DialWithCustomer');} + if (agent_xfer_park_customer_dial < 1) + {hideDiv('ParkCustomerDial');} document.vicidial_form.LeadLookuP.checked=true; if ( (agent_pause_codes_active=='Y') || (agent_pause_codes_active=='FORCE') ) @@ -9883,11 +10205,11 @@ else } if ( (VtigeRLogiNScripT == 'Y') && (VtigeREnableD > 0) ) { - document.getElementById("ScriptContents").innerHTML = " "; + document.getElementById("ScriptContents").innerHTML = " "; } if ( (VtigeRLogiNScripT == 'NEW_WINDOW') && (VtigeREnableD > 0) ) { - var VtigeRall = VtigeRurl + "/index.php?module=Users&action=Authenticate&return_module=Users&return_action=Login&user_name=" + user + "&user_password=" + pass + "&login_theme=softed&login_language=en_us"; + var VtigeRall = VtigeRurl + "/index.php?module=Utilisateurs&action=Authenticate&return_module=Utilisateurs&return_action=Ouverture de Session&user_name=" + user + "&user_password=" + pass + "&login_theme=softed&login_language=en_us"; VtigeRwin =window.open(VtigeRall, web_form_target,'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=700,height=480'); @@ -9900,7 +10222,8 @@ else var TEMP_crm_login_address = decoded; TEMP_crm_login_address = TEMP_crm_login_address.replace(regWFAcustom, ''); - CRMwin = window.open(TEMP_crm_login_address, 'CRMwin,toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=700,height=480'); + var CRMwin = 'CRMwin'; + CRMwin = window.open(TEMP_crm_login_address, CRMwin,'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=700,height=480'); CRMwin.blur(); } @@ -9908,6 +10231,17 @@ else { HidEGenDerPulldown(); } + if (is_webphone=='Y') + { + NoneInSession(); + document.getElementById("NoneInSessionLink").innerHTML = "Call Agent Webphone ->"; + + var WebPhonEtarget = 'webphonewindow'; + + // WebPhonEwin =window.open(WebPhonEurl, WebPhonEtarget,'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=180,height=270'); + + // WebPhonEwin.blur(); + } VICIDiaL_closer_login_checked = 1; } else @@ -9953,10 +10287,11 @@ else } } } - if (AgentDispoing==1) + if (AgentDispoing > 0) { WaitingForNextStep=1; check_for_conf_calls(session_id, '0'); + AgentDispoing++; } if (logout_stop_timeouts==1) {WaitingForNextStep=1;} if ( (custchannellive < -30) && (lastcustchannel.length > 3) && (no_empty_session_warnings < 1) ) {CustomerChanneLGone();} @@ -10243,8 +10578,7 @@ else } var customer_local_time = customer_date + " " + customer_time; - document.vicidial_form.custdatetime.value = customer_local_time; - + document.getElementById("custdatetime").innerHTML = customer_local_time; } start_all_refresh(); } @@ -10563,7 +10897,8 @@ else
# APPELBACK DATE/TIMENOMBRENAME STATUTCAMPAIGNLAST APPEL DATE/TIME COMMENTS