diff --git a/agc_2-X/trunk/LANG_www/agc_es/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_es/astguiclient.php index 7dee1758..29fb4907 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_es/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 "web client astGUIclient: Login\n"; + echo "web client astGUIclient: Conexión\n"; echo "\n"; echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/LANG_www/agc_es/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_es/conf_exten_check.php index a4abee40..b8b0b5bd 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_es/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 "Inválido Nombre del usuario/Contraseña: |$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/agc_2-X/trunk/LANG_www/agc_es/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_es/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_es/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/agc_2-X/trunk/LANG_www/agc_es/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_es/vdc_db_query.php index 6860faa1..a9b21ea7 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_es/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,21 @@ # 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 # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-148'; +$build = '100311-1559'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=321; $one_mysql_log=0; require("dbconnect.php"); @@ -419,6 +426,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"); @@ -1810,6 +1819,24 @@ 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); @@ -1866,7 +1893,7 @@ if ($ACTION == 'manDiaLnextCaLL') $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);} + 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)) ) { @@ -1877,7 +1904,7 @@ if ($ACTION == 'manDiaLnextCaLL') $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);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} } } @@ -2231,6 +2258,24 @@ 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);} @@ -2295,7 +2340,7 @@ if ($ACTION == 'manDiaLonly') $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,'00303',$user,$server_ip,$session_name,$one_mysql_log);} + 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)) ) { @@ -2306,7 +2351,7 @@ if ($ACTION == 'manDiaLonly') $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);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} } } @@ -4457,6 +4502,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 +4512,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 +4706,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 +4721,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 +4733,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 +4746,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 +4757,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);} @@ -5576,8 +5658,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 +5871,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 . ' se ha cambiado a ' . $dispo_choice . " Estado\nNext agent_log_id:\n" . $agent_log_id . "\n"; } @@ -6157,7 +6325,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 +6335,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 +6352,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 +6457,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 +6472,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 +6508,12 @@ if ($ACTION == 'AGENTSview') if ($comments=='AgentXferViewSelect') { - echo ""; - if ($agent_status_view_time > 0) - {echo "";} - echo ""; + $AXVSuserORDEN[$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 +6526,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') + { + $AXVSuserORDEN[$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($AXVSuserORDEN); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserORDEN[$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 +6806,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     ESTADO     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     DIAL  
No calls en 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 "
Estado:   $row[0]
VendedorID:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Llamado SInce Último Reset:   $row[4]
Teléfono Code:   $row[5]
Teléfono Number:   $row[6] -         DIAL
Título:   $row[7]
Primero Name:   $row[8]
IM:   $row[9]
Último Name:   $row[10]
Dirección 1:   $row[11]
Dirección 2:   $row[12]
Dirección 3:   $row[13]
Ciudad:   $row[14]
Estado:   $row[15]
Provincia:   $row[16]
Postal Code:   $row[17]
Country:   $row[18]
Género:  $row[19]
Teléfono Alt:   $row[20] -         DIAL
Email:   $row[21]
Demostración:   $row[22]
Comentarios:  $row[23]
Llamado Count:   $row[24]
Último 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 +7021,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 +7051,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; } } diff --git a/agc_2-X/trunk/LANG_www/agc_es/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_es/vdc_script_display.php index 8c9bb87d..81115084 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_es/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';"; diff --git a/agc_2-X/trunk/LANG_www/agc_es/vicidial.php b/agc_2-X/trunk/LANG_www/agc_es/vicidial.php index 7026bea2..588193fe 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_es/vicidial.php @@ -272,14 +272,20 @@ # 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 # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-260'; +$build = '100309-0525'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=64; $one_mysql_log=0; @@ -361,7 +367,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 +386,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 +394,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 en hold count -$agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count - $campagentstatctmax = '3'; # Number of segundos for campaign call and agent stats -$show_campname_pulldown = '1'; # set to 1 to show campaign name en login pulldown -$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL -$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server -$clientDST = '1'; # set to 1 to check for DST en server for agent time -$no_delete_sessions = '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 DIAL link for Dial Presets -$LogiNAJAX = '1'; # set to 1 to do lookups en 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 Colgar al Cliente -$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 DIAL 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 en hold count + $agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count + $campagentstatctmax = '3'; # Number of segundos for campaign call and agent stats + $show_campname_pulldown = '1'; # set to 1 to show campaign name en login pulldown + $webform_sessionname = '1'; # set to 1 to include the session_name in webform URL + $local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server + $clientDST = '1'; # set to 1 to check for DST en server for agent time + $no_delete_sessions = '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 DIAL link for Dial Presets + $LogiNAJAX = '1'; # set to 1 to do lookups en 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 Colgar al Cliente + $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 DIAL 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 +456,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 +671,27 @@ else } if ($relogin == 'YES') -{ -echo "Agent web client: Conexión Otra Vez\n"; -echo "\n"; -echo "\n"; -echo "Timeclock
\n"; -echo "\n"; -echo "\n"; -echo "\n";echo "\n";echo "
English Español
\n"; -echo "
\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "


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

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

Conexión Del Usuario

"; - echo ""; + echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; echo ""; echo "\n"; echo ""; @@ -727,7 +699,7 @@ echo ""; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "
Conexión en la Campaña Conexión Otra Vez
 
Conexión Del Teléfono:
Contraseña Del Teléfono:
Conexión Del Usuario:
Contraseña Del Usuario: Campaña: $camp_form_code
  \n"; - echo "

VERSIÓN: $version       CONSTRUCCION: $build
\n"; echo "\n\n"; @@ -735,19 +707,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: Conexión en la Campaña\n"; echo "\n"; echo "\n"; echo "Timeclock
\n"; @@ -758,15 +723,14 @@ echo "\n"; echo "\n"; echo "\n"; - echo "


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

Conexión Del Usuario

"; + echo "
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; - echo "\n"; - echo ""; - echo "\n"; echo ""; echo "\n"; echo ""; @@ -781,253 +745,1401 @@ echo "
Conexión Conexión en la Campaña
 
Conexión Del Teléfono:
Contraseña Del Teléfono:
Conexión Del Usuario:
Contraseña Del Usuario: \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: Conexión\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


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

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


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

VERSIÓN: $version       CONSTRUCCION: $build
\n"; -echo "\n\n"; -echo "\n\n"; -echo "\n\n"; -exit; -} + { + echo "Agent web client: Conexión Del Teléfono\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


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

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } else -{ -if ($WeBRooTWritablE > 0) - {$fp = fopen ("./vicidial_auth_entries.txt", "a");} -$VDloginDISPLAY=0; + { + if ($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 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 = "USTED DEBE ENTRAR A LA PRIMERA TIMECLOCK
"; - } - } - ### 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[23]; - ### 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 = "ERROR: No hay cambios habilitado para su grupo de usuarios
"; - } - 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 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 ($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;} + + ### 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 = "ERROR: No se le permite acceder fuera de su turno
"; + $VDdisplayMESSAGE = "USTED DEBE ENTRAR A LA PRIMERA TIMECLOCK
"; } } - 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.= "

GERENTE DE TRANSFERENCIA:
\n"; - $VDdisplayMESSAGE.= "
\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "DirectorConexión:
\n"; - $VDdisplayMESSAGE.= "DirectorContraseña:
\n"; - $VDdisplayMESSAGE.= "
\n"; + $shift_ok=0; + if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "ERROR: No hay cambios habilitado para su grupo de usuarios
"; + } + 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 = "ERROR: No se le permite acceder fuera de su turno
"; + } + } + if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) ) + { + $VDdisplayMESSAGE.= "

GERENTE DE TRANSFERENCIA:
\n"; + $VDdisplayMESSAGE.= "
\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "DirectorConexión:
\n"; + $VDdisplayMESSAGE.= "DirectorContraseña:
\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: Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conexión: \n
"; + echo "Contraseña:
\n"; + echo "Campaña: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $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 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]; + + 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 = "La campaña no está activa, intentelo otra vez, por favor
"; } } - ### 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 = "La conexión incorrecta, intentelo otra vez, por favor
"; } - $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: Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

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

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } - $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: Conexión Del Teléfono Error\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


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

VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ### 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 en 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 en phone: $SIP_user a la campaña: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### 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 NUEVO record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user_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 en that campaign for the agent + $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + $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: Conexión en la Campaña\n"; echo "\n"; @@ -1036,7 +2148,33 @@ $VDloginDISPLAY=0; echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; - echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "Lo siento, no hay leads en el hopper de esta campaña\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conexión: \n
"; + echo "Contraseña:
\n"; + echo "Campaña: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Agent web client: Conexión en la Campaña\n"; + echo "\n"; + echo "\n"; + echo "Timeclock
\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "Sorry, there are no available sessions\n"; echo "
\n"; echo "\n"; echo "\n"; @@ -1054,1154 +2192,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 = "La campaña no está activa, intentelo otra vez, por favor
"; - } - } - else - { - if ($WeBRooTWritablE > 0) - { - fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); - fclose($fp); - } - $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "La conexión incorrecta, intentelo otra vez, por favor
"; - } - } - if ($VDloginDISPLAY) - { - echo "Agent web client: Conexión en la Campaña\n"; - echo "\n"; - echo "\n"; - echo "
Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Español
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "

$VDdisplayMESSAGE

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

VERSIÓN: $version       CONSTRUCCION: $build
\n"; - echo "\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - -$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: Conexión Del Teléfono Error\n"; - echo "\n"; - echo "\n"; - echo "Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Español
\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "


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

VERSIÓN: $version       CONSTRUCCION: $build
\n"; - echo "\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } -else - { -### 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 en 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 en phone: $SIP_user a la campaña: $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 NUEVO record to the vicidial_manager table to be processed - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user_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 en that campaign for the agent - $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; - $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: Conexión en la Campaña\n"; - echo "\n"; - echo "\n"; - echo "Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Español
\n"; - echo "Lo siento, no hay leads en el hopper de esta campaña\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "Conexión: \n
"; - echo "Contraseña:
\n"; - echo "Campaña: $camp_form_code
\n"; - echo "   \n"; - echo "\n"; - echo "
\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - if (strlen($session_id) < 1) - { - echo "Agent web client: Conexión en la Campaña\n"; - echo "\n"; - echo "\n"; - echo "Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Español
\n"; - echo "Sorry, there are no available sessions\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "Conexión: \n
"; - echo "Contraseña:
\n"; - echo "Campaña: $camp_form_code
\n"; - echo "   \n"; - echo "\n"; - echo "
\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - - if (ereg('MSIE',$browser)) - { - $useIE=1; - 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 ### @@ -2251,6 +2332,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';} ################################################################ @@ -2538,6 +2621,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 +2832,12 @@ 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 last_uniqueid=''; var DiaLControl_auto_HTML = "\"\"Comienzo\""; var DiaLControl_auto_HTML_ready = "\"\"Comienzo\""; var DiaLControl_auto_HTML_OFF = "\"\"Comienzo\""; @@ -3030,6 +3119,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; @@ -3515,7 +3606,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 = InGroupChangeUsuario; external_igb_set_name = InGroupChangeName; manager_ingroups_set=1; @@ -4289,12 +4380,34 @@ 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; if (CBcounT == 0) {var CBprint = "NO";} - else {var CBprint = CBcounT;} - document.getElementById("CBstatusSpan").innerHTML ="" + CBprint + " SERVICIOS REPETIDOS ACTIVOS"; - + 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 + '' + " SERVICIOS REPETIDOS ACTIVOS" + CBpost + ""; } } delete xmlhttp; @@ -4415,7 +4528,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 +4542,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 = "Grupo de Alias: " + active_group_alias + ""; @@ -4658,6 +4778,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} custchannellive=1; document.vicidial_form.uniqueid.value = MDlookResponse_array[0]; + last_uniqueid = MDlookResponse_array[0]; document.vicidial_form.callchannel.value = MDlookResponse_array[1]; lastcustchannel = MDlookResponse_array[1]; if( document.images ) { document.images['livecall'].src = image_livecall_ON.src;} @@ -5901,7 +6022,7 @@ 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); @@ -6316,7 +6437,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) @@ -6434,6 +6555,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.vicidial_form.lead_id.value = VDIC_data_VDAC[0]; document.vicidial_form.uniqueid.value = VDIC_data_VDAC[1]; + last_uniqueid = VDIC_data_VDAC[1]; CIDcheck = VDIC_data_VDAC[2]; CalLCID = VDIC_data_VDAC[2]; document.vicidial_form.callchannel.value = VDIC_data_VDAC[3]; @@ -7968,7 +8090,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=" + last_uniqueid + "&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); @@ -9429,6 +9551,23 @@ function phone_number_format(formatphone) { } +// ################################################################################ +// Open or close the webphone view sidebar + function webphoneOpen(WVlocation,WVoperation) + { + if (WVoperation=='open') + { + document.getElementById("webphoneLink").innerHTML = "   WebTeléfono View -"; + showDiv(WVlocation); + } + else + { + document.getElementById("webphoneLink").innerHTML = "   WebTeléfono View +"; + hideDiv(WVlocation); + } + } + + // ################################################################################ // Populate the number to dial field with the selected user ID function AgentsXferSelect(AXuser,AXlocation) @@ -9505,6 +9644,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; + } + } + + +// ################################################################################ +// Recarga 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 LLAMADA 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() @@ -9805,7 +10042,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 +10056,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('AgentEstadoCalls');} if (agentcallsstatus != '1') @@ -9883,11 +10126,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=es_es"; + var VtigeRall = VtigeRurl + "/index.php?module=Usuarios&action=Authenticate&return_module=Usuarios&return_action=Conexión&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 +10143,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 +10152,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 @@ -10563,6 +10818,7 @@ else