diff --git a/LANG_www/agc_it/conf_exten_check.php b/LANG_www/agc_it/conf_exten_check.php index 0324f54f..80ead1e4 100644 --- a/LANG_www/agc_it/conf_exten_check.php +++ b/LANG_www/agc_it/conf_exten_check.php @@ -38,8 +38,16 @@ # 80424-0442 - Added non_latin lookup from system_settings # 80519-1425 - Added calls-in-queue tally # 80703-1106 - Added API functionality for Hangup and Dispo +# 81104-0229 - Added mysql error logging capability +# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries # +$version = '2.0.4-15'; +$build = '81104-1409'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=14; +$one_mysql_log=0; + require("dbconnect.php"); ### If you have globals turned off uncomment these lines @@ -75,6 +83,7 @@ header ("Pragma: no-cache"); // HTTP/1.0 ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -102,8 +111,6 @@ $Alogin='N'; $RingCalls='N'; $DiaLCalls='N'; -$version = '2.0.4-12'; -$build = '71122-0205'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -116,6 +123,7 @@ $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' a if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -137,6 +145,7 @@ $auth=$row[0]; $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $SNauth=$row[0]; if($SNauth==0) @@ -185,6 +194,7 @@ echo " $stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $Acount=$row[0]; @@ -193,6 +203,7 @@ echo " $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $Astatus=$row[0]; } @@ -209,6 +220,16 @@ echo " $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 5) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } if ($campagentstdisp == 'YES') { @@ -216,6 +237,7 @@ echo " $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $Alogin=$row[0]; $Acampaign=$row[1]; @@ -227,6 +249,7 @@ echo " $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $RingCalls=$row[0]; if ($RingCalls > 0) {$RingCalls = "Calls in Queue: $RingCalls";} @@ -236,6 +259,7 @@ echo " $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $DiaLCalls=$row[0]; @@ -257,13 +281,23 @@ echo " $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 5) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } } ### grab the API hangup and API dispo fields in vicidial_live_agents $stmt="SELECT external_hangup,external_status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $external_hangup = $row[0]; $external_status = $row[1]; @@ -279,6 +313,7 @@ echo " $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$sip_list = mysql_num_rows($rslt);} # echo "$sip_list|"; $loop_count=0; @@ -292,6 +327,7 @@ echo " $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$channels_list = mysql_num_rows($rslt);} # echo "$channels_list|"; $loop_count=0; @@ -334,6 +370,7 @@ echo " $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } echo "Conferenza $conf_exten e` stato registrato su $exten\n"; } @@ -350,4 +387,26 @@ if ($format=='debug') exit; + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) +{ +$NOW_TIME = date("Y-m-d H:i:s"); +# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); +$errno=''; $error=''; +if ( ($mel > 0) or ($one_mysql_log > 0) ) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +$one_mysql_log=0; +return $errno; +} + ?> diff --git a/LANG_www/agc_it/manager_send.php b/LANG_www/agc_it/manager_send.php index 6dd29828..f1a879f5 100644 --- a/LANG_www/agc_it/manager_send.php +++ b/LANG_www/agc_it/manager_send.php @@ -77,8 +77,15 @@ # 80915-1755 - Rewrote leave-3way functions for external calling # 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call # 81020-1459 - Fixed bugs in queue_log logging +# 81104-0203 - Added mysql error logging capability # +$version = '2.0.5-35'; +$build = '81104-0203'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=82; +$one_mysql_log=0; + require("dbconnect.php"); ### These are variable assignments for PHP globals off @@ -161,6 +168,7 @@ header ("Pragma: no-cache"); // HTTP/1.0 ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -185,8 +193,6 @@ if (!isset($ACTION)) {$ACTION="Originate";} if (!isset($format)) {$format="alert";} if (!isset($ext_priority)) {$ext_priority="1";} -$version = '2.0.5-34'; -$build = '81020-1459'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -197,6 +203,7 @@ $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' a if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02002',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -218,6 +225,7 @@ $auth=$row[0]; $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02003',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $SNauth=$row[0]; if($SNauth==0) @@ -267,6 +275,7 @@ if ($ACTION=="SysCIDOriginate") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02004',$user,$server_ip,$session_name,$one_mysql_log);} echo "Originate comando inviato per Exten $exten Canale $channel su $server_ip\n"; } } @@ -294,6 +303,7 @@ if ($ACTION=="OriginateName") $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02005',$user,$server_ip,$session_name,$one_mysql_log);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -323,6 +333,7 @@ if ($ACTION=="OriginateNameVmail") $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02006',$user,$server_ip,$session_name,$one_mysql_log);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -363,6 +374,7 @@ if ($ACTION=="Originate") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02007',$user,$server_ip,$session_name,$one_mysql_log);} echo "Originate comando inviato per Exten $exten Canale $channel su $server_ip\n"; } } @@ -390,12 +402,14 @@ if ($ACTION=="HangupConfDial") $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02008',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row > 0) { $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02009',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); $channel=$rowx[0]; $ACTION="Hangup"; @@ -414,6 +428,7 @@ if ($ACTION=="Hangup") $stmt="UPDATE vicidial_live_agents SET external_hangup='0' where user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02010',$user,$server_ip,$session_name,$one_mysql_log);} $row=''; $rowx=''; $channel_live=1; @@ -447,6 +462,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02011',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -455,6 +471,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02012',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { @@ -474,6 +491,7 @@ $rslt=mysql_query($stmt, $link); { $stmt="SELECT count(*) FROM vicidial_auto_calls where callerid='$CalLCID';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02013',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($format=='debug') {echo "\n";} if ($rowx[0] > 0) @@ -482,6 +500,7 @@ $rslt=mysql_query($stmt, $link); ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -505,6 +524,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='CONNECT';"; $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02015',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_cn_ct = mysql_num_rows($rslt); if ($VAC_cn_ct > 0) { @@ -517,6 +537,7 @@ $rslt=mysql_query($stmt, $link); ### grab call lead information needed for QM logging $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where callerid='$CalLCID' order by call_time limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02016',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -539,6 +560,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='COMPLETECALLER' and queue='$CLcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02017',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_cc_ct = mysql_num_rows($rslt); if ($VAC_cc_ct > 0) { @@ -552,6 +574,7 @@ $rslt=mysql_query($stmt, $link); $time_id=0; $stmt="SELECT time_id from queue_log where call_id='$CalLCID' and verb='ENTERQUEUE' and queue='$CLcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02018',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_eq_ct = mysql_num_rows($rslt); if ($VAC_eq_ct > 0) { @@ -565,6 +588,7 @@ $rslt=mysql_query($stmt, $link); if ($format=='debug') {echo "\n";} $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='1',serverid='$queuemetrics_log_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); if ($format=='debug') {echo "\n";} } @@ -576,6 +600,7 @@ $rslt=mysql_query($stmt, $link); $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02020',$user,$server_ip,$session_name,$one_mysql_log);} echo "Hangup comando inviato per Canale $channel su $call_server_ip\n"; } } @@ -610,24 +635,28 @@ if ($ACTION=="RedirectVD") $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02021',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) { $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02022',$user,$server_ip,$session_name,$one_mysql_log);} } if ($auto_dial_level < 1) { $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02023',$user,$server_ip,$session_name,$one_mysql_log);} } else { $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02024',$user,$server_ip,$session_name,$one_mysql_log);} } $ACTION="Redirect"; } @@ -654,6 +683,7 @@ if ($ACTION=="RedirectToPark") $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);} $ACTION="Redirect"; } } @@ -677,6 +707,7 @@ if ($ACTION=="RedirectFromPark") $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);} $ACTION="Redirect"; } } @@ -699,6 +730,7 @@ if ($ACTION=="RedirectName") $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02027',$user,$server_ip,$session_name,$one_mysql_log);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -728,6 +760,7 @@ if ($ACTION=="RedirectNameVmail") $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02028',$user,$server_ip,$session_name,$one_mysql_log);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -778,16 +811,19 @@ if ($ACTION=="RedirectXtraCXNeW") $stmtA="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'02029',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0] > 1) { $stmtB="UPDATE vicidial_conferences set extension='$protocol/$extension$NOWnum', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtB, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtB,'02030',$user,$server_ip,$session_name,$one_mysql_log);} $stmtC="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and extension='$protocol/$extension$NOWnum' and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtC, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtC,'02031',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $exten = $row[0]; @@ -799,25 +835,30 @@ if ($ACTION=="RedirectXtraCXNeW") $stmtD="UPDATE vicidial_conferences set extension='$protocol/$extension' where server_ip='$server_ip' and conf_exten='$exten' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtD, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtD,'02032',$user,$server_ip,$session_name,$one_mysql_log);} $stmtE="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime='$NOW_TIME', extension='3WAY_$user' where server_ip='$server_ip' and conf_exten='$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtE, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtE,'02033',$user,$server_ip,$session_name,$one_mysql_log);} $queryCID = "CXAR24$NOWnum"; $stmtF="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $agentchannel','Context: $ext_context','Exten: $exten','Priority: 1','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtF, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtF,'02034',$user,$server_ip,$session_name,$one_mysql_log);} $stmtG="UPDATE vicidial_live_agents set conf_exten='$exten' where server_ip='$server_ip' and user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtG, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtG,'02035',$user,$server_ip,$session_name,$one_mysql_log);} if ($auto_dial_level < 1) { $stmtH = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and callerid LIKE \"M%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtH, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtH,'02036',$user,$server_ip,$session_name,$one_mysql_log);} } // $fp = fopen ("./vicidial_debug_3way.txt", "a"); @@ -842,12 +883,14 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02037',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02038',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -859,12 +902,14 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02039',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02040',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -878,6 +923,7 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02041',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0] < 1) { @@ -890,6 +936,7 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02042',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); $dest_server_ip = $rowx[0]; $dest_session_id = $rowx[1]; @@ -910,10 +957,12 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02043',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02044',$user,$server_ip,$session_name,$one_mysql_log);} echo "RedirectXtraCX comando inviato per Canale $channel su $call_server_ip and \nHungup $extrachannel su $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel su $call_server_ip, Hungup $extrachannel su $server_ip";} @@ -989,41 +1038,49 @@ if ($ACTION=="RedirectXtraNeW") $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02045',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0] > 1) { $stmt="UPDATE vicidial_conferences set extension='$protocol/$extension$NOWnum', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02046',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and extension='$protocol/$extension$NOWnum' and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02047',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $exten = $row[0]; $stmt="UPDATE vicidial_conferences set extension='$protocol/$extension' where server_ip='$server_ip' and conf_exten='$exten' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02048',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime='$NOW_TIME', extension='3WAY_$user' where server_ip='$server_ip' and conf_exten='$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02049',$user,$server_ip,$session_name,$one_mysql_log);} $queryCID = "CXAR23$NOWnum"; $stmtB="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $agentchannel','Context: $ext_context','Exten: $exten','Priority: 1','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtB, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02050',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="UPDATE vicidial_live_agents set conf_exten='$exten' where server_ip='$server_ip' and user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02051',$user,$server_ip,$session_name,$one_mysql_log);} if ($auto_dial_level < 1) { $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and callerid LIKE \"M%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02052',$user,$server_ip,$session_name,$one_mysql_log);} } echo "NeWSessioN|$exten|\n"; @@ -1044,12 +1101,14 @@ if ($ACTION=="RedirectXtraNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02054',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1061,12 +1120,14 @@ if ($ACTION=="RedirectXtraNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02056',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1082,6 +1143,7 @@ if ($ACTION=="RedirectXtraNeW") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02057',$user,$server_ip,$session_name,$one_mysql_log);} echo "RedirectXtra comando inviato per Canale $channel and \nExtraCanale $extrachannel\n to $exten su $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten su $server_ip";} @@ -1103,10 +1165,12 @@ if ($ACTION=="RedirectXtraNeW") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02058',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02059',$user,$server_ip,$session_name,$one_mysql_log);} echo "RedirectXtra comando inviato per Canale $channel su $call_server_ip and \nExtraCanale $extrachannel\n to $exten su $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} @@ -1443,12 +1507,14 @@ if ($ACTION=="Redirect") $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02060',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row > 0) { $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02061',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); $channel=$rowx[0]; $channel = eregi_replace("1$","2",$channel); @@ -1475,12 +1541,14 @@ if ($ACTION=="Redirect") $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02062',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02063',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1493,6 +1561,7 @@ if ($ACTION=="Redirect") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02064',$user,$server_ip,$session_name,$one_mysql_log);} echo "Redirect comando inviato per Canale $channel su $server_ip\n"; } @@ -1523,12 +1592,14 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02065',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02066',$user,$server_ip,$session_name,$one_mysql_log);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1541,15 +1612,18 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02067',$user,$server_ip,$session_name,$one_mysql_log);} if ($ACTION=="Monitor") { $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02068',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02069',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $recording_id = $row[0]; @@ -1558,6 +1632,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) { $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02070',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $rec_count = mysql_num_rows($rslt); if ($rec_count>0) @@ -1572,6 +1647,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02071',$user,$server_ip,$session_name,$one_mysql_log);} } } @@ -1609,10 +1685,12 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02072',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02073',$user,$server_ip,$session_name,$one_mysql_log);} $RLaffected_rows = mysql_affected_rows($link); if ($RLaffected_rows > 0) { @@ -1625,6 +1703,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $VLA_inOUT='NONE'; $stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02074',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLA_inOUT_ct = mysql_num_rows($rslt); if ($VLA_inOUT_ct > 0) @@ -1645,6 +1724,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="SELECT uniqueid FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; } $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02075',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1655,6 +1735,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt = "UPDATE recording_log SET vicidial_id='$VDvicidial_id' where recording_id='$recording_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02076',$user,$server_ip,$session_name,$one_mysql_log);} } } } @@ -1669,6 +1750,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) ### find the value to put in the vicidial_id field if this was an inbound call $stmt="SELECT closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02077',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -1684,6 +1766,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02078',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $rec_count = mysql_num_rows($rslt); if ($rec_count>0) @@ -1698,12 +1781,14 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' $uniqueidSQL where filename='$filename'"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02079',$user,$server_ip,$session_name,$one_mysql_log);} } # find and hang up all recordings going su in this conference # and extension = '$exten' $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02080',$user,$server_ip,$session_name,$one_mysql_log);} # $rec_count = intval(mysql_num_rows($rslt) / 2); $rec_count = mysql_num_rows($rslt); $h=0; @@ -1719,6 +1804,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02081',$user,$server_ip,$session_name,$one_mysql_log);} $i++; } @@ -1754,6 +1840,7 @@ if ($ACTION=="VolumeControl") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02082',$user,$server_ip,$session_name,$one_mysql_log);} echo "Volume comando inviato per Conferenza $exten, Stage $stage Canale $channel su $server_ip\n"; } } @@ -1776,9 +1863,26 @@ if ($format=='debug') {echo "\n\n\n";} exit; + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) +{ +$NOW_TIME = date("Y-m-d H:i:s"); +# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); +$errno=''; $error=''; +if ( ($mel > 0) or ($one_mysql_log > 0) ) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|manager_send|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +$one_mysql_log=0; +return $errno; +} + ?> - - - - - diff --git a/LANG_www/agc_it/vdc_db_query.php b/LANG_www/agc_it/vdc_db_query.php index cb1215b1..cac592ae 100644 --- a/LANG_www/agc_it/vdc_db_query.php +++ b/LANG_www/agc_it/vdc_db_query.php @@ -167,10 +167,16 @@ # 81010-1048 - Added support for hangup of all channels except for agent channel after attempting a 3way call # 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call # 81020-1459 - Fixed bugs in queue_log logging +# 81104-0134 - Added mysql error logging capability +# 81104-1617 - Added multi-retry for some vicidial_live_agents table MySQL queries +# 81106-0410 - Added force_timeclock_login option to LoginCampaigns function # -$version = '2.0.5-85'; -$build = '81020-1459'; +$version = '2.0.5-88'; +$build = '81106-0410'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=180; +$one_mysql_log=0; require("dbconnect.php"); @@ -326,17 +332,28 @@ header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 +$txt = '.txt'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +$MT[0]=''; +$agents='@agents'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; while ($i < $qm_conf_ct) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; + $non_latin = $row[0]; + $timeclock_end_of_day = $row[1]; $i++; } ##### END SETTINGS LOOKUP ##### @@ -355,16 +372,7 @@ $phone_number = ereg_replace("[^0-9]","",$phone_number); if (!isset($format)) {$format="text";} if ($format == 'debug') {$DB=1;} if (!isset($ACTION)) {$ACTION="refresh";} - -$txt = '.txt'; -$StarTtime = date("U"); -$NOW_DATE = date("Y-m-d"); -$NOW_TIME = date("Y-m-d H:i:s"); -$CIDdate = date("mdHis"); -$ENTRYdate = date("YmdHis"); if (!isset($query_date)) {$query_date = $NOW_DATE;} -$MT[0]=''; -$agents='@agents'; if ($ACTION == 'LogiNCamPaigns') { @@ -376,6 +384,7 @@ else if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00002',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -396,6 +405,7 @@ else $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00003',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $SNauth=$row[0]; if($SNauth==0) @@ -431,49 +441,93 @@ echo " if ($ACTION == 'LogiNCamPaigns') { if ( (strlen($user)<1) ) - { - echo "\n"; - exit; - } + { + echo "\n"; + exit; + } else - { - echo "\n"; + echo "\n"; + + $o=0; + while ($camps_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + echo "\n"; + } + else + { + echo "\n"; + } + exit; } - echo "\n"; - exit; - } } @@ -498,6 +552,7 @@ if ($ACTION == 'regCLOSER') { $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00007',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $closer_choice =$row[0]; @@ -505,25 +560,30 @@ if ($ACTION == 'regCLOSER') $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00008',$user,$server_ip,$session_name,$one_mysql_log);} } else { $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00009',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00010',$user,$server_ip,$session_name,$one_mysql_log);} } $stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$campaign',event_date='$NOW_TIME',blended='$closer_blended',closer_campaigns='$closer_choice';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00011',$user,$server_ip,$session_name,$one_mysql_log);} $stmt="DELETE FROM vicidial_live_inbound_agents where user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00012',$user,$server_ip,$session_name,$one_mysql_log);} $in_groups_pre = preg_replace('/-$/','',$closer_choice); $in_groups = explode(" ",$in_groups_pre); @@ -535,6 +595,7 @@ if ($ACTION == 'regCLOSER') { $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00013',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $viga_ct = mysql_num_rows($rslt); if ($viga_ct > 0) @@ -551,6 +612,7 @@ if ($ACTION == 'regCLOSER') $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00014',$user,$server_ip,$session_name,$one_mysql_log);} } $k++; } @@ -583,6 +645,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00015',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vla_cc_ct = mysql_num_rows($rslt); if ($vla_cc_ct > 0) @@ -603,6 +666,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00016',$user,$server_ip,$session_name,$one_mysql_log);} } else { @@ -612,6 +676,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00017',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -622,6 +687,7 @@ if ($ACTION == 'manDiaLnextCaLL') } $stmt="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00018',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -635,6 +701,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign'"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00019',$user,$server_ip,$session_name,$one_mysql_log);} $lists_to_parse = mysql_num_rows($rslt); $camp_lists=''; $o=0; @@ -649,6 +716,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt="SELECT count(*) FROM vicidial_list where phone_number='$phone_number' and list_id IN($camp_lists);"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00020',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -662,6 +730,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00021',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $man_leadID_ct = mysql_num_rows($rslt); if ($man_leadID_ct > 0) @@ -677,6 +746,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00022',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); $CBleadIDset=1; @@ -688,6 +758,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00023',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); $CBleadIDset=1; @@ -699,6 +770,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by priority desc,hopper_id LIMIT 1"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00024',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); } } @@ -710,6 +782,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### grab the lead_id of the reserved user in vicidial_hopper $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00025',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $hopper_leadID_ct = mysql_num_rows($rslt); if ($hopper_leadID_ct > 0) @@ -722,6 +795,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### grab the data from vicidial_list for the lead_id $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00026',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $list_lead_ct = mysql_num_rows($rslt); if ($list_lead_ct > 0) @@ -763,6 +837,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### check if system is set to generate logfile for transfers $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00027',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $enable_agc_xfer_log_ct = mysql_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) @@ -795,6 +870,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00028',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $cb_record_ct = mysql_num_rows($rslt); if ($cb_record_ct > 0) @@ -809,6 +885,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00029',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $server_ct = mysql_num_rows($rslt); if ($server_ct > 0) @@ -831,6 +908,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='$called_since_last_reset', called_count='$called_count',user='$user',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00030',$user,$server_ip,$session_name,$one_mysql_log);} if (!$CBleadIDset) { @@ -838,11 +916,13 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00031',$user,$server_ip,$session_name,$one_mysql_log);} } $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00032',$user,$server_ip,$session_name,$one_mysql_log);} ### if preview dialing, do not send the call if ( (strlen($preview)<1) || ($preview == 'NO') ) @@ -879,25 +959,30 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00033',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00034',$user,$server_ip,$session_name,$one_mysql_log);} ### update the agent status to INCALL in vicidial_live_agents $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00035',$user,$server_ip,$session_name,$one_mysql_log);} ### update calls_today count in vicidial_campaign_agents $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00036',$user,$server_ip,$session_name,$one_mysql_log);} ############################################# ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00037',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -923,18 +1008,21 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',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,'00038',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # ENTERQUEUE $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',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,'00039',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',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,'00040',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -1013,6 +1101,7 @@ if ($ACTION == 'alt_phone_change') $stmt = "UPDATE vicidial_list_alt_phones set active='$stage' where lead_id='$lead_id' and phone_number='$phone_number' and alt_phone_count='$called_count';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00041',$user,$server_ip,$session_name,$one_mysql_log);} echo "NUMERO ALTERNATIVO NUMERO STATO CHANGED\n"; } @@ -1042,6 +1131,7 @@ if ($ACTION == 'manDiaLskip') $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00042',$user,$server_ip,$session_name,$one_mysql_log);} echo "LEAD REVERTED\n"; @@ -1070,6 +1160,7 @@ if ($ACTION == 'manDiaLonly') ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00043',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vla_cc_ct = mysql_num_rows($rslt); if ($vla_cc_ct > 0) @@ -1112,19 +1203,32 @@ if ($ACTION == 'manDiaLonly') $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00044',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00045',$user,$server_ip,$session_name,$one_mysql_log);} ### update the agent status to INCALL in vicidial_live_agents $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00046',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9046$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00047',$user,$server_ip,$session_name,$one_mysql_log);} echo "$MqueryCID\n"; @@ -1132,6 +1236,7 @@ if ($ACTION == 'manDiaLonly') ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00048',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -1157,18 +1262,21 @@ if ($ACTION == 'manDiaLonly') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',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,'00049',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # ENTERQUEUE $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',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,'00050',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',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,'00051',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -1197,6 +1305,7 @@ else ##### look for the channel in the UPDATED vicidial_manager record of the call initiation $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00052',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1210,6 +1319,7 @@ else $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00053',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -1219,6 +1329,12 @@ else $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00054',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_auto_calls set uniqueid='$uniqueid',channel='$channel' where callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00055',$user,$server_ip,$session_name,$one_mysql_log);} } else { @@ -1253,6 +1369,7 @@ if ($stage == "start") $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,'00056',$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) @@ -1264,6 +1381,7 @@ if ($stage == "start") $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group,alt_dial) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group','$alt_dial');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00057',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) @@ -1279,6 +1397,7 @@ if ($stage == "start") $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00058',$user,$server_ip,$session_name,$one_mysql_log);} # ##### insert log into call_log for manual VICIDiaL call # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; @@ -1303,6 +1422,7 @@ if ($stage == "end") $VLA_inOUT='NONE'; $stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00059',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLA_inOUT_ct = mysql_num_rows($rslt); if ($VLA_inOUT_ct > 0) @@ -1344,6 +1464,7 @@ if ($stage == "end") $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00060',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1369,6 +1490,7 @@ if ($stage == "end") ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log $stmt="SELECT start_epoch,term_reason,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00061',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1396,6 +1518,7 @@ if ($stage == "end") $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00062',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -1413,6 +1536,7 @@ if ($stage == "end") ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00063',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -1440,6 +1564,7 @@ if ($stage == "end") ### check to see if campaign has alt_dial enabled $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00064',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VAC_mancall_ct = mysql_num_rows($rslt); if ($VAC_mancall_ct > 0) @@ -1458,6 +1583,7 @@ if ($stage == "end") $alt_dial_skip=0; $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00065',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VAC_mancall_ct = mysql_num_rows($rslt); if ($VAC_mancall_ct > 0) @@ -1475,6 +1601,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$alt_phone';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00066',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_dnc_ct = mysql_num_rows($rslt); if ($VLAP_dnc_ct > 0) @@ -1488,6 +1615,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$alt_phone' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00067',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_cdnc_ct = mysql_num_rows($rslt); if ($VLAP_cdnc_ct > 0) @@ -1502,6 +1630,7 @@ if ($stage == "end") $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00068',$user,$server_ip,$session_name,$one_mysql_log);} } else {$alt_dial_skip=1;} @@ -1517,6 +1646,7 @@ if ($stage == "end") $addr3_dial_skip=0; $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00069',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VAC_mancall_ct = mysql_num_rows($rslt); if ($VAC_mancall_ct > 0) @@ -1534,6 +1664,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$address3';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00070',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_dnc_ct = mysql_num_rows($rslt); if ($VLAP_dnc_ct > 0) @@ -1547,6 +1678,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$address3' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00071',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_cdnc_ct = mysql_num_rows($rslt); if ($VLAP_cdnc_ct > 0) @@ -1561,6 +1693,7 @@ if ($stage == "end") $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00072',$user,$server_ip,$session_name,$one_mysql_log);} } else {$addr3_dial_skip=1;} @@ -1586,6 +1719,7 @@ if ($stage == "end") $stmt="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00073',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VL_deailts_ct = mysql_num_rows($rslt); if ($VL_deailts_ct > 0) @@ -1598,6 +1732,7 @@ if ($stage == "end") $alt_dial_phones_count=0; $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00074',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_ct = mysql_num_rows($rslt); if ($VLAP_ct > 0) @@ -1610,6 +1745,7 @@ if ($stage == "end") $Xlast++; $stmt="SELECT alt_phone_id,phone_number,active FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Xlast';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00075',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_detail_ct = mysql_num_rows($rslt); if ($VLAP_detail_ct > 0) @@ -1628,6 +1764,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_altdial_phone';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00076',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_dnc_ct = mysql_num_rows($rslt); if ($VLAP_dnc_ct > 0) @@ -1641,6 +1778,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_altdial_phone' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00077',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VLAP_cdnc_ct = mysql_num_rows($rslt); if ($VLAP_cdnc_ct > 0) @@ -1656,6 +1794,7 @@ if ($stage == "end") $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$EA_list_id',gmt_offset_now='$EA_gmt_offset_now',state='$EA_state',alt_dial='X$Xlast',user='',priority='15';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00078',$user,$server_ip,$session_name,$one_mysql_log);} $Xlast=9999999999; } } @@ -1668,6 +1807,7 @@ if ($stage == "end") ### grab call lead information needed for QM logging $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id' order by call_time limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00079',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) @@ -1690,6 +1830,7 @@ if ($stage == "end") $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER' and queue='$VDcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00080',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VAC_cc_ct = mysql_num_rows($rslt); if ($VAC_cc_ct > 0) @@ -1713,10 +1854,22 @@ if ($stage == "end") $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$VDcampaign_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00081',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00082',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9082$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -1725,6 +1878,7 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00083',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); } } @@ -1736,6 +1890,7 @@ if ($stage == "end") ### check to see if lead should be alt_dialed $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id' order by call_time desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00084',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) @@ -1759,17 +1914,30 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',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,'00085',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); } - # $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';"; - $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$VDcampaign_id' and callerid LIKE \"M%\";"; + # $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';"; + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$VDcampaign_id' and callerid LIKE \"M%\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00086',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00087',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9087$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -1778,6 +1946,7 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00088',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); } } @@ -1792,6 +1961,7 @@ if ($stage == "end") ### check to see if lead should be alt_dialed $stmt="SELECT term_reason,uniqueid from vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00089',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -1814,6 +1984,7 @@ if ($stage == "end") $stmt="UPDATE vicidial_log set $SQLterm end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00090',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) @@ -1835,6 +2006,7 @@ if ($stage == "end") ### check to see if lead should be alt_dialed $stmt="SELECT term_reason,closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00091',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -1854,16 +2026,21 @@ if ($stage == "end") } } - ##### update the duration and end time in the vicidial_log table - $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $affected_rows = mysql_affected_rows($link); + if (strlen($SQLterm) > 0) + { + ##### update the duration and end time in the vicidial_log table + $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00092',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + } if ( (strlen($QL_term) > 0) and ($leaving_threeway > 0) ) { $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETEAGENT' and queue='$VDcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00093',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $VAC_cc_ct = mysql_num_rows($rslt); if ($VAC_cc_ct > 0) @@ -1876,6 +2053,7 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',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,'00094',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); } } @@ -1897,6 +2075,7 @@ if ($stage == "end") $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00095',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$rec_list = mysql_num_rows($rslt);} while ($rec_list>$loop_count) { @@ -1934,6 +2113,7 @@ if ($stage == "end") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00096',$user,$server_ip,$session_name,$one_mysql_log);} } $loop_count++; } @@ -1945,6 +2125,7 @@ if ($stage == "end") $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00097',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$recFN_list = mysql_num_rows($rslt);} while ($recFN_list>$loop_count) { @@ -1963,6 +2144,7 @@ if ($stage == "end") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00098',$user,$server_ip,$session_name,$one_mysql_log);} echo "REC_ARRESTO|$rec_channels[$loop_count]|$filename[$loop_count]|"; if (strlen($filename)>2) @@ -1970,6 +2152,7 @@ if ($stage == "end") $stmt="SELECT recording_id,start_epoch,vicidial_id,lead_id FROM recording_log where filename='$filename[$loop_count]'"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00099',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$fn_count = mysql_num_rows($rslt);} if ($fn_count) { @@ -2002,6 +2185,7 @@ if ($stage == "end") $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' $vidSQL $lidSQL where filename='$filename[$loop_count]' and end_epoch is NULL;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00100',$user,$server_ip,$session_name,$one_mysql_log);} echo "$recording_id|$length_in_min|"; @@ -2024,6 +2208,7 @@ if ($stage == "end") $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00101',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -2033,6 +2218,7 @@ if ($stage == "end") $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00102',$user,$server_ip,$session_name,$one_mysql_log);} } } @@ -2061,6 +2247,7 @@ if ($ACTION == 'VDADREcheckINCOMING') $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00103',$user,$server_ip,$session_name,$one_mysql_log);} $queue_leadID_ct = mysql_num_rows($rslt); if ($queue_leadID_ct > 0) @@ -2110,6 +2297,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip,comments FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00104',$user,$server_ip,$session_name,$one_mysql_log);} $queue_leadID_ct = mysql_num_rows($rslt); if ($queue_leadID_ct > 0) @@ -2128,6 +2316,7 @@ if ($ACTION == 'VDADcheckINCOMING') ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00105',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vla_cc_ct = mysql_num_rows($rslt); if ($vla_cc_ct > 0) @@ -2143,14 +2332,26 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00106',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9106$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00107',$user,$server_ip,$session_name,$one_mysql_log);} ##### grab the data from vicidial_list for the lead_id $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00108',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $list_lead_ct = mysql_num_rows($rslt); if ($list_lead_ct > 0) @@ -2195,6 +2396,7 @@ if ($ACTION == 'VDADcheckINCOMING') { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00109',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $cb_record_ct = mysql_num_rows($rslt); if ($cb_record_ct > 0) @@ -2211,11 +2413,13 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00110',$user,$server_ip,$session_name,$one_mysql_log);} ### update the log status to INCALL $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$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) @@ -2228,6 +2432,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '$callerid' 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,'00112',$user,$server_ip,$session_name,$one_mysql_log);} $VDAC_cid_ct = mysql_num_rows($rslt); if ($VDAC_cid_ct > 0) { @@ -2252,10 +2457,12 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00113',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00114',$user,$server_ip,$session_name,$one_mysql_log);} $VDIG_cid_ct = mysql_num_rows($rslt); if ($VDIG_cid_ct > 0) { @@ -2272,6 +2479,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00115',$user,$server_ip,$session_name,$one_mysql_log);} $VDAC_cid_ct = mysql_num_rows($rslt); if ($VDAC_cid_ct > 0) { @@ -2293,6 +2501,7 @@ if ($ACTION == 'VDADcheckINCOMING') if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00116',$user,$server_ip,$session_name,$one_mysql_log);} $VLAP_ct = mysql_num_rows($rslt); if ($VLAP_ct > 0) { @@ -2311,10 +2520,12 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00117',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00118',$user,$server_ip,$session_name,$one_mysql_log);} $VDL_cid_ct = mysql_num_rows($rslt); if ($VDL_cid_ct > 0) { @@ -2325,6 +2536,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename from vicidial_inbound_groups where group_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00119',$user,$server_ip,$session_name,$one_mysql_log);} $VDIG_cid_ct = mysql_num_rows($rslt); if ($VDIG_cid_ct > 0) { @@ -2343,10 +2555,32 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_ingroup_recording_override = $row[11]; $VDCL_ingroup_rec_filename = $row[12]; + + $stmt = "select campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00181',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidOR_ct = mysql_num_rows($rslt); + if ($VDIG_cidOR_ct > 0) + { + $row=mysql_fetch_row($rslt); + if ( ( (ereg('NONE',$VDCL_ingroup_script)) and (strlen($VDCL_ingroup_script) < 5) ) or (strlen($VDCL_ingroup_script) < 1) ) + {$VDCL_ingroup_script = $row[0];} + if (strlen($VDCL_xferconf_a_dtmf) < 1) + {$VDCL_xferconf_a_dtmf = $row[1];} + if (strlen($VDCL_xferconf_a_number) < 1) + {$VDCL_xferconf_a_number = $row[2];} + if (strlen($VDCL_xferconf_b_dtmf) < 1) + {$VDCL_xferconf_b_dtmf = $row[3];} + if (strlen($VDCL_xferconf_b_number) < 1) + {$VDCL_xferconf_b_number = $row[4];} + } + ### update the comments in vicidial_live_agents record $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00120',$user,$server_ip,$session_name,$one_mysql_log);} $Ctype = 'I'; } @@ -2355,6 +2589,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00121',$user,$server_ip,$session_name,$one_mysql_log);} $VDIG_cid_ct = mysql_num_rows($rslt); if ($VDIG_cid_ct > 0) { @@ -2370,11 +2605,12 @@ if ($ACTION == 'VDADcheckINCOMING') ### if web form is set then send su to vicidial.php for override of WEB_FORM address if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|\n";} - else {echo "|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|\n";} + else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|\n";} $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00122',$user,$server_ip,$session_name,$one_mysql_log);} $VDU_cid_ct = mysql_num_rows($rslt); if ($VDU_cid_ct > 0) { @@ -2438,6 +2674,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00123',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -2447,6 +2684,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00124',$user,$server_ip,$session_name,$one_mysql_log);} ### If CHIAMATABK, change vicidial_callback record to INACTIVE if (eregi("CALLBK|CBHOLD", $dispo)) @@ -2454,11 +2692,13 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00125',$user,$server_ip,$session_name,$one_mysql_log);} } ##### check if system is set to generate logfile for transfers $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00126',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $enable_agc_xfer_log_ct = mysql_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) @@ -2506,6 +2746,7 @@ else $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,'00127',$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) @@ -2517,6 +2758,7 @@ else $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00128',$user,$server_ip,$session_name,$one_mysql_log);} $vul_insert = mysql_affected_rows($link); if ($no_delete_sessions < 1) @@ -2525,6 +2767,7 @@ else $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00129',$user,$server_ip,$session_name,$one_mysql_log);} $vc_remove = mysql_affected_rows($link); } @@ -2532,24 +2775,37 @@ else $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00130',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9130$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } $vla_delete = mysql_affected_rows($link); ##### Delete the vicidial_live_inbound_agents records for this session $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00131',$user,$server_ip,$session_name,$one_mysql_log);} $vlia_delete = mysql_affected_rows($link); ##### Delete the web_client_sessions $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00132',$user,$server_ip,$session_name,$one_mysql_log);} $wcs_delete = mysql_affected_rows($link); ##### Hangup the client phone $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00133',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) { $row=mysql_fetch_row($rslt); @@ -2558,6 +2814,7 @@ else $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00134',$user,$server_ip,$session_name,$one_mysql_log);} } if ($LogouTKicKAlL > 0) @@ -2570,12 +2827,14 @@ else $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $kick_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00135',$user,$server_ip,$session_name,$one_mysql_log);} } $pause_sec=0; $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00136',$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)) ) { @@ -2585,6 +2844,7 @@ else $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,'00137',$user,$server_ip,$session_name,$one_mysql_log);} } if ($vla_delete > 0) @@ -2593,6 +2853,7 @@ else ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; $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";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2629,6 +2890,7 @@ else $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' 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";} echo "$stmt\n"; $li_conf_ct = mysql_num_rows($rslt); @@ -2646,6 +2908,7 @@ else $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';"; 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);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -2673,29 +2936,43 @@ if ($ACTION == 'updateDISPO') else { ### update the comments in vicidial_live_agents record - $stmt = "UPDATE vicidial_live_agents set lead_id='',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00141',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9141$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "select count(*) from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00143',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) { $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00144',$user,$server_ip,$session_name,$one_mysql_log);} } else { $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00145',$user,$server_ip,$session_name,$one_mysql_log);} } if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) @@ -2703,9 +2980,11 @@ if ($ACTION == 'updateDISPO') $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00147',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} } if ( ($use_campaign_dnc=='Y') and ($dispo_choice=='DNC') ) @@ -2713,9 +2992,11 @@ if ($ACTION == 'updateDISPO') $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $stmt="INSERT INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00149',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} } } @@ -2725,6 +3006,7 @@ if ($ACTION == 'updateDISPO') $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00150',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -2734,10 +3016,12 @@ if ($ACTION == 'updateDISPO') $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00151',$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,'00152',$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) @@ -2749,19 +3033,25 @@ if ($ACTION == 'updateDISPO') $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00153',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); $agent_log_id = mysql_insert_id($link); ### CHIAMATABACK ENTRY if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) { + $comments = eregi_replace("'",'',$comments); + $comments = eregi_replace("\\",' ',$comments); + $comments = eregi_replace(';','',$comments); $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00154',$user,$server_ip,$session_name,$one_mysql_log);} } $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) @@ -2769,6 +3059,7 @@ if ($ACTION == 'updateDISPO') $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00156',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) @@ -2776,6 +3067,7 @@ if ($ACTION == 'updateDISPO') $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00157',$user,$server_ip,$session_name,$one_mysql_log);} } } else @@ -2783,12 +3075,14 @@ if ($ACTION == 'updateDISPO') $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00158',$user,$server_ip,$session_name,$one_mysql_log);} } ############################################# ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00159',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2816,6 +3110,7 @@ if ($ACTION == 'updateDISPO') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',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,'00160',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -2844,6 +3139,7 @@ if ($ACTION == 'updateLEAD') $stmt = "SELECT disable_alter_custdata,disable_alter_custphone FROM vicidial_campaigns where campaign_id='$campaign'"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00161',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $dac_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2867,6 +3163,7 @@ if ($ACTION == 'updateLEAD') } $stmt = "SELECT alter_custdata_override,alter_custphone_override FROM vicidial_users where user='$user'"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00162',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $aco_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2903,12 +3200,23 @@ if ($ACTION == 'updateLEAD') $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' $phoneSQL where lead_id='$lead_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00163',$user,$server_ip,$session_name,$one_mysql_log);} } $random = (rand(1000000, 9999999) + 10000000); $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00164',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9164$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } } echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; @@ -2934,10 +3242,30 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt="UPDATE vicidial_live_agents set uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00165',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9165$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00166',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9166$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -2945,6 +3273,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00167',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2971,6 +3300,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00168',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -2985,6 +3315,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -3005,12 +3336,14 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00170',$user,$server_ip,$session_name,$one_mysql_log);} } if ($ACTION == 'VDADpause') { $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00171',$user,$server_ip,$session_name,$one_mysql_log);} } } } @@ -3035,6 +3368,7 @@ if ($ACTION == 'UpdatEFavoritEs') $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00172',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) @@ -3042,12 +3376,14 @@ if ($ACTION == 'UpdatEFavoritEs') $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00173',$user,$server_ip,$session_name,$one_mysql_log);} } else { $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00174',$user,$server_ip,$session_name,$one_mysql_log);} } } echo "Favorites list has been updated to $favorites_list for $exten\n"; @@ -3057,7 +3393,7 @@ if ($ACTION == 'UpdatEFavoritEs') ################################################################################ ### PauseCodeSubmit - Update vicidial_agent_log with pause code ################################################################################ -if ($ACTION == 'PausaCodeSubmit') +if ($ACTION == 'PauseCodeSubmit') { $row=''; $rowx=''; if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) @@ -3070,6 +3406,7 @@ if ($ACTION == 'PausaCodeSubmit') $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00175',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -3077,6 +3414,7 @@ if ($ACTION == 'PausaCodeSubmit') ##### INIZIO QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00176',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -3107,13 +3445,14 @@ if ($ACTION == 'PausaCodeSubmit') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00177',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); } } } -echo "Pausa Code has been updated to $status for $agent_log_id\n"; +echo " Pausa Code has been updated to $status for $agent_log_id\n"; } @@ -3125,6 +3464,7 @@ if ($ACTION == 'CalLBacKLisT') $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} echo "$callbacks_count\n"; $loop_count=0; @@ -3146,6 +3486,7 @@ $loop_count=0; $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; @@ -3163,6 +3504,7 @@ if ($ACTION == 'CalLBacKCounT') $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; @@ -3182,4 +3524,29 @@ echo "\n\n\n"; exit; + + + + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) +{ +$NOW_TIME = date("Y-m-d H:i:s"); +# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); +$errno=''; $error=''; +if ( ($mel > 0) or ($one_mysql_log > 0) ) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|vdc_db_query|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +$one_mysql_log=0; +return $errno; +} + ?> diff --git a/LANG_www/agc_it/vicidial.php b/LANG_www/agc_it/vicidial.php index 843a77c4..c40d665a 100644 --- a/LANG_www/agc_it/vicidial.php +++ b/LANG_www/agc_it/vicidial.php @@ -200,10 +200,18 @@ # 81016-0703 - Changed leave 3way to allow function at any time transfer-conf is available # 81020-1501 - Fixed bugs in queue_log logging # 81023-0411 - Added compatibility for dial-in agents using AGI, bug fixes +# 81030-0403 - Added option to force Pause Codes on PAUSE +# 81103-1427 - Added 3way call dial prefix +# 81104-0140 - Added mysql error logging capability +# 81104-1618 - Changed MySQL queries logging +# 81106-0411 - Changedthe campaign login list behaviour # -$version = '2.0.5-179'; -$build = '81023-0411'; +$version = '2.0.5-184'; +$build = '81106-0411'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=51; +$one_mysql_log=0; require("dbconnect.php"); @@ -277,6 +285,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 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";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -396,11 +405,13 @@ if ($relogin == 'YES') $stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass'"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01002',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $VU_user_group=$row[0]; $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,'01003',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if ( (!eregi("ALL-CAMPAIGNS",$row[0])) ) { @@ -413,6 +424,7 @@ if ($relogin == 'YES') $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01004',$VD_login,$server_ip,$session_name,$one_mysql_log);} $camps_to_print = mysql_num_rows($rslt); $o=0; @@ -428,10 +440,16 @@ while ($camps_to_print > $o) if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) {$camp_form_code .= "\n";} else - {$camp_form_code .= "\n";} + { + if (!ereg('login_allowable_campaigns',$camp_form_code)) + {$camp_form_code .= "\n";} + } } else - {$camp_form_code .= "\n";} + { + if (!ereg('login_allowable_campaigns',$camp_form_code)) + {$camp_form_code .= "\n";} + } $o++; } $camp_form_code .= "\n"; @@ -524,8 +542,9 @@ echo "Password Utente: "; echo "\n"; echo "Campagna: "; -echo "$camp_form_code\n"; -echo "\n"; +echo "$camp_form_code\n"; +echo "   \n"; +echo "\n"; echo "
VERSIONE: $version       BUILD: $build\n"; echo "\n"; echo "\n\n"; @@ -577,6 +596,7 @@ echo " 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]; @@ -662,6 +682,7 @@ $VDloginDISPLAY=0; $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + 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]; @@ -672,6 +693,7 @@ $VDloginDISPLAY=0; ##### 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 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,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $LOGfullname=$row[0]; $user_level=$row[1]; @@ -698,6 +720,7 @@ $VDloginDISPLAY=0; $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]; @@ -730,6 +753,7 @@ 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) @@ -741,6 +765,7 @@ echo " 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; @@ -755,8 +780,9 @@ echo " 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; @@ -777,6 +803,7 @@ echo " 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; @@ -805,8 +832,9 @@ echo " 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]; @@ -849,6 +877,7 @@ echo " 0) ) { @@ -861,6 +890,8 @@ echo " 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; @@ -907,6 +939,7 @@ echo " 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; @@ -930,6 +963,7 @@ echo " 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; @@ -948,6 +982,7 @@ echo " 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]; @@ -1013,6 +1048,7 @@ echo " 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) { @@ -1023,6 +1059,7 @@ 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) { @@ -1054,6 +1091,7 @@ $authphone=0; $stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; 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) @@ -1105,27 +1143,28 @@ else 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";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'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';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'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";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'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]| "; @@ -1147,6 +1186,7 @@ else $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + 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]; @@ -1217,16 +1257,16 @@ else { $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01026',$VD_login,$server_ip,$session_name,$one_mysql_log);} } } if ($TelefonoSComPIP == '2') { $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01027',$VD_login,$server_ip,$session_name,$one_mysql_log);} } if ($clientDST) { @@ -1247,6 +1287,7 @@ else $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]; @@ -1300,10 +1341,12 @@ else $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') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) { @@ -1311,10 +1354,12 @@ else $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; @@ -1332,16 +1377,19 @@ else $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='$user') );"; 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]; } @@ -1352,24 +1400,28 @@ else $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); print "\n"; $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + 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); print "\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); print "\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); print "\n"; @@ -1383,6 +1435,7 @@ else ##### INIZIO SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; $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); $i=0; @@ -1414,6 +1467,7 @@ else $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','','','','','');"; 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); print "\n"; @@ -1424,6 +1478,7 @@ else ##### grab the campaign_weight and number of calls today su that campaign for the agent $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; $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) @@ -1440,6 +1495,7 @@ else $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); print "\n"; } @@ -1447,6 +1503,7 @@ else $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; if ($DB) {echo "$stmt\n";} $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); print "\n"; @@ -1458,12 +1515,14 @@ else $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); print "\n"; $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $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); print "\n"; @@ -1484,6 +1543,7 @@ else $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; if ($DB) {echo "$stmt\n";} $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); print "\n"; @@ -1495,12 +1555,14 @@ else $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); print "\n"; $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $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); print "\n"; @@ -1575,6 +1637,7 @@ echo " 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); print "\n"; @@ -1594,6 +1657,7 @@ echo " 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; @@ -1885,6 +1949,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var starting_dial_level = ''; var dial_timeout = ''; var dial_prefix = ''; + var three_way_dial_prefix = ''; var campaign_cid = ''; var campaign_vdad_exten = ''; var campaign_leads_to_call = ''; @@ -1996,7 +2061,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var CBuser = ''; var CBcomments = ''; var volumecontrol_active = ''; - var PausaCode_HTML = ''; + var PauseCode_HTML = ''; var manual_auto_hotkey = 0; var dialed_number = ''; var dialed_label = ''; @@ -2029,9 +2094,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var conf_dialed = 0; var leaving_threeway = 0; var dial_method = ''; - var DiaLControl_auto_HTML = "\"Pausa\"\"Riprendi\""; - var DiaLControl_auto_HTML_ready = "\"Pausa\"\"Riprendi\""; - var DiaLControl_auto_HTML_OFF = "\"Pausa\"\"Riprendi\""; + var DiaLControl_auto_HTML = "\"\"Riprendi\""; + var DiaLControl_auto_HTML_ready = "\"\"Riprendi\""; + var DiaLControl_auto_HTML_OFF = "\"\"Riprendi\""; var DiaLControl_manual_HTML = "\"Chiama"; var image_blank = new Image(); image_blank.src="../agc/images/blank.gif"; @@ -2260,8 +2325,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (document.vicidial_form.xferoverride.checked==false) { - if (dial_prefix == 'X') {var temp_dial_prefix = '';} - else {var temp_dial_prefix = dial_prefix;} + if (three_way_dial_prefix == 'X') {var temp_dial_prefix = '';} + else {var temp_dial_prefix = three_way_dial_prefix;} if (omit_phone_code == 'Y') {var temp_phone_code = '';} else {var temp_phone_code = document.vicidial_form.phone_code.value;} @@ -2882,8 +2947,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (document.vicidial_form.xferoverride.checked==false) { - if (dial_prefix == 'X') {var temp_dial_prefix = '';} - else {var temp_dial_prefix = dial_prefix;} + if (three_way_dial_prefix == 'X') {var temp_dial_prefix = '';} + else {var temp_dial_prefix = three_way_dial_prefix;} if (omit_phone_code == 'Y') {var temp_phone_code = '';} else {var temp_phone_code = document.vicidial_form.phone_code.value;} @@ -3148,7 +3213,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - manDiaLlog_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLlogCaLL&stage=" + taskMDstage + "&uniqueid=" + document.vicidial_form.uniqueid.value + + manDiaLlog_query = "format=text&server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLlogCaLL&stage=" + taskMDstage + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&lead_id=" + document.vicidial_form.lead_id.value + "&list_id=" + document.vicidial_form.list_id.value + @@ -3164,7 +3229,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var MDlogResponse = null; - // alert(xmlhttp.responseText); + // alert(xmlhttp.responseText); MDlogResponse = xmlhttp.responseText; var MDlogResponse_array=MDlogResponse.split("\n"); MDlogLINE = MDlogResponse_array[0]; @@ -3628,7 +3693,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} AutoDial_ReSume_PauSe('VDADpause'); - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -3714,7 +3779,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -3928,7 +3993,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -4017,7 +4082,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -4199,7 +4264,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -4215,12 +4280,17 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML; } + + if (agent_pause_codes_active=='FORCE') + { + PauseCodeSelectContent_create(); + } } var xmlhttp=false; @@ -4601,7 +4671,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -5070,7 +5140,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.getElementById("MainStatuSSpan").innerHTML = ''; if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -5086,7 +5156,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { @@ -5348,22 +5418,28 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } else { - showDiv('PausaCodeSelectBox'); + showDiv('PauseCodeSelectBox'); WaitingForNextStep=1; - PausaCode_HTML = ''; - document.vicidial_form.PausaCodeSelection.value = ''; + PauseCode_HTML = ''; + document.vicidial_form.PauseCodeSelection.value = ''; var VD_pause_codes_ct_half = parseInt(VD_pause_codes_ct / 2); - PausaCode_HTML = "
PAUSE CODE
"; + PauseCode_HTML = "
PAUSE CODE
"; var loop_ct = 0; while (loop_ct < VD_pause_codes_ct) { - PausaCode_HTML = PausaCode_HTML + "" + VARpause_codes[loop_ct] + " - " + VARpause_code_names[loop_ct] + "

"; + PauseCode_HTML = PauseCode_HTML + "" + VARpause_codes[loop_ct] + " - " + VARpause_code_names[loop_ct] + "

"; loop_ct++; if (loop_ct == VD_pause_codes_ct_half) - {PausaCode_HTML = PausaCode_HTML + "
";} + {PauseCode_HTML = PauseCode_HTML + "";} } - PausaCode_HTML = PausaCode_HTML + "


Torna Indietro"; - document.getElementById("PausaCodeSelectContent").innerHTML = PausaCode_HTML; + + if (agent_pause_codes_active=='FORCE') + {var Go_BacK_LinK = '';} + else + {var Go_BacK_LinK = "Torna Indietro";} + + PauseCode_HTML = PauseCode_HTML + "


" + Go_BacK_LinK; + document.getElementById("PauseCodeSelectContent").innerHTML = PauseCode_HTML; } } @@ -5565,7 +5641,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // Submit the Pausa Code function PauseCodeSelect_submit(newpausecode) { - hideDiv('PausaCodeSelectBox'); + hideDiv('PauseCodeSelectBox'); WaitingForNextStep=0; var xmlhttp=false; @@ -5589,7 +5665,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - VMCpausecode_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=PausaCodeSubmit&format=text&status=" + newpausecode + "&agent_log_id=" + agent_log_id + "&campaign=" + campaign + "&extension=" + extension + "&protocol=" + protocol + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages; + VMCpausecode_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=PauseCodeSubmit&format=text&status=" + newpausecode + "&agent_log_id=" + agent_log_id + "&campaign=" + campaign + "&extension=" + extension + "&protocol=" + protocol + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(VMCpausecode_query); @@ -6569,7 +6645,7 @@ else hideDiv('DispoButtonHideC'); hideDiv('CallBacKsLisTBox'); hideDiv('NeWManuaLDiaLBox'); - hideDiv('PausaCodeSelectBox'); + hideDiv('PauseCodeSelectBox'); if (agentonly_callbacks != '1') {hideDiv('CallbacksButtons');} // if ( (agentcall_manual != '1') && (starting_dial_level > 0) ) @@ -6590,9 +6666,9 @@ else document.vicidial_form.LeadLookuP.checked=true; - if (agent_pause_codes_active=='Y') + if ( (agent_pause_codes_active=='Y') || (agent_pause_codes_active=='FORCE') ) { - document.getElementById("PausaCodeLinkSpan").innerHTML = "INSERIRE UN CODICE PAUSA"; + document.getElementById("PauseCodeLinkSpan").innerHTML = "INSERIRE UN CODICE PAUSA"; } if (VICIDiaL_allow_closers < 1) { @@ -7174,7 +7250,7 @@ else { if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"Pausa\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; if (manual_dial_preview == 1) {buildDiv('DiaLLeaDPrevieW');} } @@ -7273,8 +7349,8 @@ echo "\n"; X CHIAMATABACK ATTIVE
- -
+ +
secondi: @@ -7516,10 +7592,10 @@ Il tuo stato:
Calls Dialing: + height=460>
SELEZIONARE UN CODICE PAUSA:
- Pausa Code Selection - + Pausa Code Selection +

 
@@ -7760,6 +7836,26 @@ else exit; +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) +{ +$NOW_TIME = date("Y-m-d H:i:s"); +# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); +$errno=''; $error=''; +if ( ($mel > 0) or ($one_mysql_log > 0) ) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +$one_mysql_log=0; +return $errno; +} ?> diff --git a/LANG_www/vicidial_it/AST_CLOSERstats.php b/LANG_www/vicidial_it/AST_CLOSERstats.php index fecaa02b..c0b685bb 100644 --- a/LANG_www/vicidial_it/AST_CLOSERstats.php +++ b/LANG_www/vicidial_it/AST_CLOSERstats.php @@ -16,6 +16,7 @@ # 80722-2149 - Added Status Category stats # 81015-0705 - Added IVR calls count # 81024-0037 - Added multi-select inbound-groups +# 81105-2118 - Added Answered calls 15-minute breakdown # require("dbconnect.php"); @@ -104,6 +105,7 @@ while($i < $group_ct) { $group_string .= "$group[$i]|"; $group_SQL .= "'$group[$i]',"; + $groupQS .= "&group[]=$group[$i]"; $i++; } if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) ) @@ -177,7 +179,11 @@ echo "\n"; echo "\n"; -echo "           MODIFICA | REPORT \n"; +echo "           "; +echo "MODIFICA | "; +echo "REPORT | "; +echo "IVR REPORT \n"; +echo "\n"; echo "\n"; echo "\n"; @@ -301,6 +307,11 @@ $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); +$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE');"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$rowy=mysql_fetch_row($rslt); + $stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) and comment_b='START';"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -317,9 +328,28 @@ else $average_call_seconds = round($average_call_seconds, 0); $average_call_seconds = sprintf("%10s", $average_call_seconds); } +$ANSWEREDcalls = sprintf("%10s", $rowy[0]); +if ( ($ANSWEREDcalls < 1) or ($TOTALcalls < 1) ) + {$ANSWEREDpercent = '0';} +else + { + $ANSWEREDpercent = (($ANSWEREDcalls / $TOTALcalls) * 100); + $ANSWEREDpercent = round($ANSWEREDpercent, 0); + } +if ( ($rowy[0] < 1) or ($ANSWEREDcalls < 1) ) + {$average_answer_seconds = ' 0';} +else + { + $average_answer_seconds = ($rowy[1] / $rowy[0]); + $average_answer_seconds = round($average_answer_seconds, 2); + $average_answer_seconds = sprintf("%10s", $average_answer_seconds); + } + echo "Llamadas totales tomadas in to this In-Gruppo: $TOTALcalls\n"; echo "Average Call Length for all Calls: $average_call_seconds seconds\n"; +echo "Answered Calls: $ANSWEREDcalls $ANSWEREDpercent%\n"; +echo "Average queue time for Answered Calls: $average_answer_seconds seconds\n"; echo "Calls taken into the IVR for this In-Gruppo: $IVRcalls\n"; echo "\n"; @@ -349,8 +379,15 @@ else $average_hold_seconds = round($average_hold_seconds, 0); $average_hold_seconds = sprintf("%10s", $average_hold_seconds); } +if ( ($ANSWEREDcalls < 1) or ($DROPcalls < 1) ) + {$DROP_ANSWEREDpercent = '0';} +else + { + $DROP_ANSWEREDpercent = (($DROPcalls / $ANSWEREDcalls) * 100); + $DROP_ANSWEREDpercent = round($DROP_ANSWEREDpercent, 0); + } -echo "Totale Chiamate ABBATTUTE: $DROPcalls $DROPpercent%\n"; +echo "Totale Chiamate ABBATTUTE: $DROPcalls $DROPpercent% drop/answered: $DROP_ANSWEREDpercent%\n"; echo "Average hold time for DROP Calls: $average_hold_seconds seconds\n"; @@ -435,7 +472,7 @@ echo "Average QUEUE Length across all calls: $average_total_queue_seconds ############################## -######### CALL HOLD TIME BREAKDONW IN SECONDS +######### CALL HOLD TIME BREAKDOWN IN SECONDS $TOTALcalls = 0; @@ -497,6 +534,278 @@ echo "+------------------------------------------------------------------------- +############################## +######### CALL DROP TIME BREAKDOWN IN SECONDS + +$BDdropCALLS = 0; + +echo "\n"; +echo "---------- CALL DROP TIME BREAKDOWN IN SECONDS\n"; +echo "+-------------------------------------------------------------------------------------------+------------+\n"; +echo "| 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; +echo "+-------------------------------------------------------------------------------------------+------------+\n"; + +$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$reasons_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $reasons_to_print) + { + $row=mysql_fetch_row($rslt); + + $BDdropCALLS = ($BDdropCALLS + $row[0]); + + if ($row[1] == 0) {$dd_0 = ($dd_0 + $row[0]);} + if ( ($row[1] > 0) and ($row{1} <= 5) ) {$dd_5 = ($dd_5 + $row[0]);} + if ( ($row[1] > 5) and ($row{1} <= 10) ) {$dd10 = ($dd10 + $row[0]);} + if ( ($row[1] > 10) and ($row{1} <= 15) ) {$dd15 = ($dd15 + $row[0]);} + if ( ($row[1] > 15) and ($row{1} <= 20) ) {$dd20 = ($dd20 + $row[0]);} + if ( ($row[1] > 20) and ($row{1} <= 25) ) {$dd25 = ($dd25 + $row[0]);} + if ( ($row[1] > 25) and ($row{1} <= 30) ) {$dd30 = ($dd30 + $row[0]);} + if ( ($row[1] > 30) and ($row{1} <= 35) ) {$dd35 = ($dd35 + $row[0]);} + if ( ($row[1] > 35) and ($row{1} <= 40) ) {$dd40 = ($dd40 + $row[0]);} + if ( ($row[1] > 40) and ($row{1} <= 45) ) {$dd45 = ($dd45 + $row[0]);} + if ( ($row[1] > 45) and ($row{1} <= 50) ) {$dd50 = ($dd50 + $row[0]);} + if ( ($row[1] > 50) and ($row{1} <= 55) ) {$dd55 = ($dd55 + $row[0]);} + if ( ($row[1] > 55) and ($row{1} <= 60) ) {$dd60 = ($dd60 + $row[0]);} + if ( ($row[1] > 60) and ($row{1} <= 90) ) {$dd90 = ($dd90 + $row[0]);} + if ($row[1] > 90) {$dd99 = ($dd99 + $row[0]);} + $i++; + } + +$dd_0 = sprintf("%5s", $dd_0); +$dd_5 = sprintf("%5s", $dd_5); +$dd10 = sprintf("%5s", $dd10); +$dd15 = sprintf("%5s", $dd15); +$dd20 = sprintf("%5s", $dd20); +$dd25 = sprintf("%5s", $dd25); +$dd30 = sprintf("%5s", $dd30); +$dd35 = sprintf("%5s", $dd35); +$dd40 = sprintf("%5s", $dd40); +$dd45 = sprintf("%5s", $dd45); +$dd50 = sprintf("%5s", $dd50); +$dd55 = sprintf("%5s", $dd55); +$dd60 = sprintf("%5s", $dd60); +$dd90 = sprintf("%5s", $dd90); +$dd99 = sprintf("%5s", $dd99); + +$BDdropCALLS = sprintf("%10s", $BDdropCALLS); + +echo "| $dd_0 $dd_5 $dd10 $dd15 $dd20 $dd25 $dd30 $dd35 $dd40 $dd45 $dd50 $dd55 $dd60 $dd90 $dd99 | $BDdropCALLS |\n"; +echo "+-------------------------------------------------------------------------------------------+------------+\n"; + + + + +############################## +######### CALL ANSWERED TIME AND PERCENT BREAKDOWN IN SECONDS + +$BDansweredCALLS = 0; + +echo "\n"; +echo " CALL ANSWERED TIME AND PERCENT BREAKDOWN IN SECONDS\n"; +echo " +-------------------------------------------------------------------------------------------+------------+\n"; +echo " | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; +echo "----------+-------------------------------------------------------------------------------------------+------------+\n"; + +$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE') group by queue_seconds;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$reasons_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $reasons_to_print) + { + $row=mysql_fetch_row($rslt); + + $BDansweredCALLS = ($BDansweredCALLS + $row[0]); + + ### Get interval totals + if ($row[1] == 0) {$ad_0 = ($ad_0 + $row[0]);} + if ( ($row[1] > 0) and ($row{1} <= 5) ) {$ad_5 = ($ad_5 + $row[0]);} + if ( ($row[1] > 5) and ($row{1} <= 10) ) {$ad10 = ($ad10 + $row[0]);} + if ( ($row[1] > 10) and ($row{1} <= 15) ) {$ad15 = ($ad15 + $row[0]);} + if ( ($row[1] > 15) and ($row{1} <= 20) ) {$ad20 = ($ad20 + $row[0]);} + if ( ($row[1] > 20) and ($row{1} <= 25) ) {$ad25 = ($ad25 + $row[0]);} + if ( ($row[1] > 25) and ($row{1} <= 30) ) {$ad30 = ($ad30 + $row[0]);} + if ( ($row[1] > 30) and ($row{1} <= 35) ) {$ad35 = ($ad35 + $row[0]);} + if ( ($row[1] > 35) and ($row{1} <= 40) ) {$ad40 = ($ad40 + $row[0]);} + if ( ($row[1] > 40) and ($row{1} <= 45) ) {$ad45 = ($ad45 + $row[0]);} + if ( ($row[1] > 45) and ($row{1} <= 50) ) {$ad50 = ($ad50 + $row[0]);} + if ( ($row[1] > 50) and ($row{1} <= 55) ) {$ad55 = ($ad55 + $row[0]);} + if ( ($row[1] > 55) and ($row{1} <= 60) ) {$ad60 = ($ad60 + $row[0]);} + if ( ($row[1] > 60) and ($row{1} <= 90) ) {$ad90 = ($ad90 + $row[0]);} + if ($row[1] > 90) {$ad99 = ($ad99 + $row[0]);} + $i++; + } + +### Calculate cumulative totals +$Cad_0 =$ad_0; +$Cad_5 =($Cad_0 + $ad_5); +$Cad10 =($Cad_5 + $ad10); +$Cad15 =($Cad10 + $ad15); +$Cad20 =($Cad15 + $ad20); +$Cad25 =($Cad20 + $ad25); +$Cad30 =($Cad25 + $ad30); +$Cad35 =($Cad30 + $ad35); +$Cad40 =($Cad35 + $ad40); +$Cad45 =($Cad40 + $ad45); +$Cad50 =($Cad45 + $ad50); +$Cad55 =($Cad50 + $ad55); +$Cad60 =($Cad55 + $ad60); +$Cad90 =($Cad60 + $ad90); +$Cad99 =($Cad90 + $ad99); + +### Calculate interval percentages +$pad_0=0; $pad_5=0; $pad10=0; $pad15=0; $pad20=0; $pad25=0; $pad30=0; $pad35=0; $pad40=0; $pad45=0; $pad50=0; $pad55=0; $pad60=0; $pad90=0; $pad99=0; +$pCad_0=0; $pCad_5=0; $pCad10=0; $pCad15=0; $pCad20=0; $pCad25=0; $pCad30=0; $pCad35=0; $pCad40=0; $pCad45=0; $pCad50=0; $pCad55=0; $pCad60=0; $pCad90=0; $pCad99=0; +if ( ($BDansweredCALLS > 0) and ($TOTALcalls > 0) ) + { + if ($ad_0 > 0) {$pad_0 = (($ad_0 / $TOTALcalls) * 100); $pad_0 = round($pad_0, 0);} + if ($ad_5 > 0) {$pad_5 = (($ad_5 / $TOTALcalls) * 100); $pad_5 = round($pad_5, 0);} + if ($ad10 > 0) {$pad10 = (($ad10 / $TOTALcalls) * 100); $pad10 = round($pad10, 0);} + if ($ad15 > 0) {$pad15 = (($ad15 / $TOTALcalls) * 100); $pad15 = round($pad15, 0);} + if ($ad20 > 0) {$pad20 = (($ad20 / $TOTALcalls) * 100); $pad20 = round($pad20, 0);} + if ($ad25 > 0) {$pad25 = (($ad25 / $TOTALcalls) * 100); $pad25 = round($pad25, 0);} + if ($ad30 > 0) {$pad30 = (($ad30 / $TOTALcalls) * 100); $pad30 = round($pad30, 0);} + if ($ad35 > 0) {$pad35 = (($ad35 / $TOTALcalls) * 100); $pad35 = round($pad35, 0);} + if ($ad40 > 0) {$pad40 = (($ad40 / $TOTALcalls) * 100); $pad40 = round($pad40, 0);} + if ($ad45 > 0) {$pad45 = (($ad45 / $TOTALcalls) * 100); $pad45 = round($pad45, 0);} + if ($ad50 > 0) {$pad50 = (($ad50 / $TOTALcalls) * 100); $pad50 = round($pad50, 0);} + if ($ad55 > 0) {$pad55 = (($ad55 / $TOTALcalls) * 100); $pad55 = round($pad55, 0);} + if ($ad60 > 0) {$pad60 = (($ad60 / $TOTALcalls) * 100); $pad60 = round($pad60, 0);} + if ($ad90 > 0) {$pad90 = (($ad90 / $TOTALcalls) * 100); $pad90 = round($pad90, 0);} + if ($ad99 > 0) {$pad99 = (($ad99 / $TOTALcalls) * 100); $pad99 = round($pad99, 0);} + + if ($Cad_0 > 0) {$pCad_0 = (($Cad_0 / $TOTALcalls) * 100); $pCad_0 = round($pCad_0, 0);} + if ($Cad_5 > 0) {$pCad_5 = (($Cad_5 / $TOTALcalls) * 100); $pCad_5 = round($pCad_5, 0);} + if ($Cad10 > 0) {$pCad10 = (($Cad10 / $TOTALcalls) * 100); $pCad10 = round($pCad10, 0);} + if ($Cad15 > 0) {$pCad15 = (($Cad15 / $TOTALcalls) * 100); $pCad15 = round($pCad15, 0);} + if ($Cad20 > 0) {$pCad20 = (($Cad20 / $TOTALcalls) * 100); $pCad20 = round($pCad20, 0);} + if ($Cad25 > 0) {$pCad25 = (($Cad25 / $TOTALcalls) * 100); $pCad25 = round($pCad25, 0);} + if ($Cad30 > 0) {$pCad30 = (($Cad30 / $TOTALcalls) * 100); $pCad30 = round($pCad30, 0);} + if ($Cad35 > 0) {$pCad35 = (($Cad35 / $TOTALcalls) * 100); $pCad35 = round($pCad35, 0);} + if ($Cad40 > 0) {$pCad40 = (($Cad40 / $TOTALcalls) * 100); $pCad40 = round($pCad40, 0);} + if ($Cad45 > 0) {$pCad45 = (($Cad45 / $TOTALcalls) * 100); $pCad45 = round($pCad45, 0);} + if ($Cad50 > 0) {$pCad50 = (($Cad50 / $TOTALcalls) * 100); $pCad50 = round($pCad50, 0);} + if ($Cad55 > 0) {$pCad55 = (($Cad55 / $TOTALcalls) * 100); $pCad55 = round($pCad55, 0);} + if ($Cad60 > 0) {$pCad60 = (($Cad60 / $TOTALcalls) * 100); $pCad60 = round($pCad60, 0);} + if ($Cad90 > 0) {$pCad90 = (($Cad90 / $TOTALcalls) * 100); $pCad90 = round($pCad90, 0);} + if ($Cad99 > 0) {$pCad99 = (($Cad99 / $TOTALcalls) * 100); $pCad99 = round($pCad99, 0);} + + if ($Cad_0 > 0) {$ApCad_0 = (($Cad_0 / $BDansweredCALLS) * 100); $ApCad_0 = round($ApCad_0, 0);} + if ($Cad_5 > 0) {$ApCad_5 = (($Cad_5 / $BDansweredCALLS) * 100); $ApCad_5 = round($ApCad_5, 0);} + if ($Cad10 > 0) {$ApCad10 = (($Cad10 / $BDansweredCALLS) * 100); $ApCad10 = round($ApCad10, 0);} + if ($Cad15 > 0) {$ApCad15 = (($Cad15 / $BDansweredCALLS) * 100); $ApCad15 = round($ApCad15, 0);} + if ($Cad20 > 0) {$ApCad20 = (($Cad20 / $BDansweredCALLS) * 100); $ApCad20 = round($ApCad20, 0);} + if ($Cad25 > 0) {$ApCad25 = (($Cad25 / $BDansweredCALLS) * 100); $ApCad25 = round($ApCad25, 0);} + if ($Cad30 > 0) {$ApCad30 = (($Cad30 / $BDansweredCALLS) * 100); $ApCad30 = round($ApCad30, 0);} + if ($Cad35 > 0) {$ApCad35 = (($Cad35 / $BDansweredCALLS) * 100); $ApCad35 = round($ApCad35, 0);} + if ($Cad40 > 0) {$ApCad40 = (($Cad40 / $BDansweredCALLS) * 100); $ApCad40 = round($ApCad40, 0);} + if ($Cad45 > 0) {$ApCad45 = (($Cad45 / $BDansweredCALLS) * 100); $ApCad45 = round($ApCad45, 0);} + if ($Cad50 > 0) {$ApCad50 = (($Cad50 / $BDansweredCALLS) * 100); $ApCad50 = round($ApCad50, 0);} + if ($Cad55 > 0) {$ApCad55 = (($Cad55 / $BDansweredCALLS) * 100); $ApCad55 = round($ApCad55, 0);} + if ($Cad60 > 0) {$ApCad60 = (($Cad60 / $BDansweredCALLS) * 100); $ApCad60 = round($ApCad60, 0);} + if ($Cad90 > 0) {$ApCad90 = (($Cad90 / $BDansweredCALLS) * 100); $ApCad90 = round($ApCad90, 0);} + if ($Cad99 > 0) {$ApCad99 = (($Cad99 / $BDansweredCALLS) * 100); $ApCad99 = round($ApCad99, 0);} + } + +### Format variables +$ad_0 = sprintf("%5s", $ad_0); +$ad_5 = sprintf("%5s", $ad_5); +$ad10 = sprintf("%5s", $ad10); +$ad15 = sprintf("%5s", $ad15); +$ad20 = sprintf("%5s", $ad20); +$ad25 = sprintf("%5s", $ad25); +$ad30 = sprintf("%5s", $ad30); +$ad35 = sprintf("%5s", $ad35); +$ad40 = sprintf("%5s", $ad40); +$ad45 = sprintf("%5s", $ad45); +$ad50 = sprintf("%5s", $ad50); +$ad55 = sprintf("%5s", $ad55); +$ad60 = sprintf("%5s", $ad60); +$ad90 = sprintf("%5s", $ad90); +$ad99 = sprintf("%5s", $ad99); +$Cad_0 = sprintf("%5s", $Cad_0); +$Cad_5 = sprintf("%5s", $Cad_5); +$Cad10 = sprintf("%5s", $Cad10); +$Cad15 = sprintf("%5s", $Cad15); +$Cad20 = sprintf("%5s", $Cad20); +$Cad25 = sprintf("%5s", $Cad25); +$Cad30 = sprintf("%5s", $Cad30); +$Cad35 = sprintf("%5s", $Cad35); +$Cad40 = sprintf("%5s", $Cad40); +$Cad45 = sprintf("%5s", $Cad45); +$Cad50 = sprintf("%5s", $Cad50); +$Cad55 = sprintf("%5s", $Cad55); +$Cad60 = sprintf("%5s", $Cad60); +$Cad90 = sprintf("%5s", $Cad90); +$Cad99 = sprintf("%5s", $Cad99); +$pad_0 = sprintf("%4s", $pad_0) . '%'; +$pad_5 = sprintf("%4s", $pad_5) . '%'; +$pad10 = sprintf("%4s", $pad10) . '%'; +$pad15 = sprintf("%4s", $pad15) . '%'; +$pad20 = sprintf("%4s", $pad20) . '%'; +$pad25 = sprintf("%4s", $pad25) . '%'; +$pad30 = sprintf("%4s", $pad30) . '%'; +$pad35 = sprintf("%4s", $pad35) . '%'; +$pad40 = sprintf("%4s", $pad40) . '%'; +$pad45 = sprintf("%4s", $pad45) . '%'; +$pad50 = sprintf("%4s", $pad50) . '%'; +$pad55 = sprintf("%4s", $pad55) . '%'; +$pad60 = sprintf("%4s", $pad60) . '%'; +$pad90 = sprintf("%4s", $pad90) . '%'; +$pad99 = sprintf("%4s", $pad99) . '%'; +$pCad_0 = sprintf("%4s", $pCad_0) . '%'; +$pCad_5 = sprintf("%4s", $pCad_5) . '%'; +$pCad10 = sprintf("%4s", $pCad10) . '%'; +$pCad15 = sprintf("%4s", $pCad15) . '%'; +$pCad20 = sprintf("%4s", $pCad20) . '%'; +$pCad25 = sprintf("%4s", $pCad25) . '%'; +$pCad30 = sprintf("%4s", $pCad30) . '%'; +$pCad35 = sprintf("%4s", $pCad35) . '%'; +$pCad40 = sprintf("%4s", $pCad40) . '%'; +$pCad45 = sprintf("%4s", $pCad45) . '%'; +$pCad50 = sprintf("%4s", $pCad50) . '%'; +$pCad55 = sprintf("%4s", $pCad55) . '%'; +$pCad60 = sprintf("%4s", $pCad60) . '%'; +$pCad90 = sprintf("%4s", $pCad90) . '%'; +$pCad99 = sprintf("%4s", $pCad99) . '%'; +$ApCad_0 = sprintf("%4s", $ApCad_0) . '%'; +$ApCad_5 = sprintf("%4s", $ApCad_5) . '%'; +$ApCad10 = sprintf("%4s", $ApCad10) . '%'; +$ApCad15 = sprintf("%4s", $ApCad15) . '%'; +$ApCad20 = sprintf("%4s", $ApCad20) . '%'; +$ApCad25 = sprintf("%4s", $ApCad25) . '%'; +$ApCad30 = sprintf("%4s", $ApCad30) . '%'; +$ApCad35 = sprintf("%4s", $ApCad35) . '%'; +$ApCad40 = sprintf("%4s", $ApCad40) . '%'; +$ApCad45 = sprintf("%4s", $ApCad45) . '%'; +$ApCad50 = sprintf("%4s", $ApCad50) . '%'; +$ApCad55 = sprintf("%4s", $ApCad55) . '%'; +$ApCad60 = sprintf("%4s", $ApCad60) . '%'; +$ApCad90 = sprintf("%4s", $ApCad90) . '%'; +$ApCad99 = sprintf("%4s", $ApCad99) . '%'; + +$BDansweredCALLS = sprintf("%10s", $BDansweredCALLS); + +### Format and output +$answeredTOTALs = "$ad_0 $ad_5 $ad10 $ad15 $ad20 $ad25 $ad30 $ad35 $ad40 $ad45 $ad50 $ad55 $ad60 $ad90 $ad99 | $BDansweredCALLS |"; +$answeredCUMULATIVE = "$Cad_0 $Cad_5 $Cad10 $Cad15 $Cad20 $Cad25 $Cad30 $Cad35 $Cad40 $Cad45 $Cad50 $Cad55 $Cad60 $Cad90 $Cad99 | $BDansweredCALLS |"; +$answeredINT_PERCENT = "$pad_0 $pad_5 $pad10 $pad15 $pad20 $pad25 $pad30 $pad35 $pad40 $pad45 $pad50 $pad55 $pad60 $pad90 $pad99 | |"; +$answeredCUM_PERCENT = "$pCad_0 $pCad_5 $pCad10 $pCad15 $pCad20 $pCad25 $pCad30 $pCad35 $pCad40 $pCad45 $pCad50 $pCad55 $pCad60 $pCad90 $pCad99 | |"; +$answeredCUM_ANS_PERCENT = "$ApCad_0 $ApCad_5 $ApCad10 $ApCad15 $ApCad20 $ApCad25 $ApCad30 $ApCad35 $ApCad40 $ApCad45 $ApCad50 $ApCad55 $ApCad60 $ApCad90 $ApCad99 | |"; +echo "INTERVAL | $answeredTOTALs\n"; +echo "INT % | $answeredINT_PERCENT\n"; +echo "CUMULATIVE| $answeredCUMULATIVE\n"; +echo "CUM % | $answeredCUM_PERCENT\n"; +echo "CUM ANS % | $answeredCUM_ANS_PERCENT\n"; +echo "----------+-------------------------------------------------------------------------------------------+------------+\n"; + + + + + ############################## ######### CALL HANGUP REASON STATS @@ -758,6 +1067,7 @@ while ($i < $users_to_print) $USERtotTALK_S = round($USERtotTALK_S, 0); if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";} $USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S"; + $USERtotTALK_MS = eregi_replace('-','',$USERtotTALK_MS); $USERtotTALK_MS = sprintf("%8s", $USERtotTALK_MS); $USERavgTALK_M = ($USERavgTALK / 60); @@ -768,6 +1078,7 @@ while ($i < $users_to_print) $USERavgTALK_S = round($USERavgTALK_S, 0); if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";} $USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S"; + $USERavgTALK_MS = eregi_replace('-','',$USERavgTALK_MS); $USERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS); echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n"; @@ -775,18 +1086,21 @@ while ($i < $users_to_print) $i++; } -if (!$TOTcalls) {$TOTcalls = 1;} -$TOTavg = ($TOTtime / $TOTcalls); -$TOTavg = round($TOTavg, 0); -$TOTavg_M = ($TOTavg / 60); -$TOTavg_M_int = round($TOTavg_M, 2); -$TOTavg_M_int = intval("$TOTavg_M_int"); -$TOTavg_S = ($TOTavg_M - $TOTavg_M_int); -$TOTavg_S = ($TOTavg_S * 60); -$TOTavg_S = round($TOTavg_S, 0); -if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";} -$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S"; -$TOTavg = sprintf("%6s", $TOTavg_MS); +if ($TOTcalls < 1) {$TOTcalls = 0; $TOTavg=0;} +else + { + $TOTavg = ($TOTtime / $TOTcalls); + $TOTavg = round($TOTavg, 0); + $TOTavg_M = ($TOTavg / 60); + $TOTavg_M_int = round($TOTavg_M, 2); + $TOTavg_M_int = intval("$TOTavg_M_int"); + $TOTavg_S = ($TOTavg_M - $TOTavg_M_int); + $TOTavg_S = ($TOTavg_S * 60); + $TOTavg_S = round($TOTavg_S, 0); + if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";} + $TOTavg_MS = "$TOTavg_M_int:$TOTavg_S"; + $TOTavg = sprintf("%6s", $TOTavg_MS); + } $TOTtime_M = ($TOTtime / 60); $TOTtime_M_int = round($TOTtime_M, 2); @@ -1012,6 +1326,114 @@ echo "+------+------------------------------------------------------------------ + +############################## +######### CALL ANSWERED TIME BREAKDOWN IN SECONDS + +$BDansweredCALLS = 0; + +echo "\n"; +echo "---------- CALL ANSWERED TIME BREAKDOWN IN SECONDS\n"; +echo "+------+-------------------------------------------------------------------------------------------+------------+\n"; +echo "| HOUR | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; +echo "+------+-------------------------------------------------------------------------------------------+------------+\n"; + + + + +$ZZ = '00'; +$i=0; +$h=4; +$hour= -1; +$no_lines_yet=1; + +while ($i <= 96) + { + $char_counter=0; + $time = ' '; + if ($h >= 4) + { + $hour++; + $h=0; + if ($hour < 10) {$hour = "0$hour";} + $time = "+$hour$ZZ+"; + $SQLtime = "$hour:$ZZ:00"; + $SQLtimeEND = "$hour:15:00"; + } + if ($h == 1) {$time = " 15 "; $SQLtime = "$hour:15:00"; $SQLtimeEND = "$hour:30:00";} + if ($h == 2) {$time = " 30 "; $SQLtime = "$hour:30:00"; $SQLtimeEND = "$hour:45:00";} + if ($h == 3) + { + $time = " 45 "; + $SQLtime = "$hour:45:00"; + $hourEND = ($hour + 1); + if ($hourEND < 10) {$hourEND = "0$hourEND";} + if ($hourEND > 23) {$SQLtimeEND = "23:59:59";} + else {$SQLtimeEND = "$hourEND:00:00";} + } + + $ad_0=0; $ad_5=0; $ad10=0; $ad15=0; $ad20=0; $ad25=0; $ad30=0; $ad35=0; + $ad40=0; $ad45=0; $ad50=0; $ad55=0; $ad60=0; $ad90=0; $ad99=0; $BDansweredCALLS=0; + + $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date $SQLtime' and call_date < '$query_date $SQLtimeEND' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE') group by queue_seconds;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $reasons_to_print = mysql_num_rows($rslt); + $j=0; + while ($j < $reasons_to_print) + { + $row=mysql_fetch_row($rslt); + + $BDansweredCALLS = ($BDansweredCALLS + $row[0]); + + if ($row[1] == 0) {$ad_0 = ($ad_0 + $row[0]);} + if ( ($row[1] > 0) and ($row{1} <= 5) ) {$ad_5 = ($ad_5 + $row[0]);} + if ( ($row[1] > 5) and ($row{1} <= 10) ) {$ad10 = ($ad10 + $row[0]);} + if ( ($row[1] > 10) and ($row{1} <= 15) ) {$ad15 = ($ad15 + $row[0]);} + if ( ($row[1] > 15) and ($row{1} <= 20) ) {$ad20 = ($ad20 + $row[0]);} + if ( ($row[1] > 20) and ($row{1} <= 25) ) {$ad25 = ($ad25 + $row[0]);} + if ( ($row[1] > 25) and ($row{1} <= 30) ) {$ad30 = ($ad30 + $row[0]);} + if ( ($row[1] > 30) and ($row{1} <= 35) ) {$ad35 = ($ad35 + $row[0]);} + if ( ($row[1] > 35) and ($row{1} <= 40) ) {$ad40 = ($ad40 + $row[0]);} + if ( ($row[1] > 40) and ($row{1} <= 45) ) {$ad45 = ($ad45 + $row[0]);} + if ( ($row[1] > 45) and ($row{1} <= 50) ) {$ad50 = ($ad50 + $row[0]);} + if ( ($row[1] > 50) and ($row{1} <= 55) ) {$ad55 = ($ad55 + $row[0]);} + if ( ($row[1] > 55) and ($row{1} <= 60) ) {$ad60 = ($ad60 + $row[0]);} + if ( ($row[1] > 60) and ($row{1} <= 90) ) {$ad90 = ($ad90 + $row[0]);} + if ($row[1] > 90) {$ad99 = ($ad99 + $row[0]);} + $j++; + } + + $ad_0 = sprintf("%5s", $ad_0); + $ad_5 = sprintf("%5s", $ad_5); + $ad10 = sprintf("%5s", $ad10); + $ad15 = sprintf("%5s", $ad15); + $ad20 = sprintf("%5s", $ad20); + $ad25 = sprintf("%5s", $ad25); + $ad30 = sprintf("%5s", $ad30); + $ad35 = sprintf("%5s", $ad35); + $ad40 = sprintf("%5s", $ad40); + $ad45 = sprintf("%5s", $ad45); + $ad50 = sprintf("%5s", $ad50); + $ad55 = sprintf("%5s", $ad55); + $ad60 = sprintf("%5s", $ad60); + $ad90 = sprintf("%5s", $ad90); + $ad99 = sprintf("%5s", $ad99); + + $BDansweredCALLS = sprintf("%10s", $BDansweredCALLS); + + echo "|$time| $ad_0 $ad_5 $ad10 $ad15 $ad20 $ad25 $ad30 $ad35 $ad40 $ad45 $ad50 $ad55 $ad60 $ad90 $ad99 | $BDansweredCALLS |\n"; + + + $i++; + $h++; + } + +echo "+------+-------------------------------------------------------------------------------------------+------------+\n"; +echo "|TOTALI| $answeredTOTALs\n"; +echo "+------+-------------------------------------------------------------------------------------------+------------+\n"; + + $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); echo "\nRun Time: $RUNtime seconds\n"; diff --git a/LANG_www/vicidial_it/AST_IVRstats.php b/LANG_www/vicidial_it/AST_IVRstats.php new file mode 100644 index 00000000..3a5fe5a2 --- /dev/null +++ b/LANG_www/vicidial_it/AST_IVRstats.php @@ -0,0 +1,675 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 81026-2026 - First build +# 81107-0341 - Added time range and option and 15-minute increment graph +# 81107-1148 - Added average times and totals +# 81108-0922 - Added no-callerID and unique caller counts +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';"; +if ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = "$NOW_DATE 00:00:00";} +if (!isset($end_date)) {$end_date = "$NOW_DATE 23:23:59";} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; + $LISTgroups[$i]='---NONE---'; + $i++; + $groups_to_print++; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $LISTgroups[$i] =$row[0]; + $i++; + } + +$i=0; +$group_string='|'; +$group_ct = count($group); +while($i < $group_ct) + { + $group_string .= "$group[$i]|"; + $group_SQL .= "'$group[$i]',"; + $groupQS .= "&group[]=$group[$i]"; + $i++; + } +if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) ) + { + $group_SQL = "''"; +# $group_SQL = "group_id IN('')"; + } +else + { + $group_SQL = eregi_replace(",$",'',$group_SQL); +# $group_SQL = "group_id IN($group_SQL)"; + } + + +$stmt="select vsc_id,vsc_name from vicidial_status_categories;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$statcats_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $statcats_to_print) + { + $row=mysql_fetch_row($rslt); + $vsc_id[$i] = $row[0]; + $vsc_name[$i] = $row[1]; + $vsc_count[$i] = 0; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: IVR Stats\n"; +if ($DB > 0) + { + echo "
\n"; + echo "$group_ct|$group_string|$group_SQL\n"; + echo "
\n"; + echo "$shift|$query_date|$end_date\n"; + echo "
\n"; + } + +echo "
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "Date Range:
\n"; +echo "\n"; +echo " to \n"; +echo "
\n"; +echo "Inbound Groups: \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           "; +echo "MODIFY | "; +echo "REPORTS | "; +echo "CLOSER REPORT \n"; +echo "\n"; + +echo "
\n"; + +#echo "\n"; +echo "Shift: \n"; +echo "   \n"; +echo "
\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if ($groups_to_print < 1)
+{
+echo "\n\n";
+echo "PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+
+
+echo "VICIDIAL: IVR Stats: $group_string          $NOW_TIME\n";
+
+
+
+
+
+
+$TOTALcalls=0;
+$NOCALLERIDcalls=0;
+$UNIQUEcallers=0;
+$totFLOWivr_time=0;
+$totFLOWtotal_time=0;
+
+##### Grab all records for the IVR for the specified time period
+$stmt="select uniqueid,extension,start_time,comment_a,comment_b,comment_d,UNIX_TIMESTAMP(start_time),phone_ext from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) order by uniqueid,start_time;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$logs_to_print = mysql_num_rows($rslt);
+$p=0;
+while ($p < $logs_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$uniqueid[$p] =		$row[0];
+	$extension[$p] =	$row[1];
+	$start_time[$p] =	$row[2];
+	$comment_a[$p] =	$row[3];
+	$comment_b[$p] =	$row[4];
+	$comment_d[$p] =	$row[5];
+	$epoch[$p] =		$row[6];
+	$phone_ext[$p] =	$row[7];
+	$p++;
+	}
+
+### create the call flow of all calls by uniqueid
+$last_uniqueid='';
+$first_epoch='';
+$last_epoch='';
+$p=0;
+$r=-1;
+while ($p < $logs_to_print)
+	{
+	if ($DB > 0) {echo "$p|$uniqueid[$p]|$comment_b[$p]";}
+	if ($last_uniqueid === "$uniqueid[$p]")
+		{
+		$unique_calls[$r] .= "----------$comment_b[$p]";
+		if ($DB > 0) {echo "   $r|$unique_calls[$r]\n";}
+		$last_epoch[$r]=$epoch[$p];
+		}
+	else
+		{
+		$r++;
+		$caller_id[$r]=$phone_ext[$p];
+		if (strlen($phone_ext[$p])<2)
+			{$NOCALLERIDcalls++;}
+		else
+			{
+			if (!ereg("_$phone_ext[$p]_",$unique_callerIDs))
+				{
+				$unique_callerIDs .= "_$phone_ext[$p]_";
+				$UNIQUEcallers++;
+				}
+			}
+		$first_epoch[$r]=$epoch[$p];
+		$last_epoch[$r]=$epoch[$p];
+		$unique_calls[$r] = $comment_b[$p];
+		$FLOWuniqueid[$r] = "$uniqueid[$p]";
+		$last_uniqueid = "$uniqueid[$p]";
+		if ($DB > 0) {echo "   $r|$unique_calls[$r]\n";}
+		}
+	$p++;
+	}
+
+### sort call flows for counting
+$RAWunique_calls = $unique_calls;
+if ($logs_to_print > 0)
+	{sort($unique_calls);}
+
+
+### count each unique call flow
+$last_Suniqueid='';
+$p=-1;
+$s=0;
+while ($s <= $r)
+	{
+	if ($DB > 0) {echo "$s|$unique_calls[$s]\n";}
+	if ($last_Suniqueid === "$unique_calls[$s]")
+		{
+		$STunique_calls_count[$p]++;
+		}
+	else
+		{
+		$p++;
+		$STunique_calls[$p] = $unique_calls[$s];
+		$last_Suniqueid = "$unique_calls[$s]";
+		$STunique_calls_count[$p]=1;
+		}
+	$s++;
+	}
+
+
+### put call flows and counts together for sorting again
+$TOTALcalls=0;
+$s=0;
+while ($s <= $p)
+	{
+	$TOTALcalls = ($TOTALcalls + $STunique_calls_count[$s]);
+	$STunique_calls_count[$s] = sprintf("%07s", $STunique_calls_count[$s]);
+	$FLOWunique_calls[$s] = "$STunique_calls_count[$s]__________$STunique_calls[$s]";
+	$s++;
+	}
+
+#### PRINT TOTAL CALLS INTO THIS IVR
+echo "\n";
+echo "Calls taken into this IVR:   $TOTALcalls\n";
+echo "Calls with no CallerID:      $NOCALLERIDcalls\n";
+echo "Unique Callers:              $UNIQUEcallers\n";
+echo "\n";
+
+### sort call flows for counting
+if ($p > 0)
+	{rsort($FLOWunique_calls);}
+
+
+### put call flows and counts together for sorting again
+$RUC_ct = count($RAWunique_calls);
+$s=0;
+while ($s <= $p)
+	{
+	$FLOWsummary = explode('__________',$FLOWunique_calls[$s]);
+	$FLOWsummary[0] = ($FLOWsummary[0] + 0);
+
+	$t=0;
+	while ($t < $RUC_ct)
+		{
+		if ($FLOWsummary[1] === "$RAWunique_calls[$t]")
+			{
+			$FLOWunique_calls_list[$s] .= "'$FLOWuniqueid[$t]',";
+			if ($last_epoch[$t] <= $first_epoch[$t]) {$last_epoch[$t] = ($first_epoch[$t] + 5);}
+			else {$last_epoch[$t] = ($last_epoch[$t] + 10);}
+			$FLOWivr_time[$s] = ($FLOWivr_time[$s] + ($last_epoch[$t] - $first_epoch[$t]));
+			}
+		$t++;
+		}
+
+	$s++;
+	}
+
+
+### put call flows and counts together for sorting again
+$s=0;
+
+echo "+--------+--------+--------+--------+------+------+\n";
+echo "|        |        | QUEUE  | QUEUE  | IVR  | TOTAL|\n";
+echo "| IVR    | QUEUE  | DROP   | DROP   | AVG  | AVG  |\n";
+echo "| CALLS  | CALLS  | CALLS  | PERCENT| TIME | TIME | CALL PATH\n";
+echo "+--------+--------+--------+--------+------+------+------------\n";
+
+while ($s <= $p)
+	{
+	$vcl_statuses = $MT;
+	$FLOWdrop[$s]=0;
+	$FLOWtotal[$s]=0;
+	$FLOWdropPCT[$s]=0;
+	$FLOWsummary = explode('__________',$FLOWunique_calls[$s]);
+	$FLOWsummary[0] = ($FLOWsummary[0] + 0);
+
+	$FLOWunique_calls_list[$s] = preg_replace("/,$/","",$FLOWunique_calls_list[$s]);
+
+
+	##### Grab all records for the IVR for the specified time period
+	$stmt="select status,length_in_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$vcl_statuses_to_print = mysql_num_rows($rslt);
+	$w=0;
+	while ($w < $vcl_statuses_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$vcl_statuses[$w] =		$row[0];
+		if ( (ereg("DROP",$vcl_statuses[$w])) or (ereg("XDROP",$vcl_statuses[$w])) )
+			{$FLOWdrop[$s]++;}
+		$FLOWclose_time[$s] = ($FLOWclose_time[$s] + $row[1]);
+		$FLOWtotal[$s]++;
+		$w++;
+		}
+	if ( ($FLOWtotal[$s] > 0) and ($FLOWdrop[$s] > 0) )
+		{
+		$FLOWdropPCT[$s] = ( ($FLOWdrop[$s] / $FLOWtotal[$s]) * 100);
+		$FLOWdropPCT[$s] = round($FLOWdropPCT[$s], 2);
+		}
+	$FLOWsummary[0] =	sprintf("%6s", $FLOWsummary[0]);
+	$FLOWtotal[$s] =	sprintf("%6s", $FLOWtotal[$s]);
+	$FLOWdrop[$s] =		sprintf("%6s", $FLOWdrop[$s]);
+	$FLOWdropPCT[$s] =	sprintf("%6s", $FLOWdropPCT[$s]);
+	$FLOWsummary[1] = ereg_replace('----------',' / ',$FLOWsummary[1]);
+	$FLOWtotal_time[$s] = ($FLOWivr_time[$s] + $FLOWclose_time[$s]);
+
+	$avgFLOWivr_time[$s] = ($FLOWivr_time[$s] / $FLOWsummary[0]);
+	$avgFLOWivr_time[$s] = round($avgFLOWivr_time[$s], 0);
+	$avgFLOWivr_time[$s] = sprintf("%4s", $avgFLOWivr_time[$s]);
+	$avgFLOWtotal_time[$s] = ($FLOWtotal_time[$s] / $FLOWsummary[0]);
+	$avgFLOWtotal_time[$s] = round($avgFLOWtotal_time[$s], 0);
+	$avgFLOWtotal_time[$s] = sprintf("%4s", $avgFLOWtotal_time[$s]);
+
+	$totFLOWtotal_time = ($totFLOWtotal_time + $FLOWtotal_time[$s]);
+	$totFLOWivr_time = ($totFLOWivr_time + $FLOWivr_time[$s]);
+	$totFLOWtotal = ($totFLOWtotal + $FLOWtotal[$s]);
+	$totFLOWdrop = ($totFLOWdrop + $FLOWdrop[$s]);
+
+	echo "| $FLOWsummary[0] | $FLOWtotal[$s] | $FLOWdrop[$s] | $FLOWdropPCT[$s]%| $avgFLOWivr_time[$s] | $avgFLOWtotal_time[$s] | $FLOWsummary[1]\n";
+
+	$s++;
+	}
+$TOTALcalls = sprintf("%6s", $TOTALcalls);
+$totFLOWtotal = sprintf("%6s", $totFLOWtotal);
+$totFLOWdrop = sprintf("%6s", $totFLOWdrop);
+if ( ($totFLOWivr_time > 0) and ($TOTALcalls > 0) )
+	{$TavgFLOWivr_time = ($totFLOWivr_time / $TOTALcalls);}
+$TavgFLOWivr_time = round($TavgFLOWivr_time, 0);
+$TavgFLOWivr_time = sprintf("%4s", $TavgFLOWivr_time);
+if ( ($totFLOWtotal_time > 0) and ($TOTALcalls > 0) )
+	{$TavgFLOWtotal_time = ($totFLOWtotal_time / $TOTALcalls);}
+$TavgFLOWtotal_time = round($TavgFLOWtotal_time, 0);
+$TavgFLOWtotal_time = sprintf("%4s", $TavgFLOWtotal_time);
+if ( ($totFLOWtotal < 1) or ($totFLOWdrop < 1) )
+	{$totFLOWdropPCT = '0';}
+else
+	{
+	$totFLOWdropPCT = (($totFLOWdrop / $totFLOWtotal) * 100);
+	$totFLOWdropPCT = round($totFLOWdropPCT, 0);
+	}
+$totFLOWdropPCT = sprintf("%5s", $totFLOWdropPCT);
+
+echo "+--------+--------+--------+--------+------+------+------------\n";
+echo "| $TOTALcalls | $totFLOWtotal | $totFLOWdrop | $totFLOWdropPCT% | $TavgFLOWivr_time | $TavgFLOWtotal_time |\n";
+echo "+--------+--------+--------+--------+------+------+\n";
+
+
+
+
+
+
+
+
+
+
+
+
+
+##############################
+#########  TIME STATS
+
+echo "\n";
+echo "---------- TIME STATS\n";
+
+echo "\n";
+
+$hi_hour_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and comment_a IN($group_SQL) and comment_b='START';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$i++;
+
+
+	$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and comment_a IN($group_SQL) and comment_b='START';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$i++;
+
+	$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and comment_a IN($group_SQL) and comment_b='START';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$i++;
+
+	$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and comment_a IN($group_SQL) and comment_b='START';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS TAKEN INTO THIS IVR\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 102) 
+	{
+	if ($Mk >= 5) 
+		{
+		$Mk=0;
+		if ( ($k < 1) or ($hour_multiplier <= 0) )
+			{$scale_num = 100;}
+		else
+			{
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			}
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+\n";
+#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | TOTAL |\n";
+echo "| HOUR |$call_scale| TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+\n";
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+	{
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$time = "+$hour$ZZ+";
+		}
+	if ($h == 1) {$time = "   15 ";}
+	if ($h == 2) {$time = "   30 ";}
+	if ($h == 3) {$time = "   45 ";}
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 102) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (99 - $Xhour_count);
+
+		$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+		echo "|$time|";
+		$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+		echo "*X";   $char_counter++;
+		$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+			while ($char_counter <= 101) {echo " ";   $char_counter++;}
+		echo "| $hour_count[$i] |\n";
+		}
+	
+	
+	$i++;
+	$h++;
+	}
+
+
+echo "+------+-------------------------------------------------------------------------------------------------------+-------+\n\n";
+
+
+
+
+
+
+
+
+
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + diff --git a/LANG_www/vicidial_it/AST_agent_performance_detail.php b/LANG_www/vicidial_it/AST_agent_performance_detail.php index 279f4407..f936db59 100644 --- a/LANG_www/vicidial_it/AST_agent_performance_detail.php +++ b/LANG_www/vicidial_it/AST_agent_performance_detail.php @@ -11,6 +11,9 @@ # 71218-1155 - added end_date for multi-day reports # 80428-0144 - UTF8 cleanup # 80712-1007 - tally bug fixes and time display change +# 81030-0346 - Added pause code stats +# 81030-1924 - Added total non-pause and total logged-in time to pause code section +# 81108-0716 - fixed user same-name bug # require("dbconnect.php"); @@ -71,6 +74,7 @@ $auth=$row[0]; exit; } +$MT[0]=''; $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $STARTtime = date("U"); @@ -207,7 +211,7 @@ $usersARY[0]=''; $user_namesARY[0]=''; $k=0; -$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;"; +$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by user,full_name,status order by full_name,user,status desc limit 500000;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $rows_to_print = mysql_num_rows($rslt); @@ -245,7 +249,7 @@ while ($i < $rows_to_print) $i++; } - +echo "CALL STATS BREAKDOWN:\n"; echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n"; echo "| USER NAME | ID | CALLS | TIME | PAUSE | PAUSAVG| WAIT | WAITAVG| TALK | TALKAVG| DISPO | DISPAVG|$statusesHTML\n"; echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n"; @@ -316,20 +320,20 @@ while ($m < $k) $Scalls = sprintf("%6s", $Scalls); if ($non_latin < 1) - { - $Sfull_name= sprintf("%-15s", $Sfull_name); - while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);} - $Suser = sprintf("%-8s", $Suser); - while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);} - } + { + $Sfull_name= sprintf("%-15s", $Sfull_name); + while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);} + $Suser = sprintf("%-8s", $Suser); + while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);} + } else - { - $Sfull_name= sprintf("%-45s", $Sfull_name); - while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');} + { + $Sfull_name= sprintf("%-45s", $Sfull_name); + while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');} - $Suser = sprintf("%-24s", $Suser); - while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');} - } + $Suser = sprintf("%-24s", $Suser); + while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');} + } $USERtime_M = ($Stime / 60); $USERtime_M_int = round($USERtime_M, 2); @@ -370,6 +374,7 @@ while ($m < $k) if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";} $USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S"; $pfUSERtotPAUSE_MS = sprintf("%6s", $USERtotPAUSE_MS); + $PAUSEtotal[$m] = $pfUSERtotPAUSE_MS; $USERavgPAUSE_M = ($Spause_avg / 60); $USERavgPAUSE_M_int = round($USERavgPAUSE_M, 2); @@ -570,7 +575,281 @@ echo "+-----------------+----------+--------+---------+--------+--------+------- echo "| TOTALI AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n"; echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n"; -echo "\n"; +echo "\n\n"; + + + + + + + + + + + + + + + +$sub_statuses='-'; +$sub_statusesTXT=''; +$sub_statusesHEAD=''; +$sub_statusesHTML=''; +$sub_statusesARY=$MT; +$j=0; +$PCusers='-'; +$PCusersARY=$MT; +$PCuser_namesARY=$MT; +$k=0; +$stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 $ugSQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$subs_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $subs_to_print) + { + $row=mysql_fetch_row($rslt); + $PCfull_name[$i] = $row[0]; + $PCuser[$i] = $row[1]; + $PCpause_sec[$i] = $row[2]; + $sub_status[$i] = $row[3]; + $PCnon_pause_sec[$i] = $row[4]; +# if ( (!eregi("-$sub_status[$i]-", $sub_statuses)) and (strlen($sub_status[$i])>0) ) + if (!eregi("-$sub_status[$i]-", $sub_statuses)) + { + $sub_statusesTXT = sprintf("%8s", $sub_status[$i]); + $sub_statusesHEAD .= "----------+"; + $sub_statusesHTML .= " $sub_statusesTXT |"; + $sub_statuses .= "$sub_status[$i]-"; + $sub_statusesARY[$j] = $sub_status[$i]; + $j++; + } + if (!eregi("-$PCuser[$i]-", $PCusers)) + { + $PCusers .= "$PCuser[$i]-"; + $PCusersARY[$k] = $PCuser[$i]; + $PCuser_namesARY[$k] = $PCfull_name[$i]; + $k++; + } + + $i++; + } + +echo "PAUSE CODE BREAKDOWN:\n"; +echo "+-----------------+----------+--------+--------+--------+ +$sub_statusesHEAD\n"; +echo "| USER NAME | ID | TOTAL |NONPAUSE| PAUSE | |$sub_statusesHTML\n"; +echo "+-----------------+----------+--------+--------+--------+ +$sub_statusesHEAD\n"; + + +### BEGIN loop through each user ### +$m=0; +$Suser_ct = count($usersARY); +$TOTtotNONPAUSE = 0; +$TOTtotTOTAL = 0; + +while ($m < $k) + { + $d=0; + while ($d < $Suser_ct) + { + if ($usersARY[$d] === "$PCusersARY[$m]") + {$pcPAUSEtotal = $PAUSEtotal[$d];} + $d++; + } + $Suser=$PCusersARY[$m]; + $Sfull_name=$PCuser_namesARY[$m]; + $Spause_sec=0; + $Snon_pause_sec=0; + $Stotal_sec=0; + $SstatusesHTML=''; + + ### BEGIN loop through each status ### + $n=0; + while ($n < $j) + { + $Sstatus=$sub_statusesARY[$n]; + $SstatusTXT=''; + ### BEGIN loop through each stat line ### + $i=0; $status_found=0; + while ($i < $rows_to_print) + { + if ( ($Suser=="$PCuser[$i]") and ($Sstatus=="$sub_status[$i]") ) + { + $Spause_sec = ($Spause_sec + $PCpause_sec[$i]); + $Snon_pause_sec = ($Snon_pause_sec + $PCnon_pause_sec[$i]); + $Stotal_sec = ($Stotal_sec + $PCnon_pause_sec[$i] + $PCpause_sec[$i]); + + $USERcodePAUSE_M = ($PCpause_sec[$i] / 60); + $USERcodePAUSE_M_int = round($USERcodePAUSE_M, 2); + $USERcodePAUSE_M_int = intval("$USERcodePAUSE_M_int"); + $USERcodePAUSE_S = ($USERcodePAUSE_M - $USERcodePAUSE_M_int); + $USERcodePAUSE_S = ($USERcodePAUSE_S * 60); + $USERcodePAUSE_S = round($USERcodePAUSE_S, 0); + if ($USERcodePAUSE_S < 10) {$USERcodePAUSE_S = "0$USERcodePAUSE_S";} + $USERcodePAUSE_MS = "$USERcodePAUSE_M_int:$USERcodePAUSE_S"; + $pfUSERcodePAUSE_MS = sprintf("%6s", $USERcodePAUSE_MS); + + $SstatusTXT = sprintf("%8s", $pfUSERcodePAUSE_MS); + $SstatusesHTML .= " $SstatusTXT |"; + $status_found++; + } + $i++; + } + if ($status_found < 1) + { + $SstatusesHTML .= " 0 |"; + } + ### END loop through each stat line ### + $n++; + } + ### END loop through each status ### + $TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec); + + if ($non_latin < 1) + { + $Sfull_name= sprintf("%-15s", $Sfull_name); + while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);} + $Suser = sprintf("%-8s", $Suser); + while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);} + } + else + { + $Sfull_name= sprintf("%-45s", $Sfull_name); + while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');} + + $Suser = sprintf("%-24s", $Suser); + while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');} + } + + $TOTtotNONPAUSE = ($TOTtotNONPAUSE + $Snon_pause_sec); + $TOTtotTOTAL = ($TOTtotTOTAL + $Stotal_sec); + + $USERtotPAUSE_M = ($Spause_sec / 60); + $USERtotPAUSE_M_int = round($USERtotPAUSE_M, 2); + $USERtotPAUSE_M_int = intval("$USERtotPAUSE_M_int"); + $USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int); + $USERtotPAUSE_S = ($USERtotPAUSE_S * 60); + $USERtotPAUSE_S = round($USERtotPAUSE_S, 0); + if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";} + $USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S"; + $pfUSERtotPAUSE_MS = sprintf("%6s", $USERtotPAUSE_MS); + + $USERtotNONPAUSE_M = ($Snon_pause_sec / 60); + $USERtotNONPAUSE_M_int = round($USERtotNONPAUSE_M, 2); + $USERtotNONPAUSE_M_int = intval("$USERtotNONPAUSE_M_int"); + $USERtotNONPAUSE_S = ($USERtotNONPAUSE_M - $USERtotNONPAUSE_M_int); + $USERtotNONPAUSE_S = ($USERtotNONPAUSE_S * 60); + $USERtotNONPAUSE_S = round($USERtotNONPAUSE_S, 0); + if ($USERtotNONPAUSE_S < 10) {$USERtotNONPAUSE_S = "0$USERtotNONPAUSE_S";} + $USERtotNONPAUSE_MS = "$USERtotNONPAUSE_M_int:$USERtotNONPAUSE_S"; + $pfUSERtotNONPAUSE_MS = sprintf("%6s", $USERtotNONPAUSE_MS); + + $USERtotTOTAL_M = ($Stotal_sec / 60); + $USERtotTOTAL_M_int = round($USERtotTOTAL_M, 2); + $USERtotTOTAL_M_int = intval("$USERtotTOTAL_M_int"); + $USERtotTOTAL_S = ($USERtotTOTAL_M - $USERtotTOTAL_M_int); + $USERtotTOTAL_S = ($USERtotTOTAL_S * 60); + $USERtotTOTAL_S = round($USERtotTOTAL_S, 0); + if ($USERtotTOTAL_S < 10) {$USERtotTOTAL_S = "0$USERtotTOTAL_S";} + $USERtotTOTAL_MS = "$USERtotTOTAL_M_int:$USERtotTOTAL_S"; + $pfUSERtotTOTAL_MS = sprintf("%6s", $USERtotTOTAL_MS); + + + echo "| $Sfull_name | $Suser | $pfUSERtotTOTAL_MS | $pfUSERtotNONPAUSE_MS | $pfUSERtotPAUSE_MS | |$SstatusesHTML\n"; + $m++; + } +### END loop through each user ### + + +###### LAST LINE FORMATTING ########## +### BEGIN loop through each status ### +$SUMstatusesHTML=''; +$TOTtotPAUSE=0; +$n=0; +while ($n < $j) + { + $Scalls=0; + $Sstatus=$sub_statusesARY[$n]; + $SUMstatusTXT=''; + ### BEGIN loop through each stat line ### + $i=0; $status_found=0; + while ($i < $rows_to_print) + { + if ($Sstatus=="$sub_status[$i]") + { + $Scalls = ($Scalls + $PCpause_sec[$i]); + $status_found++; + } + $i++; + } + ### END loop through each stat line ### + if ($status_found < 1) + { + $SUMstatusesHTML .= " 0 |"; + } + else + { + $TOTtotPAUSE = ($TOTtotPAUSE + $Scalls); + + $USERsumstatPAUSE_M = ($Scalls / 60); + $USERsumstatPAUSE_M_int = round($USERsumstatPAUSE_M, 2); + $USERsumstatPAUSE_M_int = intval("$USERsumstatPAUSE_M_int"); + $USERsumstatPAUSE_S = ($USERsumstatPAUSE_M - $USERsumstatPAUSE_M_int); + $USERsumstatPAUSE_S = ($USERsumstatPAUSE_S * 60); + $USERsumstatPAUSE_S = round($USERsumstatPAUSE_S, 0); + if ($USERsumstatPAUSE_S < 10) {$USERsumstatPAUSE_S = "0$USERsumstatPAUSE_S";} + $USERsumstatPAUSE_MS = "$USERsumstatPAUSE_M_int:$USERsumstatPAUSE_S"; + $pfUSERsumstatPAUSE_MS = sprintf("%6s", $USERsumstatPAUSE_MS); + + $SUMstatusTXT = sprintf("%8s", $pfUSERsumstatPAUSE_MS); + $SUMstatusesHTML .= " $SUMstatusTXT |"; + } + $n++; + } +### END loop through each status ### + + $TOT_AGENTS = sprintf("%-4s", $m); + + $TOTtotPAUSE_M = ($TOTtotPAUSE / 60); + $TOTtotPAUSE_M_int = round($TOTtotPAUSE_M, 2); + $TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M_int"); + $TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int); + $TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60); + $TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0); + if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";} + $TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S"; + $TOTtotPAUSE_MS = sprintf("%8s", $TOTtotPAUSE_MS); + while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);} + + $TOTtotNONPAUSE_M = ($TOTtotNONPAUSE / 60); + $TOTtotNONPAUSE_M_int = round($TOTtotNONPAUSE_M, 2); + $TOTtotNONPAUSE_M_int = intval("$TOTtotNONPAUSE_M_int"); + $TOTtotNONPAUSE_S = ($TOTtotNONPAUSE_M - $TOTtotNONPAUSE_M_int); + $TOTtotNONPAUSE_S = ($TOTtotNONPAUSE_S * 60); + $TOTtotNONPAUSE_S = round($TOTtotNONPAUSE_S, 0); + if ($TOTtotNONPAUSE_S < 10) {$TOTtotNONPAUSE_S = "0$TOTtotNONPAUSE_S";} + $TOTtotNONPAUSE_MS = "$TOTtotNONPAUSE_M_int:$TOTtotNONPAUSE_S"; + $TOTtotNONPAUSE_MS = sprintf("%8s", $TOTtotNONPAUSE_MS); + while(strlen($TOTtotNONPAUSE_MS)>8) {$TOTtotNONPAUSE_MS = substr("$TOTtotNONPAUSE_MS", 0, -1);} + + $TOTtotTOTAL_M = ($TOTtotTOTAL / 60); + $TOTtotTOTAL_M_int = round($TOTtotTOTAL_M, 2); + $TOTtotTOTAL_M_int = intval("$TOTtotTOTAL_M_int"); + $TOTtotTOTAL_S = ($TOTtotTOTAL_M - $TOTtotTOTAL_M_int); + $TOTtotTOTAL_S = ($TOTtotTOTAL_S * 60); + $TOTtotTOTAL_S = round($TOTtotTOTAL_S, 0); + if ($TOTtotTOTAL_S < 10) {$TOTtotTOTAL_S = "0$TOTtotTOTAL_S";} + $TOTtotTOTAL_MS = "$TOTtotTOTAL_M_int:$TOTtotTOTAL_S"; + $TOTtotTOTAL_MS = sprintf("%8s", $TOTtotTOTAL_MS); + while(strlen($TOTtotTOTAL_MS)>8) {$TOTtotTOTAL_MS = substr("$TOTtotTOTAL_MS", 0, -1);} + + + +echo "+-----------------+----------+--------+--------+--------+ +$sub_statusesHEAD\n"; +echo "| TOTALI AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n"; +echo "+----------------------------+--------+--------+--------+ +$sub_statusesHEAD\n"; + +echo "\n\n"; } diff --git a/LANG_www/vicidial_it/AST_inboundEXTstats.php b/LANG_www/vicidial_it/AST_inboundEXTstats.php new file mode 100644 index 00000000..1aa397b8 --- /dev/null +++ b/LANG_www/vicidial_it/AST_inboundEXTstats.php @@ -0,0 +1,400 @@ + LICENSE: AGPLv2 +# +# CHANGES +# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat +# - Added required user/pass to gain access to this page +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];} + elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Username/Password non validi: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.11.20';} + +$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$inbound_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $inbound_to_print) + { + $row=mysql_fetch_row($rslt); + $inbound[$i] =$row[0]; + $fullnum[$i] =$row[1]; + $inbname[$i] =$row[2]; + $i++; + } +?> + + + + + +\n"; +#echo"\n"; +echo "ASTERISK: Statistiche Chiamate In Entrata\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "SELEZIONARE UN NUMERO E UNA DATA QUI IN ALTO E CLICCARE SU INVIA\n";
+}
+
+else
+{
+
+
+echo "ASTERISK: Statistiche Chiamate In Entrata                      $NOW_TIME\n";
+
+echo "\n";
+echo "---------- TOTALI\n";
+
+$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
+if (eregi("\*",$group))
+	{$extenSQL = "and extension LIKE \"%$group\"";}
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+$average_hold_seconds = ($row[1] / $row[0]);
+$average_hold_seconds = round($average_hold_seconds, 0);
+$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+
+echo "Totale chiamate ricevute da questo numero:       $TOTALcalls\n";
+echo "Average Call Length(seconds) for all Calls:   $average_hold_seconds\n";
+
+echo "\n";
+echo "---------- ABBATTUTE\n";
+
+$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+$DROPpercent = round($DROPpercent, 0);
+
+if ($row[0])
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+else {$DROPpercent=0;   $average_hold_seconds=0;}
+echo "Total DROP Calls:   (less than 10 seconds)    $DROPcalls  $DROPpercent%\n";
+echo "Average Call Length(seconds) for DROP Calls:  $average_hold_seconds\n";
+
+
+##############################
+#########  CALLS STATS
+
+echo "\n";
+echo "---------- CALL LISTINGS\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+echo "| CALLERID             | CALLERIDNAME         | LENGTH | DATE TIME           |\n";
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$users_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $users_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$CID =			sprintf("%-20s", $row[0]);
+	$CIDname =		sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
+	$datetime =		sprintf("%-19s", $row[3]);
+	$USERavgTALK =	$row[2];
+
+	$USERavgTALK_M = ($USERavgTALK / 60);
+	$USERavgTALK_M = round($USERavgTALK_M, 2);
+	$USERavgTALK_M_int = intval("$USERavgTALK_M");
+	$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
+	$USERavgTALK_S = ($USERavgTALK_S * 60);
+	$USERavgTALK_S = round($USERavgTALK_S, 0);
+	if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
+	$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
+	$USERavgTALK_MS =		sprintf("%6s", $USERavgTALK_MS);
+
+	echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
+
+	$i++;
+	}
+
+echo "+----------------------+----------------------+--------+---------------------+\n";
+
+##############################
+#########  TIME STATS
+
+if ($output == 'FULL')
+	{
+
+	echo "\n";
+	echo "---------- STATISTICHE TEMPO\n";
+
+	echo "\n";
+
+	$hi_hour_count=0;
+	$last_full_record=0;
+	$i=0;
+	$h=0;
+	while ($i <= 96)
+		{
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$hour_count[$i] = $row[0];
+		if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+		if ($hour_count[$i] > 0) {$last_full_record = $i;}
+		$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+		$drop_count[$i] = $row[0];
+		$i++;
+		$h++;
+		}
+
+	$hour_multiplier = (100 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+
+	echo "\n";
+	echo "GRAFICO AD INCREMENTO DI 15 MINUTI DEL TOTALE DELLE CHIAMATE\n";
+
+	$k=1;
+	$Mk=0;
+	$call_scale = '0';
+	while ($k <= 102) 
+		{
+		if ($Mk >= 5) 
+			{
+			$Mk=0;
+			$scale_num=($k / $hour_multiplier);
+			$scale_num = round($scale_num, 0);
+			$LENscale_num = (strlen($scale_num));
+			$k = ($k + $LENscale_num);
+			$call_scale .= "$scale_num";
+			}
+		else
+			{
+			$call_scale .= " ";
+			$k++;   $Mk++;
+			}
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+	#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP                                  | DROPS | TOTAL |\n";
+	echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+	$ZZ = '00';
+	$i=0;
+	$h=4;
+	$hour= -1;
+	$no_lines_yet=1;
+
+	while ($i <= 96)
+		{
+		$char_counter=0;
+		$time = '      ';
+		if ($h >= 4) 
+			{
+			$hour++;
+			$h=0;
+			if ($hour < 10) {$hour = "0$hour";}
+			$time = "+$hour$ZZ+";
+			}
+		if ($h == 1) {$time = "   15 ";}
+		if ($h == 2) {$time = "   30 ";}
+		if ($h == 3) {$time = "   45 ";}
+		$Ghour_count = $hour_count[$i];
+		if ($Ghour_count < 1) 
+			{
+			if ( ($no_lines_yet) or ($i > $last_full_record) )
+				{
+				$do_nothing=1;
+				}
+			else
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				echo "|$time|";
+				$k=0;   while ($k <= 102) {echo " ";   $k++;}
+				echo "| $hour_count[$i] |\n";
+				}
+			}
+		else
+			{
+			$no_lines_yet=0;
+			$Xhour_count = ($Ghour_count * $hour_multiplier);
+			$Yhour_count = (99 - $Xhour_count);
+
+			$Gdrop_count = $drop_count[$i];
+			if ($Gdrop_count < 1) 
+				{
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "*X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 101) {echo " ";   $char_counter++;}
+				echo "| 0     | $hour_count[$i] |\n";
+
+				}
+			else
+				{
+				$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+			#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+				$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+				$hour_count[$i] =	sprintf("%-5s", $hour_count[$i]);
+				$drop_count[$i] =	sprintf("%-5s", $drop_count[$i]);
+
+				echo "|$time|";
+				$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+				echo "D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+				echo "X";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+					while ($char_counter <= 102) {echo " ";   $char_counter++;}
+				echo "| $drop_count[$i] | $hour_count[$i] |\n";
+				}
+			}
+		
+		
+		$i++;
+		$h++;
+		}
+
+
+	echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
+
+
+	}
+
+
+
+
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/LANG_www/vicidial_it/AST_timeonVDADall.php b/LANG_www/vicidial_it/AST_timeonVDADall.php index cdf875b0..95a404c8 100644 --- a/LANG_www/vicidial_it/AST_timeonVDADall.php +++ b/LANG_www/vicidial_it/AST_timeonVDADall.php @@ -39,6 +39,9 @@ # 80822-1222 - Added option for display of customer phone number # 81011-0335 - Fixed remote agent display bug # 81022-1500 - Added inbound call stats display option +# 81029-1023 - Changed drop percent calculation for multi-stat reports +# 81029-1706 - Added pause code display if enabled per campaign +# 81108-2337 - Added inbound-only section # header ("Content-type: text/html; charset=utf-8"); @@ -103,8 +106,8 @@ while ($i < $qm_conf_ct) ##### END SETTINGS LOOKUP ##### ########################################### -if (!isset($RR)) {$gRRroup=4;} -if (!isset($group)) {$group='';} +if (!isset($RR)) {$RR=40;} +if (!isset($group)) {$group=''; $RR=40;} if (!isset($usergroup)) {$usergroup='';} if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name @@ -114,6 +117,8 @@ if (!isset($CALLSdisplay)) {$CALLSdisplay=1;} # 0=no, 1=yes if (!isset($PHONEdisplay)) {$PHONEdisplay=0;} # 0=no, 1=yes if (!isset($CUSTPHONEdisplay)) {$CUSTPHONEdisplay=0;} # 0=no, 1=yes if (!isset($with_inbound)) {$with_inbound='N';} # 0=no, 1=yes +if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes +$ingroup_detail=''; function get_server_load($windows = false) { $os = strtolower(PHP_OS); @@ -310,9 +315,15 @@ if ($UGdisplay > 0) if (!eregi('XXXX-ALL-ACTIVE-XXXX', $group)) { echo "   Inbound:         \n"; echo "STOP | "; @@ -334,162 +345,424 @@ echo "\n\n"; if (!$group) {echo "

per favore seleziona una campagna dal menu qui in alto\n"; exit;} else { -if ($group=='XXXX-ALL-ACTIVE-XXXX') - { - $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; +$multi_drop=0; - $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; - } -else +##### INBOUND ONLY ### +if (ereg('O',$with_inbound)) { - if ($DB > 0) {echo "\n|$with_inbound|$campaign_allow_inbound|\n";} + $multi_drop++; + $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaignsSQL = "'$closer_campaigns'"; + if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} - if ( (ereg('Y',$with_inbound)) and ($campaign_allow_inbound > 0) ) + if ($adastats>1) { - $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; - $rslt=mysql_query($stmt, $link); + $stmtB="select calls_today,drops_today,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4,hold_sec_stat_one,hold_sec_stat_two,hold_sec_answer_calls,hold_sec_drop_calls,hold_sec_queue_calls,campaign_id from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL);"; + + if ($DB > 0) {echo "\n|$stmtB|\n";} + + $r=0; + $rslt=mysql_query($stmtB, $link); + $ingroups_to_print = mysql_num_rows($rslt); + if ($ingroups_to_print > 0) + {$ingroup_detail .= "";} + while ($ingroups_to_print > $r) + { $row=mysql_fetch_row($rslt); - $closer_campaigns = $row[0]; - $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); - $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); - $closer_campaignsSQL = "'$closer_campaigns'"; - if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} + $callsTODAY = $row[0]; + $dropsTODAY = $row[1]; + $answersTODAY = $row[2]; + $VSCcat1 = $row[3]; + $VSCcat1tally = $row[4]; + $VSCcat2 = $row[5]; + $VSCcat2tally = $row[6]; + $VSCcat3 = $row[7]; + $VSCcat3tally = $row[8]; + $VSCcat4 = $row[9]; + $VSCcat4tally = $row[10]; + $hold_sec_stat_one = $row[11]; + $hold_sec_stat_two = $row[12]; + $hold_sec_answer_calls = $row[13]; + $hold_sec_drop_calls = $row[14]; + $hold_sec_queue_calls = $row[15]; + $ingroupdetail = $row[16]; + if ( ($dropsTODAY > 0) and ($answersTODAY > 0) ) + { + $drpctTODAY = ( ($dropsTODAY / $answersTODAY) * 100); + $drpctTODAY = round($drpctTODAY, 2); + $drpctTODAY = sprintf("%01.2f", $drpctTODAY); + } + else + {$drpctTODAY=0;} - $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + if ($callsTODAY > 0) + { + $AVGhold_sec_queue_calls = ($hold_sec_queue_calls / $callsTODAY); + $AVGhold_sec_queue_calls = round($AVGhold_sec_queue_calls, 0); + } + else + {$AVGhold_sec_queue_calls=0;} - $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + if ($dropsTODAY > 0) + { + $AVGhold_sec_drop_calls = ($hold_sec_drop_calls / $dropsTODAY); + $AVGhold_sec_drop_calls = round($AVGhold_sec_drop_calls, 0); + } + else + {$AVGhold_sec_drop_calls=0;} + + if ($answersTODAY > 0) + { + $PCThold_sec_stat_one = ( ($hold_sec_stat_one / $answersTODAY) * 100); + $PCThold_sec_stat_one = round($PCThold_sec_stat_one, 2); + $PCThold_sec_stat_one = sprintf("%01.2f", $PCThold_sec_stat_one); + $PCThold_sec_stat_two = ( ($hold_sec_stat_two / $answersTODAY) * 100); + $PCThold_sec_stat_two = round($PCThold_sec_stat_two, 2); + $PCThold_sec_stat_two = sprintf("%01.2f", $PCThold_sec_stat_two); + $AVGhold_sec_answer_calls = ($hold_sec_answer_calls / $answersTODAY); + $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); + if ($agent_non_pause_sec > 0) + { + $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); + $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); + } + else + {$AVG_ANSWERagent_non_pause_sec=0;} + } + else + { + $PCThold_sec_stat_one=0; + $PCThold_sec_stat_two=0; + $AVGhold_sec_answer_calls=0; + $AVG_ANSWERagent_non_pause_sec=0; + } + + if (ereg("0$|2$|4$|6$|8$",$r)) {$bgcolor='#E6E6E6';} + else {$bgcolor='white';} + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + + $r++; + } + + if ($ingroups_to_print > 0) + {$ingroup_detail .= "
        $ingroupdetail   CHIAMATE OGGI:  $callsTODAY    TMA 1:  $PCThold_sec_stat_one%     Average Hold time for Answered Calls:  $AVGhold_sec_answer_calls  
DROPS TODAY:  $dropsTODAY    TMA 2:  $PCThold_sec_stat_two%     Average Hold time for Dropped Calls:  $AVGhold_sec_drop_calls  
ANSWERS TODAY:  $answersTODAY    DROP PERCENT:  $drpctTODAY%    Average Hold time for All Calls:  $AVGhold_sec_queue_calls  
";} + + } + + $stmt="select agent_pause_codes_active from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + + $stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL);"; + + $stmtC="select agent_non_pause_sec from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + + + if ($DB > 0) {echo "\n|$stmt|$stmtB|$stmtC|\n";} + + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $agent_pause_codes_active = $row[0]; + + $rslt=mysql_query($stmtC, $link); + $row=mysql_fetch_row($rslt); + $agent_non_pause_sec = $row[0]; + + $rslt=mysql_query($stmtB, $link); + $row=mysql_fetch_row($rslt); + $callsTODAY = $row[0]; + $dropsTODAY = $row[1]; + $answersTODAY = $row[2]; + $VSCcat1 = $row[3]; + $VSCcat1tally = $row[4]; + $VSCcat2 = $row[5]; + $VSCcat2tally = $row[6]; + $VSCcat3 = $row[7]; + $VSCcat3tally = $row[8]; + $VSCcat4 = $row[9]; + $VSCcat4tally = $row[10]; + $hold_sec_stat_one = $row[11]; + $hold_sec_stat_two = $row[12]; + $hold_sec_answer_calls = $row[13]; + $hold_sec_drop_calls = $row[14]; + $hold_sec_queue_calls = $row[15]; + if ( ($dropsTODAY > 0) and ($answersTODAY > 0) ) + { + $drpctTODAY = ( ($dropsTODAY / $answersTODAY) * 100); + $drpctTODAY = round($drpctTODAY, 2); + $drpctTODAY = sprintf("%01.2f", $drpctTODAY); + } + else + {$drpctTODAY=0;} + + if ($callsTODAY > 0) + { + $AVGhold_sec_queue_calls = ($hold_sec_queue_calls / $callsTODAY); + $AVGhold_sec_queue_calls = round($AVGhold_sec_queue_calls, 0); + } + else + {$AVGhold_sec_queue_calls=0;} + + if ($dropsTODAY > 0) + { + $AVGhold_sec_drop_calls = ($hold_sec_drop_calls / $dropsTODAY); + $AVGhold_sec_drop_calls = round($AVGhold_sec_drop_calls, 0); + } + else + {$AVGhold_sec_drop_calls=0;} + + if ($answersTODAY > 0) + { + $PCThold_sec_stat_one = ( ($hold_sec_stat_one / $answersTODAY) * 100); + $PCThold_sec_stat_one = round($PCThold_sec_stat_one, 2); + $PCThold_sec_stat_one = sprintf("%01.2f", $PCThold_sec_stat_one); + $PCThold_sec_stat_two = ( ($hold_sec_stat_two / $answersTODAY) * 100); + $PCThold_sec_stat_two = round($PCThold_sec_stat_two, 2); + $PCThold_sec_stat_two = sprintf("%01.2f", $PCThold_sec_stat_two); + $AVGhold_sec_answer_calls = ($hold_sec_answer_calls / $answersTODAY); + $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); + if ($agent_non_pause_sec > 0) + { + $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); + $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); + } + else + {$AVG_ANSWERagent_non_pause_sec=0;} } else { - $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; - - $stmtB="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + $PCThold_sec_stat_one=0; + $PCThold_sec_stat_two=0; + $AVGhold_sec_answer_calls=0; + $AVG_ANSWERagent_non_pause_sec=0; } - } -if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";} -$rslt=mysql_query($stmt, $link); -$row=mysql_fetch_row($rslt); -$DIALlev = $row[0]; -$DIALstatusA = $row[1]; -$DIALstatusB = $row[2]; -$DIALstatusC = $row[3]; -$DIALstatusD = $row[4]; -$DIALstatusE = $row[5]; -$DIALorder = $row[6]; -$DIALfilter = $row[7]; -$HOPlev = $row[8]; -$DIALmethod = $row[9]; -$maxDIALlev = $row[10]; -$DROPmax = $row[11]; -$targetDIFF = $row[12]; -$ADAintense = $row[13]; -$ADAavailonly = $row[14]; -$TAPERtime = $row[15]; -$CALLtime = $row[16]; -$DIALtimeout = $row[17]; -$DIALstatuses = $row[18]; - $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); - $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); - -$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; -if ($group=='XXXX-ALL-ACTIVE-XXXX') - { - $stmt="select count(*) from vicidial_hopper;"; - } -$rslt=mysql_query($stmt, $link); -$row=mysql_fetch_row($rslt); -$VDhop = $row[0]; - -$rslt=mysql_query($stmtB, $link); -$row=mysql_fetch_row($rslt); -$DAleads = $row[0]; -$callsTODAY = $row[1]; -$dropsTODAY = $row[2]; -$drpctTODAY = $row[3]; -$diffONEMIN = $row[4]; -$agentsONEMIN = $row[5]; -$balanceFILL = $row[6]; -$answersTODAY = $row[7]; -$VSCcat1 = $row[8]; -$VSCcat1tally = $row[9]; -$VSCcat2 = $row[10]; -$VSCcat2tally = $row[11]; -$VSCcat3 = $row[12]; -$VSCcat3tally = $row[13]; -$VSCcat4 = $row[14]; -$VSCcat4tally = $row[15]; - -if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) - { - $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); - $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); - } -else {$diffpctONEMIN = '0.00';} - -$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; -if ($group=='XXXX-ALL-ACTIVE-XXXX') - { - $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; - } -$rslt=mysql_query($stmt, $link); -$row=mysql_fetch_row($rslt); -$balanceSHORT = $row[0]; - -echo "
"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; - -if ($adastats>1) - { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "
LIVELLO CHIAMATE:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTRO:  $DIALfilter   DATA:   $NOW_TIME
- min   LIVELLO MAX:  $maxDIALlev   ABBATTIMENTO MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; } -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; - -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; - -echo ""; -echo ""; -echo ""; + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $multi_drop++; + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active) from vicidial_campaigns;"; + + $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } + else + { + if ($DB > 0) {echo "\n|$with_inbound|$campaign_allow_inbound|\n";} + + if ( (ereg('Y',$with_inbound)) and ($campaign_allow_inbound > 0) ) + { + $multi_drop++; + $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaignsSQL = "'$closer_campaigns'"; + if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} + + $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + + $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + } + else + { + $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + + $stmtB="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + } + } + if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";} + + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $DIALlev = $row[0]; + $DIALstatusA = $row[1]; + $DIALstatusB = $row[2]; + $DIALstatusC = $row[3]; + $DIALstatusD = $row[4]; + $DIALstatusE = $row[5]; + $DIALorder = $row[6]; + $DIALfilter = $row[7]; + $HOPlev = $row[8]; + $DIALmethod = $row[9]; + $maxDIALlev = $row[10]; + $DROPmax = $row[11]; + $targetDIFF = $row[12]; + $ADAintense = $row[13]; + $ADAavailonly = $row[14]; + $TAPERtime = $row[15]; + $CALLtime = $row[16]; + $DIALtimeout = $row[17]; + $DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + $agent_pause_codes_active = $row[19]; + $stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; + if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDhop = $row[0]; + + $rslt=mysql_query($stmtB, $link); + $row=mysql_fetch_row($rslt); + $DAleads = $row[0]; + $callsTODAY = $row[1]; + $dropsTODAY = $row[2]; + $drpctTODAY = $row[3]; + $diffONEMIN = $row[4]; + $agentsONEMIN = $row[5]; + $balanceFILL = $row[6]; + $answersTODAY = $row[7]; + if ($multi_drop > 0) + { + if ( ($dropsTODAY > 0) and ($answersTODAY > 0) ) + { + $drpctTODAY = ( ($dropsTODAY / $answersTODAY) * 100); + $drpctTODAY = round($drpctTODAY, 2); + $drpctTODAY = sprintf("%01.2f", $drpctTODAY); + } + else + {$drpctTODAY=0;} + } + $VSCcat1 = $row[8]; + $VSCcat1tally = $row[9]; + $VSCcat2 = $row[10]; + $VSCcat2tally = $row[11]; + $VSCcat3 = $row[12]; + $VSCcat3tally = $row[13]; + $VSCcat4 = $row[14]; + $VSCcat4tally = $row[15]; + + if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } + else {$diffpctONEMIN = '0.00';} + + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $balanceSHORT = $row[0]; + + echo "
CHIAMATE OGGI:  $callsTODAY    TMA 1:  $PCThold_sec_stat_one%     Average Hold time for Answered Calls:  $AVGhold_sec_answer_calls   DATA:   $NOW_TIME
TIMEOUT CHIAMATA:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DROPS TODAY:  $dropsTODAY    TMA 2:  $PCThold_sec_stat_two%     Average Hold time for Dropped Calls:  $AVGhold_sec_drop_calls  
ANSWERS TODAY:  $answersTODAY    (Agent non-pause time / Answers)Average Hold time for All Calls:  $AVGhold_sec_queue_calls  
DROP PERCENT:  $drpctTODAY%    PRODUCTIVITY:  $AVG_ANSWERagent_non_pause_sec    
CONTATTI CHIAMABILI:  $DAleads     CHIAMATE OGGI:  $callsTODAY     MEDIA OPERATORI:  $agentsONEMIN     METODO CHIAMATA:  $DIALmethod    
LIVELLO CODA CHIAMATE:  $HOPlev     ABBATTUTE / RISPOSTE:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     ESITI:  $DIALstatuses    
CONTATTI IN CODA:  $VDhop     PERCENT ABBATTIMENTO:  "; -if ($drpctTODAY >= $DROPmax) - {echo "$drpctTODAY%";} +##### NOT INBOUND ONLY ### else - {echo "$drpctTODAY%";} -echo "    
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; -echo ""; -echo ""; -echo ""; + echo ""; + echo ""; + echo ""; + } echo ""; echo ""; echo ""; echo "
LIVELLO CHIAMATE:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTRO:  $DIALfilter   DATA:   $NOW_TIME
- min   LIVELLO MAX:  $maxDIALlev   ABBATTIMENTO MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
TIMEOUT CHIAMATA:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
CONTATTI CHIAMABILI:  $DAleads     CHIAMATE OGGI:  $callsTODAY     MEDIA OPERATORI:  $agentsONEMIN     METODO CHIAMATA:  $DIALmethod    
LIVELLO CODA CHIAMATE:  $HOPlev     ABBATTUTE / RISPOSTE:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     ESITI:  $DIALstatuses    
CONTATTI IN CODA:  $VDhop     PERCENT ABBATTIMENTO:  "; + if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} + else + {echo "$drpctTODAY%";} + echo "    DIFF:  $diffpctONEMIN%     ORDINE:  $DIALorder    
DIFF:  $diffpctONEMIN%     ORDINE:  $DIALorder    
"; @@ -505,9 +778,15 @@ echo "
"; +echo "$ingroup_detail"; + if ($adastats<2) { - echo "+ VISUALIZZA PIU DATI"; + echo "+ VIEW MORE"; + } +else + { + echo "+ VIEW LESS"; } if ($UGdisplay>0) { @@ -779,7 +1058,16 @@ $HDcampaign = "------------+"; $HTcampaign = " CAMPAGNA |"; $HDcalls = "-------+"; $HTcalls = " CALLS |"; +$HDpause = ''; +$HTpause = ''; +if (!ereg("N",$agent_pause_codes_active)) + { + $HDstatus = "----------"; + $HTstatus = " STATUS "; + $HDpause = "-------+"; + $HTpause = " PAUSE |"; + } if ($PHONEdisplay < 1) { $HDphone = ''; @@ -815,8 +1103,8 @@ if ($SERVdisplay < 1) -$Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls\n"; -$Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls\n"; +$Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls\n"; +$Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls\n"; $Aecho .= "$Aline"; $Aecho .= "$Bline"; $Aecho .= "$Aline"; @@ -876,6 +1164,7 @@ $talking_to_print = mysql_num_rows($rslt); } $callerids=''; +$pausecode=''; $stmt="select callerid,lead_id,phone_number from vicidial_auto_calls;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -1013,6 +1302,11 @@ $calls_to_list = mysql_num_rows($rslt); $comments= $Acomments[$i]; $calls_today = sprintf("%-5s", $Acalls_today[$i]); + if (!ereg("N",$agent_pause_codes_active)) + {$pausecode=' ';} + else + {$pausecode='';} + if (eregi("INCALL",$Lstatus)) { ### temporarily deactivate DEAD calls display until bug is fixed @@ -1109,6 +1403,17 @@ $calls_to_list = mysql_num_rows($rslt); } if ($Lstatus=='PAUSED') { + if (!ereg("N",$agent_pause_codes_active)) + { + $stmtC="select sub_status from vicidial_agent_log where user='$Luser' order by agent_log_id desc limit 1;"; + $rsltC=mysql_query($stmtC,$link); + $rowC=mysql_fetch_row($rsltC); + $pausecode = sprintf("%-6s", $rowC[0]); + $pausecode = "$pausecode "; + } + else + {$pausecode='';} + if ($call_time_M_int >= 360) {$j++; continue;} else @@ -1173,7 +1478,7 @@ $calls_to_list = mysql_num_rows($rslt); $agentcount++; - $Aecho .= "| $G$extension$EG |$phoneD $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n"; + $Aecho .= "| $G$extension$EG |$phoneD $G$user$EG |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n"; $j++; } diff --git a/LANG_www/vicidial_it/AST_timeonVDADallSUMMARY.php b/LANG_www/vicidial_it/AST_timeonVDADallSUMMARY.php new file mode 100644 index 00000000..2c1a53b0 --- /dev/null +++ b/LANG_www/vicidial_it/AST_timeonVDADallSUMMARY.php @@ -0,0 +1,447 @@ + LICENSE: AGPLv2 +# +# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers +# +# STOP=4000, SLOW=40, GO=4 seconds refresh interval +# +# changes: +# 61102-1616 - first build +# 61215-1131 - added answered calls and drop percent taken from answered calls +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70619-1339 - Added Status Category tally display +# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction +# 80525-1040 - Added IVR status summary display for inbound calls +# + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["RR"])) {$RR=$_GET["RR"];} + elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} + elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];} + elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];} + +if (!isset($RR)) {$gRRroup=4;} + + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Username/Password non validi: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); + +$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$rslt=mysql_query($stmt, $link); +if (!isset($DB)) {$DB=0;} +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +if (!isset($RR)) {$RR=4;} + +?> + + + + + +\n"; +echo "VICIDIAL: Riepilogo Di Tutte Le Campagne Aggiornato In Tempo Reale/TITLE></HEAD><BODY BGCOLOR=WHITE>\n"; +echo "<b>VICIDIAL: Riepilogo Di Tutte Le Campagne Aggiornato In Tempo Reale/b>           \n"; +echo "<a href=\"$PHP_SELF?group=$group&RR=4000&DB=$DB&adastats=$adastats\">STOP</a> | "; +echo "<a href=\"$PHP_SELF?group=$group&RR=40&DB=$DB&adastats=$adastats\">PIU LENTO</a> | "; +echo "<a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=$adastats\">INIZIA</a> "; +echo "       </FONT>\n"; +if ($adastats<2) + { + echo "<a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=2\"><font size=1>+ VISUALIZZA PIU DATI</font></a>"; + } +else + { + echo "<a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=1\"><font size=1>- VISUALIZZA MENO DATI</font></a>"; + } +echo "       <a href=\"./admin.php?ADD=999999\">REPORT</a>"; +echo "<BR><BR>\n\n"; + +$k=0; +while($k<$groups_to_print) +{ +$NFB = '<b><font size=3 face="courier">'; +$NFE = '</font></b>'; +$F=''; $FG=''; $B=''; $BG=''; + +$group = $groups[$k]; +echo "<b><a href=\"./AST_timeonVDADall.php?group=$group&RR=$RR&DB=$DB&adastats=$adastats\">$group</a></b>   -   "; +echo "<a href=\"./admin.php?ADD=34&campaign_id=$group\">Modifica</a>\n"; + + +$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_allow_inbound = $row[0]; + +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DIALlev = $row[0]; +$DIALstatusA = $row[1]; +$DIALstatusB = $row[2]; +$DIALstatusC = $row[3]; +$DIALstatusD = $row[4]; +$DIALstatusE = $row[5]; +$DIALorder = $row[6]; +$DIALfilter = $row[7]; +$HOPlev = $row[8]; +$DIALmethod = $row[9]; +$maxDIALlev = $row[10]; +$DROPmax = $row[11]; +$targetDIFF = $row[12]; +$ADAintense = $row[13]; +$ADAavailonly = $row[14]; +$TAPERtime = $row[15]; +$CALLtime = $row[16]; +$DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + +$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VDhop = $row[0]; + +$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$DAleads = $row[0]; +$callsTODAY = $row[1]; +$dropsTODAY = $row[2]; +$drpctTODAY = $row[3]; +$diffONEMIN = $row[4]; +$agentsONEMIN = $row[5]; +$balanceFILL = $row[6]; +$answersTODAY = $row[7]; +$VSCcat1 = $row[8]; +$VSCcat1tally = $row[9]; +$VSCcat2 = $row[10]; +$VSCcat2tally = $row[11]; +$VSCcat3 = $row[12]; +$VSCcat3tally = $row[13]; +$VSCcat4 = $row[14]; +$VSCcat4tally = $row[15]; + +if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } +else {$diffpctONEMIN = '0.00';} + +$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$balanceSHORT = $row[0]; + +echo "<BR><table cellpadding=0 cellspacing=0><TR>"; +echo "<TD ALIGN=RIGHT><font size=2><B>LIVELLO CHIAMATE:</B></TD><TD ALIGN=LEFT><font size=2>  $DIALlev    </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>TRUNK SHORT/FILL:</B></TD><TD ALIGN=LEFT><font size=2>  $balanceSHORT / $balanceFILL     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>FILTRO:</B></TD><TD ALIGN=LEFT><font size=2>  $DIALfilter   </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B> DATA:</B>   </TD><TD ALIGN=LEFT><font size=2> $NOW_TIME </TD>"; +echo ""; +echo "</TR>"; + +if ($adastats>1) + { + echo "<TR BGCOLOR=\"#CCCCCC\">"; + echo "<TD ALIGN=RIGHT><font size=2>  <B>LIVELLO MAX:</B></TD><TD ALIGN=LEFT><font size=2>  $maxDIALlev   </TD>"; + echo "<TD ALIGN=RIGHT><font size=2><B>ABBATTIMENTO MAX:</B></TD><TD ALIGN=LEFT><font size=2>  $DROPmax%    </TD>"; + echo "<TD ALIGN=RIGHT><font size=2><B>TARGET DIFF:</B></TD><TD ALIGN=LEFT><font size=2>  $targetDIFF     </TD>"; + echo "<TD ALIGN=RIGHT><font size=2><B>INTENSITY:</B></TD><TD ALIGN=LEFT><font size=2>  $ADAintense     </TD>"; + echo "</TR>"; + + echo "<TR BGCOLOR=\"#CCCCCC\">"; + echo "<TD ALIGN=RIGHT><font size=2><B>TIMEOUT CHIAMATA:</B></TD><TD ALIGN=LEFT><font size=2>  $DIALtimeout  </TD>"; + echo "<TD ALIGN=RIGHT><font size=2><B>TAPER TIME:</B></TD><TD ALIGN=LEFT><font size=2>  $TAPERtime  </TD>"; + echo "<TD ALIGN=RIGHT><font size=2><B>LOCAL TIME:</B></TD><TD ALIGN=LEFT><font size=2>  $CALLtime  </TD>"; + echo "<TD ALIGN=RIGHT><font size=2><B>AVAIL ONLY:</B></TD><TD ALIGN=LEFT><font size=2>  $ADAavailonly  </TD>"; + echo "</TR>"; + } + +echo "<TR>"; +echo "<TD ALIGN=RIGHT><font size=2><B>CONTATTI CHIAMABILI:</B></TD><TD ALIGN=LEFT><font size=2>  $DAleads     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>CHIAMATE OGGI:</B></TD><TD ALIGN=LEFT><font size=2>  $callsTODAY     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>MEDIA OPERATORI:</B></TD><TD ALIGN=LEFT><font size=2>  $agentsONEMIN     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>METODO CHIAMATA:</B></TD><TD ALIGN=LEFT><font size=2>  $DIALmethod     </TD>"; +echo "</TR>"; + +echo "<TR>"; +echo "<TD ALIGN=RIGHT><font size=2><B>LIVELLO CODA CHIAMATE:</B></TD><TD ALIGN=LEFT><font size=2>  $HOPlev     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>ABBATTUTE / RISPOSTE:</B></TD><TD ALIGN=LEFT><font size=2>  $dropsTODAY / $answersTODAY   </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>DL DIFF:</B></TD><TD ALIGN=LEFT><font size=2>  $diffONEMIN     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>ESITI:</B></TD><TD ALIGN=LEFT><font size=2>  $DIALstatuses     </TD>"; +echo "</TR>"; + +echo "<TR>"; +echo "<TD ALIGN=RIGHT><font size=2><B>CONTATTI IN CODA:</B></TD><TD ALIGN=LEFT><font size=2>  $VDhop     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>PERCENT ABBATTIMENTO:</B></TD><TD ALIGN=LEFT><font size=2>  "; +if ($drpctTODAY >= $DROPmax) + {echo "<font color=red><B>$drpctTODAY%</B></font>";} +else + {echo "$drpctTODAY%";} +echo "    </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>DIFF:</B></TD><TD ALIGN=LEFT><font size=2>  $diffpctONEMIN%     </TD>"; +echo "<TD ALIGN=RIGHT><font size=2><B>ORDINE:</B></TD><TD ALIGN=LEFT><font size=2>  $DIALorder     </TD>"; +echo "</TR>"; + +echo "<TR>"; +echo "<TD ALIGN=LEFT COLSPAN=8>"; +if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) ) + {echo "<font size=2><B>$VSCcat1:</B>   $VSCcat1tally       \n";} +if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) ) + {echo "<font size=2><B>$VSCcat2:</B>   $VSCcat2tally       \n";} +if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) ) + {echo "<font size=2><B>$VSCcat3:</B>   $VSCcat3tally       \n";} +if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) ) + {echo "<font size=2><B>$VSCcat4:</B>   $VSCcat4tally       \n";} +echo "</TD></TR>"; +echo "<TR>"; +echo "<TD ALIGN=LEFT COLSPAN=8>"; + +### Header finish + + + + + +################################################################################ +### START calculating calls/agents +################################################################################ + +################################################################################ +###### OUTBOUND CALLS +################################################################################ +if ($campaign_allow_inbound > 0) + { + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );"; + } +else + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} + else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + + $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;"; + } +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$parked_to_print = mysql_num_rows($rslt); + if ($parked_to_print > 0) + { + $i=0; + $out_total=0; + $out_ring=0; + $out_live=0; + $in_ivr=0; + while ($i < $parked_to_print) + { + $row=mysql_fetch_row($rslt); + + if (eregi("LIVE",$row[0])) + {$out_live++;} + else + { + if (eregi("IVR",$row[0])) + {$in_ivr++;} + if (eregi("CLOSER",$row[0])) + {$nothing=1;} + else + {$out_ring++;} + } + $out_total++; + $i++; + } + + if ($out_live > 0) {$F='<FONT class="r1">'; $FG='</FONT>';} + if ($out_live > 4) {$F='<FONT class="r2">'; $FG='</FONT>';} + if ($out_live > 9) {$F='<FONT class="r3">'; $FG='</FONT>';} + if ($out_live > 14) {$F='<FONT class="r4">'; $FG='</FONT>';} + + if ($campaign_allow_inbound > 0) + {echo "$NFB$out_total$NFE current active calls      \n";} + else + {echo "$NFB$out_total$NFE calls being placed       \n";} + + echo "$NFB$out_ring$NFE calls ringing         \n"; + echo "$NFB$F  $out_live $FG$NFE calls waiting for agents       \n"; + echo "$NFB  $in_ivr$NFE calls in IVR       \n"; + } + else + { + echo " NESSUNA CHIAMATA IN ATTESA\n"; + } + + +################################################################################### +###### TIME ON SYSTEM +################################################################################### + +$agent_incall=0; +$agent_ready=0; +$agent_paused=0; +$agent_total=0; + +$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$talking_to_print = mysql_num_rows($rslt); + if ($talking_to_print > 0) + { + $i=0; + $agentcount=0; + while ($i < $talking_to_print) + { + $row=mysql_fetch_row($rslt); + if (eregi("READY|PAUSED",$row[3])) + { + $row[5]=$row[6]; + } + $Lstatus = $row[3]; + $status = sprintf("%-6s", $row[3]); + if (!eregi("INCALL|QUEUE",$row[3])) + {$call_time_S = ($STARTtime - $row[6]);} + else + {$call_time_S = ($STARTtime - $row[5]);} + + $call_time_M = ($call_time_S / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $call_time_MS = sprintf("%7s", $call_time_MS); + $G = ''; $EG = ''; + if (eregi("PAUSED",$row[3])) + { + if ($call_time_M_int >= 30) + {$i++; continue;} + else + { + $agent_paused++; $agent_total++; + } + } + + if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;} + if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;} + $agentcount++; + + + $i++; + } + + if ($agent_ready > 0) {$B='<FONT class="b1">'; $BG='</FONT>';} + if ($agent_ready > 4) {$B='<FONT class="b2">'; $BG='</FONT>';} + if ($agent_ready > 9) {$B='<FONT class="b3">'; $BG='</FONT>';} + if ($agent_ready > 14) {$B='<FONT class="b4">'; $BG='</FONT>';} + + echo "\n<BR>\n"; + + echo "$NFB$agent_total$NFE agents logged in         \n"; + echo "$NFB$agent_incall$NFE agents in calls       \n"; + echo "$NFB$B  $agent_ready $BG$NFE agents waiting       \n"; + echo "$NFB$agent_paused$NFE paused agents       \n"; + + echo "<PRE><FONT SIZE=2>"; + echo ""; + } + else + { + echo " NESSUN OPERATORE AL TELEFONO<BR>\n"; + } + +################################################################################ +### END calculating calls/agents +################################################################################ + + + + + +echo "</TD>"; +echo "</TR>"; +echo "</TABLE>"; + +echo "</FORM>\n\n"; +$k++; +} + +?> +</PRE> + +</BODY></HTML> diff --git a/LANG_www/vicidial_it/admin.php b/LANG_www/vicidial_it/admin.php index 4b7d1300..279bd821 100644 --- a/LANG_www/vicidial_it/admin.php +++ b/LANG_www/vicidial_it/admin.php @@ -845,6 +845,14 @@ if (isset($_GET["delete_inbound_dids"])) {$delete_inbound_dids=$_GET["delete_i elseif (isset($_POST["delete_inbound_dids"])) {$delete_inbound_dids=$_POST["delete_inbound_dids"];} if (isset($_GET["three_way_call_cid"])) {$three_way_call_cid=$_GET["three_way_call_cid"];} elseif (isset($_POST["three_way_call_cid"])) {$three_way_call_cid=$_POST["three_way_call_cid"];} +if (isset($_GET["three_way_dial_prefix"])) {$three_way_dial_prefix=$_GET["three_way_dial_prefix"];} + elseif (isset($_POST["three_way_dial_prefix"])) {$three_way_dial_prefix=$_POST["three_way_dial_prefix"];} +if (isset($_GET["forced_timeclock_login"])) {$forced_timeclock_login=$_GET["forced_timeclock_login"];} + elseif (isset($_POST["forced_timeclock_login"])) {$forced_timeclock_login=$_POST["forced_timeclock_login"];} +if (isset($_GET["answer_sec_pct_rt_stat_one"])) {$answer_sec_pct_rt_stat_one=$_GET["answer_sec_pct_rt_stat_one"];} + elseif (isset($_POST["answer_sec_pct_rt_stat_one"])) {$answer_sec_pct_rt_stat_one=$_POST["answer_sec_pct_rt_stat_one"];} +if (isset($_GET["answer_sec_pct_rt_stat_two"])) {$answer_sec_pct_rt_stat_two=$_GET["answer_sec_pct_rt_stat_two"];} + elseif (isset($_POST["answer_sec_pct_rt_stat_two"])) {$answer_sec_pct_rt_stat_two=$_POST["answer_sec_pct_rt_stat_two"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -1015,6 +1023,8 @@ $did_id = ereg_replace("[^0-9]","",$did_id); $source_did = ereg_replace("[^0-9]","",$source_did); $modify_inbound_dids = ereg_replace("[^0-9]","",$modify_inbound_dids); $delete_inbound_dids = ereg_replace("[^0-9]","",$delete_inbound_dids); +$answer_sec_pct_rt_stat_one = ereg_replace("[^0-9]","",$answer_sec_pct_rt_stat_one); +$answer_sec_pct_rt_stat_two = ereg_replace("[^0-9]","",$answer_sec_pct_rt_stat_two); ### DIGITS and COLONS $shift_length = ereg_replace("[^\:0-9]","",$shift_length); @@ -1047,7 +1057,6 @@ $available_only_ratio_tally = ereg_replace("[^NY]","",$available_only_ratio_tall $sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); $vicidial_balance_active = ereg_replace("[^NY]","",$vicidial_balance_active); $vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); -$agent_pause_codes_active = ereg_replace("[^NY]","",$agent_pause_codes_active); $campaign_stats_refresh = ereg_replace("[^NY]","",$campaign_stats_refresh); $disable_alter_custdata = ereg_replace("[^NY]","",$disable_alter_custdata); $no_hopper_leads_logins = ereg_replace("[^NY]","",$no_hopper_leads_logins); @@ -1093,6 +1102,8 @@ $code = ereg_replace("[^0-9a-zA-Z]","",$code); $survey_no_response_action = ereg_replace("[^0-9a-zA-Z]","",$survey_no_response_action); $survey_ni_status = ereg_replace("[^0-9a-zA-Z]","",$survey_ni_status); $qc_get_record_launch = ereg_replace("[^0-9a-zA-Z]","",$qc_get_record_launch); +$agent_pause_codes_active = ereg_replace("[^0-9a-zA-Z]","",$agent_pause_codes_active); +$three_way_dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$three_way_dial_prefix); ### DIGITS and Dots $server_ip = ereg_replace("[^\.0-9]","",$server_ip); @@ -1208,6 +1219,7 @@ $three_way_call_cid = ereg_replace("[^-\_0-9a-zA-Z]","",$three_way_call_cid); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); +$forced_timeclock_login = ereg_replace("[^-\,\_0-9a-zA-Z]","",$forced_timeclock_login); ### ALPHA-NUMERIC and spaces $lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); @@ -1459,11 +1471,15 @@ $survey_camp_record_dir = ereg_replace(";","",$survey_camp_record_dir); # 81002-1101 - Added more in-group options and new DID section and user options # 81007-0936 - Added three_way_call_cid option to campaigns # 81012-1725 - Added INBOUND_MAN dial method allowing for manual list dialing with inbound calls +# 81030-0348 - Added campaign pause code force option +# 81030-2228 - Fixed DIDs creation issue +# 81103-1408 - Added 3way call dial prefix option +# 81107-1551 - Added Stats Percent of Calls Answered Within X seconds fields to in-groups # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.5-145'; -$build = '81012-1725'; +$admin_version = '2.0.5-149'; +$build = '81107-1551'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -2867,7 +2883,7 @@ echo "<TABLE WIDTH=98% BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR><TD ALIGN <BR> <A NAME="vicidial_campaigns-agent_pause_codes_active"> <BR> -<B>La pausa del agente cifra activo -</B> permite que los agentes seleccionenun co`digo de la pausa cuando chascan encendido el boton de PAUSA envicidial.php. Los co`digos de la pausa son definibles por campaña enel fondo de la pantalla del detalle de la opinio`n de la campaña y sealmacenan en la tabla del vicidial_agent_log. El defecto es N. +<B>La pausa del agente cifra activo -</B> permite que los agentes seleccionenun co`digo de la pausa cuando chascan encendido el boton de PAUSA envicidial.php. Los co`digos de la pausa son definibles por campaña enel fondo de la pantalla del detalle de la opinio`n de la campaña y sealmacenan en la tabla del vicidial_agent_log. El defecto es N. FORCE will force the agents to choose a PAUSE code if they click on the PAUSE button. <BR> <A NAME="vicidial_campaigns-disable_alter_custdata"> @@ -2939,6 +2955,11 @@ echo "<TABLE WIDTH=98% BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR><TD ALIGN <BR> <B>3-Way Call CallerID De salida -</B> This defines what is sent out as the outbound callerID number from 3-way calls placed by the agent, CAMPAIGN uses the custom campaign callerID, CUSTOMER uses the number of the customer that is active on the agents screen and AGENT_PHONE uses the callerID for the phone that the agent is logged into. +<BR> +<A NAME="vicidial_campaigns-three_way_dial_prefix"> +<BR> +<B>3-Way Call Prefisso Chiamata -</B> This defines what is used as the dial prefix for 3-way calls, default is empty so the campaign dial prefix is used, passthru so you can hear ringing is 88. + <BR> <A NAME="vicidial_campaigns-qc_enabled"> <BR> @@ -3344,6 +3365,11 @@ echo "<TABLE WIDTH=98% BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR><TD ALIGN <BR> <B>No Delay Call Route -</B> Setting this to Y will remove all wait times and audio prompts and attempt to send the call right to an agent. Does not override welcome message or on hold prompt settings. Default is N. +<BR> +<A NAME="vicidial_inbound_groups-answer_sec_pct_rt_stat_one"> +<BR> +<B>Stats Percent of Calls Answered Within X seconds -</B> This field allows you to set the number of hold seconds that the realtime stats display will use to calculate the percentage of answered calls that were answered within X number of seconds on hold. + @@ -3554,6 +3580,11 @@ echo "<TABLE WIDTH=98% BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR><TD ALIGN <BR> <B>Nombre de grupo -</B> esta es la descripcio`n del máximo vicidial del grupo de usuario de 40 caracteres. +<BR> +<A NAME="vicidial_user_groups-forced_timeclock_login"> +<BR> +<B>Force Timeclock Login -</B> This option allows you to not let an agent log in to the VICIDIAL agent interface if they have not logged into the timeclock. Default is N. There is an option to exempt admin users, levels 8 and 9. + <BR> <A NAME="vicidial_user_groups-group_shifts"> <BR> @@ -6252,7 +6283,7 @@ if ($ADD==20) { echo "<br><B>CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id</B>\n"; - $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix from vicidial_campaigns where campaign_id='$source_campaign_id';"; $rslt=mysql_query($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; @@ -6672,7 +6703,7 @@ if ($ADD==2011) } else { - $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id=\"$source_group_id\";"; $rslt=mysql_query($stmt, $link); echo "<br><B>GRUPPO AGGIUNTO: $group_id</B>\n"; @@ -6697,7 +6728,7 @@ $ADD=3111; if ($ADD==2311) { echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"; - $stmt="SELECT count(*) from vicidial_inbound_dids where did_id='$did_id';"; + $stmt="SELECT count(*) from vicidial_inbound_dids where did_pattern='$did_pattern';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); if ($row[0] > 0) @@ -6711,7 +6742,7 @@ if ($ADD==2311) {echo "<br>DID NOT ADDED - there is already a DID in the system with this extension\n";} else { - if ( (strlen($source_did) < 1) or (strlen($did_pattern) < 1) or (eregi(' ',$source_did)) or (eregi(' ',$did_pattern)) or (eregi("\+",$source_did)) ) + if ( (strlen($did_pattern) < 2) or (eregi(' ',$did_pattern)) or (eregi('-',$did_pattern)) or (eregi("\+",$did_pattern)) ) { echo "<br>DID NOT ADDED - Per favore torna indietro e ricontrolla i dati inseriti\n"; echo "<br>DID Extension must be between 2 and 20 characters in length and contain no ' -+'.\n"; @@ -6756,7 +6787,7 @@ if ($ADD==2411) {echo "<br>DID NOT ADDED - there is already a DID in the system with this extension\n";} else { - if ( (strlen($did_id) < 1) or (strlen($did_pattern) < 1) or (eregi(' ',$did_id)) or (eregi(' ',$did_pattern)) or (eregi("\+",$did_id)) ) + if ( (strlen($source_did) < 1) or (strlen($did_pattern) < 1) or (eregi(' ',$source_did)) or (eregi(' ',$did_pattern)) or (eregi("\+",$source_did)) ) { echo "<br>DID NOT ADDED - Per favore torna indietro e ricontrolla i dati inseriti\n"; echo "<br>DID Extension must be between 2 and 20 characters in length and contain no ' -+'.\n"; @@ -7641,7 +7672,7 @@ if ($ADD==41) if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) {$hopper_level='100';} - $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid' where campaign_id='$campaign_id';"; + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix' where campaign_id='$campaign_id';"; $rslt=mysql_query($stmtA, $link); if ($reset_hopper == 'Y') @@ -8406,7 +8437,7 @@ if ($ADD==4111) echo "<br><B>GRUPPO MODIFICATO: $group_id</B>\n"; - $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message' where group_id='$group_id';"; + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message',answer_sec_pct_rt_stat_one='$answer_sec_pct_rt_stat_one',answer_sec_pct_rt_stat_two='$answer_sec_pct_rt_stat_two' where group_id='$group_id';"; $rslt=mysql_query($stmt, $link); ### LOG CHANGES TO LOG FILE ### @@ -8535,7 +8566,7 @@ if ($ADD==411111) $GROUP_shifts .= "$group_shifts[$p] "; $p++; } - $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value',qc_allowed_campaigns='$qc_campaigns_value',qc_allowed_inbound_groups='$qc_groups_value',group_shifts='$GROUP_shifts' where user_group='$OLDuser_group';"; + $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value',qc_allowed_campaigns='$qc_campaigns_value',qc_allowed_inbound_groups='$qc_groups_value',group_shifts='$GROUP_shifts',forced_timeclock_login='$forced_timeclock_login' where user_group='$OLDuser_group';"; $rslt=mysql_query($stmt, $link); echo "<br><B>GRUPPO UTENTI MODIFICATO</B>\n"; @@ -11059,6 +11090,7 @@ if ($ADD==31) $agent_extended_alt_dial = $row[94]; $use_campaign_dnc = $row[95]; $three_way_call_cid = $row[96]; + $three_way_dial_prefix = $row[97]; if (ereg("DISABLED",$list_order_mix)) {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} @@ -11469,7 +11501,7 @@ if ($ADD==31) echo "<tr bgcolor=#B6D3FC><td align=right>Use Campagna DNC List: </td><td align=left><select size=1 name=use_campaign_dnc><option>Y</option><option>N</option><option SELECTED>$use_campaign_dnc</option></select>$NWB#vicidial_campaigns-use_campaign_dnc$NWE</td></tr>\n"; - echo "<tr bgcolor=#B6D3FC><td align=right>AgentCodici PausaAttivo: </td><td align=left><select size=1 name=agent_pause_codes_active><option>Y</option><option>N</option><option SELECTED>$agent_pause_codes_active</option></select>$NWB#vicidial_campaigns-agent_pause_codes_active$NWE</td></tr>\n"; + echo "<tr bgcolor=#B6D3FC><td align=right>AgentCodici PausaAttivo: </td><td align=left><select size=1 name=agent_pause_codes_active><option>FORCE</option><option>Y</option><option>N</option><option SELECTED>$agent_pause_codes_active</option></select>$NWB#vicidial_campaigns-agent_pause_codes_active$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Aggiornamento Statistiche Campagna: </td><td align=left><select size=1 name=campaign_stats_refresh><option>Y</option><option>N</option><option SELECTED>$campaign_stats_refresh</option></select>$NWB#vicidial_campaigns-campaign_stats_refresh$NWE</td></tr>\n"; @@ -11490,6 +11522,9 @@ if ($ADD==31) echo "<tr bgcolor=#B6D3FC><td align=right>3-Way Call CallerID De salida: </td><td align=left><select size=1 name=three_way_call_cid><option>CAMPAGNA</option><option>CUSTOMER</option><option>AGENT_PHONE</option><option SELECTED>$three_way_call_cid</option></select>$NWB#vicidial_campaigns-three_way_call_cid$NWE</td></tr>\n"; + echo "<tr bgcolor=#B6D3FC><td align=right>3-Way Call Prefisso Chiamata: </td><td align=left><input type=text name=three_way_dial_prefix size=15 maxlength=20 value=\"$three_way_dial_prefix\">$NWB#vicidial_campaigns-three_way_dial_prefix$NWE</td></tr>\n"; + + if ($campaign_allow_inbound == 'Y') { echo "<tr bgcolor=#B6D3FC><td align=right>Grupos De entrada Permitidos: <BR>"; @@ -13393,6 +13428,8 @@ if ($ADD==3111) $hold_recall_xfer_group = $row[50]; $no_delay_call_route = $row[51]; $play_welcome_message = $row[52]; + $answer_sec_pct_rt_stat_one = $row[53]; + $answer_sec_pct_rt_stat_two = $row[54]; ##### get in-groups listings for dynamic pulldown $stmt="SELECT group_id,group_name from vicidial_inbound_groups where group_id NOT IN('AGENTDIRECT') order by group_id"; @@ -13592,6 +13629,10 @@ if ($ADD==3111) echo "<tr bgcolor=#B6D3FC><td align=right>In-Group Recording Override: </td><td align=left><select size=1 name=ingroup_recording_override><option>DISABLED</option><option>NEVER</option><option>ONDEMAND</option><option>ALLCALLS</option><option>ALLFORCE</option><option SELECTED>$ingroup_recording_override</option></select>$NWB#vicidial_inbound_groups-ingroup_recording_override$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>In-Group Recording Filename: </td><td align=left><input type=text name=ingroup_rec_filename size=50 maxlength=50 value=\"$ingroup_rec_filename\">$NWB#vicidial_inbound_groups-ingroup_rec_filename$NWE</td></tr>\n"; + + echo "<tr bgcolor=#B6D3FC><td align=right>Stats Percent of Calls Answered Within X seconds 1: </td><td align=left><input type=text name=answer_sec_pct_rt_stat_one size=5 maxlength=5 value=\"$answer_sec_pct_rt_stat_one\">$NWB#vicidial_inbound_groups-answer_sec_pct_rt_stat_one$NWE</td></tr>\n"; + + echo "<tr bgcolor=#B6D3FC><td align=right>Stats Percent of Calls Answered Within X seconds 2: </td><td align=left><input type=text name=answer_sec_pct_rt_stat_two size=5 maxlength=5 value=\"$answer_sec_pct_rt_stat_two\">$NWB#vicidial_inbound_groups-answer_sec_pct_rt_stat_one$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=INVIA value=INVIA></td></tr>\n"; @@ -13727,7 +13768,7 @@ if ($ADD==3111) echo "</table></center><br>\n"; - echo "<a href=\"./AST_CLOSERstats.php?group=$group_id\">Clicca qui per visualizzare un report per questo gruppo inbound</a><BR><BR>\n"; + echo "<a href=\"./AST_CLOSERstats.php?group[]=$group_id\">Clicca qui per visualizzare un report per questo gruppo inbound</a><BR><BR>\n"; echo "<center><b>\n"; @@ -13969,9 +14010,10 @@ if ($ADD==311111) $stmt="SELECT * from vicidial_user_groups where user_group='$user_group';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); - $user_group = $row[0]; - $group_name = $row[1]; - $GROUP_shifts = $row[5]; + $user_group = $row[0]; + $group_name = $row[1]; + $GROUP_shifts = $row[5]; + $forced_timeclock_login = $row[6]; echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"; echo "<br>MODIFICA UN GRUPPO UTENTI<form action=$PHP_SELF method=POST>\n"; @@ -13980,6 +14022,9 @@ if ($ADD==311111) echo "<center><TABLE width=$section_width cellspacing=3>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Gruppo: </td><td align=left><input type=text name=user_group size=15 maxlength=20 value=\"$user_group\"> (senza spazi e punteggiatura)$NWB#vicidial_user_groups-user_group$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Descrizione: </td><td align=left><input type=text name=group_name size=40 maxlength=40 value=\"$group_name\"> (Descrizione del gruppo)$NWB#vicidial_user_groups-group_name$NWE</td></tr>\n"; + + echo "<tr bgcolor=#B6D3FC><td align=right>Force Timeclock Login: </td><td align=left><select size=1 name=forced_timeclock_login><option SELECTED>N</option><option>Y</option><option>ADMIN_EXEMPT</option><option SELECTED>$forced_timeclock_login</option></select>$NWB#vicidial_user_groups-forced_timeclock_login$NWE</td></tr>\n"; + echo "<tr bgcolor=#B6D3FC><td align=right>Campagne Permesse: <BR>$NWB#vicidial_user_groups-allowed_campaigns$NWE</td><td align=left>\n"; echo "$campaigns_list <BR> "; echo "</td></tr>\n"; diff --git a/LANG_www/vicidial_it/welcome.php b/LANG_www/vicidial_it/welcome.php new file mode 100644 index 00000000..cee85355 --- /dev/null +++ b/LANG_www/vicidial_it/welcome.php @@ -0,0 +1,26 @@ +<? +# welcome.php - VICIDIAL welcome page +# +# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 +# + +echo "<title>VICIDIAL Benvenuto\n"; +echo "\n"; +echo "\n"; +echo "




"; +echo ""; +echo ""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Benvenuti
 
Agent Login
 
Timeclock
 
Administration
 
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; + +?> \ No newline at end of file diff --git a/UPGRADE b/UPGRADE index 9318fe43..de0f13f6 100644 --- a/UPGRADE +++ b/UPGRADE @@ -213,6 +213,10 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom 47. Added full MySQL error logging to vicidial agent web interface. Logs are written to the webserver. +48. Added new inbound-only reporting to Real-time report as well as many new + features to existing inbound report. Created IVR stats report to show stats + on Asterisk IVRs + diff --git a/bin/AST_VDadapt.pl b/bin/AST_VDadapt.pl index 9f5884f8..dd6b44de 100644 --- a/bin/AST_VDadapt.pl +++ b/bin/AST_VDadapt.pl @@ -26,6 +26,7 @@ # 71029-1906 - Changed CLOSER-type campaign_id restriction # 81021-2201 - Deactivated queue_log QUEUESTART event # 81022-0713 - Added gathering of vicidial_inbound_groups stats(day only) +# 81108-0808 - Added more inbound stats with some debug output and added campaign agent non-pause time # # constants @@ -510,57 +511,17 @@ foreach(@campaign_id) $i++; } +if ( ($stat_count =~ /00$|50$/) || ($stat_count==1) ) + { + &launch_inbound_gather; + } + if ($RESETdiff_ratio_updater>0) {$RESETdiff_ratio_updater=0; $diff_ratio_updater=0;} if ($RESETdrop_count_updater>0) {$RESETdrop_count_updater=0; $drop_count_updater=0;} $diff_ratio_updater = ($diff_ratio_updater + $CLIdelay); $drop_count_updater = ($drop_count_updater + $CLIdelay); - - - - - - - -################################################################################ -#### BEGIN gather stats for inbound groups for the real-time display -################################################################################ -$stmtA = "SELECT group_id from vicidial_inbound_groups where active='Y';"; -$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; -$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; -$sthArows=$sthA->rows; -$ibg_count=0; -while ($sthArows > $ibg_count) - { - @aryA = $sthA->fetchrow_array; - $group_id[$ibg_count] = $aryA[0]; - $ibg_count++; - } -$sthA->finish(); -if ($DB) {print "$now_date INBOUND GROUPS TO GET STATS FOR: $ibg_count|$#group_id IT: $master_loop\n";} - - -##### LOOP THROUGH EACH INBOUND GROUP AND GATHER STATS ##### -$p=0; -foreach(@group_id) - { - &calculate_drops_inbound; - - $p++; - } - -################################################################################ -#### END gather stats for inbound groups for the real-time display -################################################################################ - - - - - - - - sleep($CLIdelay); $stat_count++; @@ -764,6 +725,9 @@ if ($DB) {print " $event_string\n";} } + + + sub calculate_drops { $camp_ANS_STAT_SQL=''; @@ -819,6 +783,7 @@ $VCScalls_one[$i]=0; $VCSanswers_one[$i]=0; $VCSdrops_one[$i]=0; $VCSdrops_one_pct[$i]=0; +$VCSagent_nonpause_time[$i]=0; # LAST ONE MINUTE CALL AND DROP STATS $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_one';"; @@ -1020,14 +985,13 @@ $stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i] $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; -$rec_count=0; -while ($sthArows > $rec_count) +if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; $VCScalls_five[$i] = "$aryA[0]"; - $rec_count++; } $sthA->finish(); + if ($VCScalls_five[$i] > 0) { # ANSWERS FIVEMINUTE @@ -1138,15 +1102,78 @@ while ($g < 4) } chop($VSCupdateSQL); -$stmtA = "UPDATE vicidial_campaign_stats SET calls_today='$VCScalls_today[$i]',answers_today='$VCSanswers_today[$i]',drops_today='$VCSdrops_today[$i]',drops_today_pct='$VCSdrops_today_pct[$i]',drops_answers_today_pct='$VCSdrops_answers_today_pct[$i]',calls_hour='$VCScalls_hour[$i]',answers_hour='$VCSanswers_hour[$i]',drops_hour='$VCSdrops_hour[$i]',drops_hour_pct='$VCSdrops_hour_pct[$i]',calls_halfhour='$VCScalls_halfhour[$i]',answers_halfhour='$VCSanswers_halfhour[$i]',drops_halfhour='$VCSdrops_halfhour[$i]',drops_halfhour_pct='$VCSdrops_halfhour_pct[$i]',calls_fivemin='$VCScalls_five[$i]',answers_fivemin='$VCSanswers_five[$i]',drops_fivemin='$VCSdrops_five[$i]',drops_fivemin_pct='$VCSdrops_five_pct[$i]',calls_onemin='$VCScalls_one[$i]',answers_onemin='$VCSanswers_one[$i]',drops_onemin='$VCSdrops_one[$i]',drops_onemin_pct='$VCSdrops_one_pct[$i]',$VSCupdateSQL where campaign_id='$campaign_id[$i]';"; +# AGENT NON-PAUSE TIME PULL +$stmtA = "SELECT sum(wait_sec + talk_sec + dispo_sec) from vicidial_agent_log where campaign_id='$campaign_id[$i]' and event_time > '$VDL_date';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] > 0) + {$VCSagent_nonpause_time[$i] = $aryA[0];} + } +$sthA->finish(); + + +$stmtA = "UPDATE vicidial_campaign_stats SET calls_today='$VCScalls_today[$i]',answers_today='$VCSanswers_today[$i]',drops_today='$VCSdrops_today[$i]',drops_today_pct='$VCSdrops_today_pct[$i]',drops_answers_today_pct='$VCSdrops_answers_today_pct[$i]',calls_hour='$VCScalls_hour[$i]',answers_hour='$VCSanswers_hour[$i]',drops_hour='$VCSdrops_hour[$i]',drops_hour_pct='$VCSdrops_hour_pct[$i]',calls_halfhour='$VCScalls_halfhour[$i]',answers_halfhour='$VCSanswers_halfhour[$i]',drops_halfhour='$VCSdrops_halfhour[$i]',drops_halfhour_pct='$VCSdrops_halfhour_pct[$i]',calls_fivemin='$VCScalls_five[$i]',answers_fivemin='$VCSanswers_five[$i]',drops_fivemin='$VCSdrops_five[$i]',drops_fivemin_pct='$VCSdrops_five_pct[$i]',calls_onemin='$VCScalls_one[$i]',answers_onemin='$VCSanswers_one[$i]',drops_onemin='$VCSdrops_one[$i]',drops_onemin_pct='$VCSdrops_one_pct[$i]',agent_non_pause_sec='$VCSagent_nonpause_time[$i]',$VSCupdateSQL where campaign_id='$campaign_id[$i]';"; $affected_rows = $dbhA->do($stmtA); if ($DBX) {print "$campaign_id[$i]|$stmtA|\n";} } +sub launch_inbound_gather +{ +################################################################################ +#### BEGIN gather stats for inbound groups for the real-time display +################################################################################ +$stmtA = "SELECT group_id from vicidial_inbound_groups where active='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$ibg_count=0; +while ($sthArows > $ibg_count) + { + @aryA = $sthA->fetchrow_array; + $group_id[$ibg_count] = $aryA[0]; + $ibg_count++; + } +$sthA->finish(); +if ($DB) {print "$now_date INBOUND GROUPS TO GET STATS FOR: $ibg_count|$#group_id IT: $master_loop\n";} + + +##### LOOP THROUGH EACH INBOUND GROUP AND GATHER STATS ##### +$p=0; +foreach(@group_id) + { + &calculate_drops_inbound; + + $p++; + } + +################################################################################ +#### END gather stats for inbound groups for the real-time display +################################################################################ +} + + + sub calculate_drops_inbound { +# GET inbound group hold stat seconds settings +$stmtA = "SELECT answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id='$group_id[$p]';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $answer_sec_pct_rt_stat_one = $aryA[0]; + $answer_sec_pct_rt_stat_two = $aryA[1]; + } +$sthA->finish(); + $camp_ANS_STAT_SQL=''; # GET LIST OF HUMAN-ANSWERED STATUSES $stmtA = "SELECT status from vicidial_statuses where human_answered='Y';"; @@ -1184,7 +1211,11 @@ $VCSanswers_today[$p]=0; $VCSdrops_today[$p]=0; $VCSdrops_today_pct[$p]=0; $VCSdrops_answers_today_pct[$p]=0; - +$answer_sec_pct_rt_stat_one_PCT[$p]=0; +$answer_sec_pct_rt_stat_two_PCT[$p]=0; +$hold_sec_answer_calls[$p]=0; +$hold_sec_drop_calls[$p]=0; +$hold_sec_queue_calls[$p]=0; # TODAY CALL AND DROP STATS $stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date';"; @@ -1202,7 +1233,7 @@ $sthA->finish(); if ($VCScalls_today[$p] > 0) { # TODAY ANSWERS - $stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status IN($camp_ANS_STAT_SQL);"; + $stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE');"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -1235,6 +1266,61 @@ if ($VCScalls_today[$p] > 0) $rec_count++; } $sthA->finish(); + + # TODAY ANSWER PERCENT OF HOLD SECONDS one and two + $stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and queue_seconds <= $answer_sec_pct_rt_stat_one;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $answer_sec_pct_rt_stat_one_PCT[$p] = $aryA[0]; + } + $sthA->finish(); + $stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and queue_seconds <= $answer_sec_pct_rt_stat_two;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $answer_sec_pct_rt_stat_two_PCT[$p] = $aryA[0]; + } + + # TODAY TOTAL HOLD TIME FOR ANSWERED CALLS + $stmtA = "SELECT sum(queue_seconds) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] > 0) + {$hold_sec_answer_calls[$p] = $aryA[0];} + } + # TODAY TOTAL HOLD TIME FOR DROP CALLS + $stmtA = "SELECT sum(queue_seconds) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status IN('DROP','XDROP');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] > 0) + {$hold_sec_drop_calls[$p] = $aryA[0];} + } + # TODAY TOTAL QUEUE TIME FOR QUEUE CALLS + $stmtA = "SELECT sum(queue_seconds) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + if ($aryA[0] > 0) + {$hold_sec_queue_calls[$p] = $aryA[0];} + } } @@ -1333,9 +1419,12 @@ if ($vcs_exists < 1) if ($DBX) {print "$group_id[$p]|$stmtA|\n";} } -$stmtA = "UPDATE vicidial_campaign_stats SET calls_today='$VCScalls_today[$p]',answers_today='$VCSanswers_today[$p]',drops_today='$VCSdrops_today[$p]',drops_today_pct='$VCSdrops_today_pct[$p]',drops_answers_today_pct='$VCSdrops_answers_today_pct[$p]',$VSCupdateSQL where campaign_id='$group_id[$p]';"; +$stmtA = "UPDATE vicidial_campaign_stats SET calls_today='$VCScalls_today[$p]',answers_today='$VCSanswers_today[$p]',drops_today='$VCSdrops_today[$p]',drops_today_pct='$VCSdrops_today_pct[$p]',drops_answers_today_pct='$VCSdrops_answers_today_pct[$p]',hold_sec_stat_one='$answer_sec_pct_rt_stat_one_PCT[$p]',hold_sec_stat_two='$answer_sec_pct_rt_stat_two_PCT[$p]',hold_sec_answer_calls='$hold_sec_answer_calls[$p]',hold_sec_drop_calls='$hold_sec_drop_calls[$p]',hold_sec_queue_calls='$hold_sec_queue_calls[$p]',$VSCupdateSQL where campaign_id='$group_id[$p]';"; $affected_rows = $dbhA->do($stmtA); if ($DBX) {print "$group_id[$p]|$stmtA|\n";} + +print " IN-GROUP: $group_id[$p] CALLS: $VCScalls_today[$p] ANSWER: $VCSanswers_today[$p] DROPS: $VCSdrops_today[$p]\n"; +print " Stat1: $answer_sec_pct_rt_stat_one_PCT[$p] Stat2: $answer_sec_pct_rt_stat_two_PCT[$p] Hold: $hold_sec_queue_calls[$p]|$hold_sec_answer_calls[$p]|$hold_sec_drop_calls[$p]\n"; } ##### END calculate_drops_inbound diff --git a/docs/BASE_INSTALL.txt b/docs/BASE_INSTALL.txt index cf2038c8..0d2eff3d 100644 --- a/docs/BASE_INSTALL.txt +++ b/docs/BASE_INSTALL.txt @@ -90,7 +90,7 @@ cd ../asterisk-1.2.30.2 - File to patch: cli.c *OPTIONAL*(1.2.14 thru 1.2.30.2) rewrite of waitforsilence - wget http://www.eflo.net/files/app_waitforsilence.c + wget http://downloads.vicidial.com/asterisk-patches/app_waitforsilence.c mv -f app_waitforsilence.c apps/app_waitforsilence.c * REQUIRED for gcc 4.2 systems* diff --git a/docs/REQUIRED_APPS_INSTALL.txt b/docs/REQUIRED_APPS_INSTALL.txt index 668eadab..db8bc7bb 100644 --- a/docs/REQUIRED_APPS_INSTALL.txt +++ b/docs/REQUIRED_APPS_INSTALL.txt @@ -406,7 +406,7 @@ patch -p1 < ./cli_chan_concise_delimiter.patch wget http://downloads.vicidial.com/asterisk-patches/1.2-gsm-gcc4.2.patch patch -p1 ./codecs/gsm/Makefile 1.2-gsm-gcc4.2.patch -wget http://www.eflo.net/files/app_waitforsilence.c +wget http://downloads.vicidial.com/asterisk-patches/app_waitforsilence.c mv -f app_waitforsilence.c apps/app_waitforsilence.c wget http://www.eflo.net/files/enter.h wget http://www.eflo.net/files/leave.h diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 0306a3e3..ceabf776 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -710,7 +710,9 @@ hold_time_option_callback_filename VARCHAR(50) default 'vm-hangup', hold_time_option_callback_list_id BIGINT(14) UNSIGNED default '999', hold_recall_xfer_group VARCHAR(20) default '---NONE---', no_delay_call_route ENUM('Y','N') default 'N', -play_welcome_message ENUM('ALWAYS','NEVER','IF_WAIT_ONLY','YES_UNLESS_NODELAY') default 'ALWAYS' +play_welcome_message ENUM('ALWAYS','NEVER','IF_WAIT_ONLY','YES_UNLESS_NODELAY') default 'ALWAYS', +answer_sec_pct_rt_stat_one SMALLINT(5) UNSIGNED default '20', +answer_sec_pct_rt_stat_two SMALLINT(5) UNSIGNED default '30' ); CREATE TABLE vicidial_stations ( @@ -941,7 +943,13 @@ status_category_count_2 INT(9) UNSIGNED default '0', status_category_3 VARCHAR(20), status_category_count_3 INT(9) UNSIGNED default '0', status_category_4 VARCHAR(20), -status_category_count_4 INT(9) UNSIGNED default '0' +status_category_count_4 INT(9) UNSIGNED default '0', +hold_sec_stat_one MEDIUMINT(8) UNSIGNED default '0', +hold_sec_stat_two MEDIUMINT(8) UNSIGNED default '0', +agent_non_pause_sec MEDIUMINT(8) UNSIGNED default '0', +hold_sec_answer_calls MEDIUMINT(8) UNSIGNED default '0', +hold_sec_drop_calls MEDIUMINT(8) UNSIGNED default '0', +hold_sec_queue_calls MEDIUMINT(8) UNSIGNED default '0' ); CREATE TABLE vicidial_dnc ( @@ -1346,8 +1354,9 @@ CREATE INDEX date_closer on vicidial_xfer_log (call_date,closer); CREATE INDEX phone_number on vicidial_xfer_log (phone_number); CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); +CREATE INDEX comment_a on live_inbound_log (comment_a); -UPDATE system_settings SET db_schema_version='1117'; +UPDATE system_settings SET db_schema_version='1118'; GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql index 2b95359d..5fe7c00a 100644 --- a/extras/upgrade_2.0.5.sql +++ b/extras/upgrade_2.0.5.sql @@ -530,3 +530,17 @@ UPDATE system_settings SET db_schema_version='1116'; ALTER TABLE vicidial_user_groups ADD forced_timeclock_login ENUM('Y','N','ADMIN_EXEMPT') default 'N'; UPDATE system_settings SET db_schema_version='1117'; + +ALTER TABLE vicidial_inbound_groups ADD answer_sec_pct_rt_stat_one SMALLINT(5) UNSIGNED default '20'; +ALTER TABLE vicidial_inbound_groups ADD answer_sec_pct_rt_stat_two SMALLINT(5) UNSIGNED default '30'; + +ALTER TABLE vicidial_campaign_stats ADD hold_sec_stat_one MEDIUMINT(8) UNSIGNED default '0'; +ALTER TABLE vicidial_campaign_stats ADD hold_sec_stat_two MEDIUMINT(8) UNSIGNED default '0'; +ALTER TABLE vicidial_campaign_stats ADD agent_non_pause_sec MEDIUMINT(8) UNSIGNED default '0'; +ALTER TABLE vicidial_campaign_stats ADD hold_sec_answer_calls MEDIUMINT(8) UNSIGNED default '0'; +ALTER TABLE vicidial_campaign_stats ADD hold_sec_drop_calls MEDIUMINT(8) UNSIGNED default '0'; +ALTER TABLE vicidial_campaign_stats ADD hold_sec_queue_calls MEDIUMINT(8) UNSIGNED default '0'; + +CREATE INDEX comment_a on live_inbound_log (comment_a); + +UPDATE system_settings SET db_schema_version='1118'; diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index 5e98c24d..bf4aac39 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -338,6 +338,8 @@ FORCE will force the agents to choose a PAUSE code if they click on the PAUSE bu 3-Way Call Dial Prefix|| Force Timeclock Login -<\/B> This option allows you to not let an agent log in to the VICIDIAL agent interface if they have not logged into the timeclock. Default is N. There is an option to exempt admin users, levels 8 and 9|| Force Timeclock Login|| +Stats Percent of Calls Answered Within X seconds - This field allows you to set the number of hold seconds that the realtime stats display will use to calculate the percentage of answered calls that were answered within X number of seconds on hold|| +Stats Percent of Calls Answered Within X seconds|| ############################################################ CLIENT diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php index 9494ce05..356b3a6f 100644 --- a/www/vicidial/AST_CLOSERstats.php +++ b/www/vicidial/AST_CLOSERstats.php @@ -271,7 +271,7 @@ if ($group_ct > 1) if ($DB) {echo "$stmt\n";} $rowx=mysql_fetch_row($rslt); - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 9999 or length_in_sec is null);"; + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $rowy=mysql_fetch_row($rslt); @@ -355,7 +355,7 @@ echo "Calls taken into the IVR for this In-Group: $IVRcalls\n"; echo "\n"; echo "---------- DROPS\n"; -$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 9999 or length_in_sec is null);"; +$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); diff --git a/www/vicidial/AST_IVRstats.php b/www/vicidial/AST_IVRstats.php index fae4e252..3a5fe5a2 100644 --- a/www/vicidial/AST_IVRstats.php +++ b/www/vicidial/AST_IVRstats.php @@ -7,6 +7,8 @@ # # 81026-2026 - First build # 81107-0341 - Added time range and option and 15-minute increment graph +# 81107-1148 - Added average times and totals +# 81108-0922 - Added no-callerID and unique caller counts # require("dbconnect.php"); @@ -254,9 +256,14 @@ echo "VICIDIAL: IVR Stats: $group_string $NOW_TIME\n"; +$TOTALcalls=0; +$NOCALLERIDcalls=0; +$UNIQUEcallers=0; +$totFLOWivr_time=0; +$totFLOWtotal_time=0; ##### Grab all records for the IVR for the specified time period -$stmt="select uniqueid,extension,start_time,comment_a,comment_b,comment_d from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) order by uniqueid,start_time;"; +$stmt="select uniqueid,extension,start_time,comment_a,comment_b,comment_d,UNIX_TIMESTAMP(start_time),phone_ext from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) order by uniqueid,start_time;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $logs_to_print = mysql_num_rows($rslt); @@ -270,11 +277,15 @@ while ($p < $logs_to_print) $comment_a[$p] = $row[3]; $comment_b[$p] = $row[4]; $comment_d[$p] = $row[5]; + $epoch[$p] = $row[6]; + $phone_ext[$p] = $row[7]; $p++; } ### create the call flow of all calls by uniqueid $last_uniqueid=''; +$first_epoch=''; +$last_epoch=''; $p=0; $r=-1; while ($p < $logs_to_print) @@ -284,10 +295,24 @@ while ($p < $logs_to_print) { $unique_calls[$r] .= "----------$comment_b[$p]"; if ($DB > 0) {echo " $r|$unique_calls[$r]\n";} + $last_epoch[$r]=$epoch[$p]; } else { $r++; + $caller_id[$r]=$phone_ext[$p]; + if (strlen($phone_ext[$p])<2) + {$NOCALLERIDcalls++;} + else + { + if (!ereg("_$phone_ext[$p]_",$unique_callerIDs)) + { + $unique_callerIDs .= "_$phone_ext[$p]_"; + $UNIQUEcallers++; + } + } + $first_epoch[$r]=$epoch[$p]; + $last_epoch[$r]=$epoch[$p]; $unique_calls[$r] = $comment_b[$p]; $FLOWuniqueid[$r] = "$uniqueid[$p]"; $last_uniqueid = "$uniqueid[$p]"; @@ -336,8 +361,11 @@ while ($s <= $p) } #### PRINT TOTAL CALLS INTO THIS IVR -echo "\nCalls taken into this IVR: $TOTALcalls\n\n"; - +echo "\n"; +echo "Calls taken into this IVR: $TOTALcalls\n"; +echo "Calls with no CallerID: $NOCALLERIDcalls\n"; +echo "Unique Callers: $UNIQUEcallers\n"; +echo "\n"; ### sort call flows for counting if ($p > 0) @@ -358,6 +386,9 @@ while ($s <= $p) if ($FLOWsummary[1] === "$RAWunique_calls[$t]") { $FLOWunique_calls_list[$s] .= "'$FLOWuniqueid[$t]',"; + if ($last_epoch[$t] <= $first_epoch[$t]) {$last_epoch[$t] = ($first_epoch[$t] + 5);} + else {$last_epoch[$t] = ($last_epoch[$t] + 10);} + $FLOWivr_time[$s] = ($FLOWivr_time[$s] + ($last_epoch[$t] - $first_epoch[$t])); } $t++; } @@ -369,9 +400,11 @@ while ($s <= $p) ### put call flows and counts together for sorting again $s=0; -echo "+--------+--------+--------+--------+\n"; -echo "| IVR | QUEUE | QDROP | QDROP% | CALL PATH\n"; -echo "+--------+--------+--------+--------+------------\n"; +echo "+--------+--------+--------+--------+------+------+\n"; +echo "| | | QUEUE | QUEUE | IVR | TOTAL|\n"; +echo "| IVR | QUEUE | DROP | DROP | AVG | AVG |\n"; +echo "| CALLS | CALLS | CALLS | PERCENT| TIME | TIME | CALL PATH\n"; +echo "+--------+--------+--------+--------+------+------+------------\n"; while ($s <= $p) { @@ -386,7 +419,7 @@ while ($s <= $p) ##### Grab all records for the IVR for the specified time period - $stmt="select status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);"; + $stmt="select status,length_in_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $vcl_statuses_to_print = mysql_num_rows($rslt); @@ -395,8 +428,9 @@ while ($s <= $p) { $row=mysql_fetch_row($rslt); $vcl_statuses[$w] = $row[0]; - if (ereg("DROP",$vcl_statuses[$w])) + if ( (ereg("DROP",$vcl_statuses[$w])) or (ereg("XDROP",$vcl_statuses[$w])) ) {$FLOWdrop[$s]++;} + $FLOWclose_time[$s] = ($FLOWclose_time[$s] + $row[1]); $FLOWtotal[$s]++; $w++; } @@ -410,14 +444,47 @@ while ($s <= $p) $FLOWdrop[$s] = sprintf("%6s", $FLOWdrop[$s]); $FLOWdropPCT[$s] = sprintf("%6s", $FLOWdropPCT[$s]); $FLOWsummary[1] = ereg_replace('----------',' / ',$FLOWsummary[1]); + $FLOWtotal_time[$s] = ($FLOWivr_time[$s] + $FLOWclose_time[$s]); - echo "| $FLOWsummary[0] | $FLOWtotal[$s] | $FLOWdrop[$s] | $FLOWdropPCT[$s]%| $FLOWsummary[1]\n"; + $avgFLOWivr_time[$s] = ($FLOWivr_time[$s] / $FLOWsummary[0]); + $avgFLOWivr_time[$s] = round($avgFLOWivr_time[$s], 0); + $avgFLOWivr_time[$s] = sprintf("%4s", $avgFLOWivr_time[$s]); + $avgFLOWtotal_time[$s] = ($FLOWtotal_time[$s] / $FLOWsummary[0]); + $avgFLOWtotal_time[$s] = round($avgFLOWtotal_time[$s], 0); + $avgFLOWtotal_time[$s] = sprintf("%4s", $avgFLOWtotal_time[$s]); + + $totFLOWtotal_time = ($totFLOWtotal_time + $FLOWtotal_time[$s]); + $totFLOWivr_time = ($totFLOWivr_time + $FLOWivr_time[$s]); + $totFLOWtotal = ($totFLOWtotal + $FLOWtotal[$s]); + $totFLOWdrop = ($totFLOWdrop + $FLOWdrop[$s]); + + echo "| $FLOWsummary[0] | $FLOWtotal[$s] | $FLOWdrop[$s] | $FLOWdropPCT[$s]%| $avgFLOWivr_time[$s] | $avgFLOWtotal_time[$s] | $FLOWsummary[1]\n"; $s++; } +$TOTALcalls = sprintf("%6s", $TOTALcalls); +$totFLOWtotal = sprintf("%6s", $totFLOWtotal); +$totFLOWdrop = sprintf("%6s", $totFLOWdrop); +if ( ($totFLOWivr_time > 0) and ($TOTALcalls > 0) ) + {$TavgFLOWivr_time = ($totFLOWivr_time / $TOTALcalls);} +$TavgFLOWivr_time = round($TavgFLOWivr_time, 0); +$TavgFLOWivr_time = sprintf("%4s", $TavgFLOWivr_time); +if ( ($totFLOWtotal_time > 0) and ($TOTALcalls > 0) ) + {$TavgFLOWtotal_time = ($totFLOWtotal_time / $TOTALcalls);} +$TavgFLOWtotal_time = round($TavgFLOWtotal_time, 0); +$TavgFLOWtotal_time = sprintf("%4s", $TavgFLOWtotal_time); +if ( ($totFLOWtotal < 1) or ($totFLOWdrop < 1) ) + {$totFLOWdropPCT = '0';} +else + { + $totFLOWdropPCT = (($totFLOWdrop / $totFLOWtotal) * 100); + $totFLOWdropPCT = round($totFLOWdropPCT, 0); + } +$totFLOWdropPCT = sprintf("%5s", $totFLOWdropPCT); -echo "+--------+--------+--------+--------+\n"; - +echo "+--------+--------+--------+--------+------+------+------------\n"; +echo "| $TOTALcalls | $totFLOWtotal | $totFLOWdrop | $totFLOWdropPCT% | $TavgFLOWivr_time | $TavgFLOWtotal_time |\n"; +echo "+--------+--------+--------+--------+------+------+\n"; diff --git a/www/vicidial/AST_agent_performance_detail.php b/www/vicidial/AST_agent_performance_detail.php index 079187da..d329d3ca 100644 --- a/www/vicidial/AST_agent_performance_detail.php +++ b/www/vicidial/AST_agent_performance_detail.php @@ -13,6 +13,7 @@ # 80712-1007 - tally bug fixes and time display change # 81030-0346 - Added pause code stats # 81030-1924 - Added total non-pause and total logged-in time to pause code section +# 81108-0716 - fixed user same-name bug # require("dbconnect.php"); @@ -210,7 +211,7 @@ $usersARY[0]=''; $user_namesARY[0]=''; $k=0; -$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by full_name,status desc limit 500000;"; +$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by user,full_name,status order by full_name,user,status desc limit 500000;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $rows_to_print = mysql_num_rows($rslt); @@ -600,7 +601,7 @@ $PCusers='-'; $PCusersARY=$MT; $PCuser_namesARY=$MT; $k=0; -$stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 $ugSQL group by full_name,sub_status order by full_name,sub_status desc limit 100000;"; +$stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 $ugSQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $subs_to_print = mysql_num_rows($rslt); diff --git a/www/vicidial/AST_timeonVDADall.php b/www/vicidial/AST_timeonVDADall.php index 83b2786b..31bae44d 100644 --- a/www/vicidial/AST_timeonVDADall.php +++ b/www/vicidial/AST_timeonVDADall.php @@ -41,6 +41,7 @@ # 81022-1500 - Added inbound call stats display option # 81029-1023 - Changed drop percent calculation for multi-stat reports # 81029-1706 - Added pause code display if enabled per campaign +# 81108-2337 - Added inbound-only section # header ("Content-type: text/html; charset=utf-8"); @@ -117,7 +118,7 @@ if (!isset($PHONEdisplay)) {$PHONEdisplay=0;} # 0=no, 1=yes if (!isset($CUSTPHONEdisplay)) {$CUSTPHONEdisplay=0;} # 0=no, 1=yes if (!isset($with_inbound)) {$with_inbound='N';} # 0=no, 1=yes if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes - +$ingroup_detail=''; function get_server_load($windows = false) { $os = strtolower(PHP_OS); @@ -314,9 +315,15 @@ if ($UGdisplay > 0) if (!eregi('XXXX-ALL-ACTIVE-XXXX', $group)) { echo "   Inbound:         \n"; echo "STOP | "; @@ -340,89 +347,167 @@ else { $multi_drop=0; -if ($group=='XXXX-ALL-ACTIVE-XXXX') +##### INBOUND ONLY ### +if (ereg('O',$with_inbound)) { $multi_drop++; - $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active) from vicidial_campaigns;"; + $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaignsSQL = "'$closer_campaigns'"; + if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} - $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; - } -else - { - if ($DB > 0) {echo "\n|$with_inbound|$campaign_allow_inbound|\n";} - - if ( (ereg('Y',$with_inbound)) and ($campaign_allow_inbound > 0) ) + if ($adastats>1) { - $multi_drop++; - $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; - $rslt=mysql_query($stmt, $link); + $stmtB="select calls_today,drops_today,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4,hold_sec_stat_one,hold_sec_stat_two,hold_sec_answer_calls,hold_sec_drop_calls,hold_sec_queue_calls,campaign_id from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL);"; + + if ($DB > 0) {echo "\n|$stmtB|\n";} + + $r=0; + $rslt=mysql_query($stmtB, $link); + $ingroups_to_print = mysql_num_rows($rslt); + if ($ingroups_to_print > 0) + {$ingroup_detail .= "";} + while ($ingroups_to_print > $r) + { $row=mysql_fetch_row($rslt); - $closer_campaigns = $row[0]; - $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); - $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); - $closer_campaignsSQL = "'$closer_campaigns'"; - if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} + $callsTODAY = $row[0]; + $dropsTODAY = $row[1]; + $answersTODAY = $row[2]; + $VSCcat1 = $row[3]; + $VSCcat1tally = $row[4]; + $VSCcat2 = $row[5]; + $VSCcat2tally = $row[6]; + $VSCcat3 = $row[7]; + $VSCcat3tally = $row[8]; + $VSCcat4 = $row[9]; + $VSCcat4tally = $row[10]; + $hold_sec_stat_one = $row[11]; + $hold_sec_stat_two = $row[12]; + $hold_sec_answer_calls = $row[13]; + $hold_sec_drop_calls = $row[14]; + $hold_sec_queue_calls = $row[15]; + $ingroupdetail = $row[16]; + if ( ($dropsTODAY > 0) and ($answersTODAY > 0) ) + { + $drpctTODAY = ( ($dropsTODAY / $answersTODAY) * 100); + $drpctTODAY = round($drpctTODAY, 2); + $drpctTODAY = sprintf("%01.2f", $drpctTODAY); + } + else + {$drpctTODAY=0;} - $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + if ($callsTODAY > 0) + { + $AVGhold_sec_queue_calls = ($hold_sec_queue_calls / $callsTODAY); + $AVGhold_sec_queue_calls = round($AVGhold_sec_queue_calls, 0); + } + else + {$AVGhold_sec_queue_calls=0;} + + if ($dropsTODAY > 0) + { + $AVGhold_sec_drop_calls = ($hold_sec_drop_calls / $dropsTODAY); + $AVGhold_sec_drop_calls = round($AVGhold_sec_drop_calls, 0); + } + else + {$AVGhold_sec_drop_calls=0;} + + if ($answersTODAY > 0) + { + $PCThold_sec_stat_one = ( ($hold_sec_stat_one / $answersTODAY) * 100); + $PCThold_sec_stat_one = round($PCThold_sec_stat_one, 2); + $PCThold_sec_stat_one = sprintf("%01.2f", $PCThold_sec_stat_one); + $PCThold_sec_stat_two = ( ($hold_sec_stat_two / $answersTODAY) * 100); + $PCThold_sec_stat_two = round($PCThold_sec_stat_two, 2); + $PCThold_sec_stat_two = sprintf("%01.2f", $PCThold_sec_stat_two); + $AVGhold_sec_answer_calls = ($hold_sec_answer_calls / $answersTODAY); + $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); + if ($agent_non_pause_sec > 0) + { + $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); + $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); + } + else + {$AVG_ANSWERagent_non_pause_sec=0;} + } + else + { + $PCThold_sec_stat_one=0; + $PCThold_sec_stat_two=0; + $AVGhold_sec_answer_calls=0; + $AVG_ANSWERagent_non_pause_sec=0; + } + + if (ereg("0$|2$|4$|6$|8$",$r)) {$bgcolor='#E6E6E6';} + else {$bgcolor='white';} + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + $ingroup_detail .= ""; + + $r++; + } + + if ($ingroups_to_print > 0) + {$ingroup_detail .= "
        $ingroupdetail   CALLS TODAY:  $callsTODAY    TMA 1:  $PCThold_sec_stat_one%     Average Hold time for Answered Calls:  $AVGhold_sec_answer_calls  
DROPS TODAY:  $dropsTODAY    TMA 2:  $PCThold_sec_stat_two%     Average Hold time for Dropped Calls:  $AVGhold_sec_drop_calls  
ANSWERS TODAY:  $answersTODAY    DROP PERCENT:  $drpctTODAY%    Average Hold time for All Calls:  $AVGhold_sec_queue_calls  
";} - $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; } - else - { - $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; - $stmtB="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; - } - } -if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";} + $stmt="select agent_pause_codes_active from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; -$rslt=mysql_query($stmt, $link); -$row=mysql_fetch_row($rslt); -$DIALlev = $row[0]; -$DIALstatusA = $row[1]; -$DIALstatusB = $row[2]; -$DIALstatusC = $row[3]; -$DIALstatusD = $row[4]; -$DIALstatusE = $row[5]; -$DIALorder = $row[6]; -$DIALfilter = $row[7]; -$HOPlev = $row[8]; -$DIALmethod = $row[9]; -$maxDIALlev = $row[10]; -$DROPmax = $row[11]; -$targetDIFF = $row[12]; -$ADAintense = $row[13]; -$ADAavailonly = $row[14]; -$TAPERtime = $row[15]; -$CALLtime = $row[16]; -$DIALtimeout = $row[17]; -$DIALstatuses = $row[18]; - $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); - $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); -$agent_pause_codes_active = $row[19]; + $stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL);"; + + $stmtC="select agent_non_pause_sec from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; -$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; -if ($group=='XXXX-ALL-ACTIVE-XXXX') - { - $stmt="select count(*) from vicidial_hopper;"; - } -$rslt=mysql_query($stmt, $link); -$row=mysql_fetch_row($rslt); -$VDhop = $row[0]; + if ($DB > 0) {echo "\n|$stmt|$stmtB|$stmtC|\n";} -$rslt=mysql_query($stmtB, $link); -$row=mysql_fetch_row($rslt); -$DAleads = $row[0]; -$callsTODAY = $row[1]; -$dropsTODAY = $row[2]; -$drpctTODAY = $row[3]; -$diffONEMIN = $row[4]; -$agentsONEMIN = $row[5]; -$balanceFILL = $row[6]; -$answersTODAY = $row[7]; -if ($multi_drop > 0) - { + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $agent_pause_codes_active = $row[0]; + + $rslt=mysql_query($stmtC, $link); + $row=mysql_fetch_row($rslt); + $agent_non_pause_sec = $row[0]; + + $rslt=mysql_query($stmtB, $link); + $row=mysql_fetch_row($rslt); + $callsTODAY = $row[0]; + $dropsTODAY = $row[1]; + $answersTODAY = $row[2]; + $VSCcat1 = $row[3]; + $VSCcat1tally = $row[4]; + $VSCcat2 = $row[5]; + $VSCcat2tally = $row[6]; + $VSCcat3 = $row[7]; + $VSCcat3tally = $row[8]; + $VSCcat4 = $row[9]; + $VSCcat4tally = $row[10]; + $hold_sec_stat_one = $row[11]; + $hold_sec_stat_two = $row[12]; + $hold_sec_answer_calls = $row[13]; + $hold_sec_drop_calls = $row[14]; + $hold_sec_queue_calls = $row[15]; if ( ($dropsTODAY > 0) and ($answersTODAY > 0) ) { $drpctTODAY = ( ($dropsTODAY / $answersTODAY) * 100); @@ -431,86 +516,253 @@ if ($multi_drop > 0) } else {$drpctTODAY=0;} - } -$VSCcat1 = $row[8]; -$VSCcat1tally = $row[9]; -$VSCcat2 = $row[10]; -$VSCcat2tally = $row[11]; -$VSCcat3 = $row[12]; -$VSCcat3tally = $row[13]; -$VSCcat4 = $row[14]; -$VSCcat4tally = $row[15]; -if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) - { - $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); - $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); - } -else {$diffpctONEMIN = '0.00';} + if ($callsTODAY > 0) + { + $AVGhold_sec_queue_calls = ($hold_sec_queue_calls / $callsTODAY); + $AVGhold_sec_queue_calls = round($AVGhold_sec_queue_calls, 0); + } + else + {$AVGhold_sec_queue_calls=0;} -$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; -if ($group=='XXXX-ALL-ACTIVE-XXXX') - { - $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; - } -$rslt=mysql_query($stmt, $link); -$row=mysql_fetch_row($rslt); -$balanceSHORT = $row[0]; + if ($dropsTODAY > 0) + { + $AVGhold_sec_drop_calls = ($hold_sec_drop_calls / $dropsTODAY); + $AVGhold_sec_drop_calls = round($AVGhold_sec_drop_calls, 0); + } + else + {$AVGhold_sec_drop_calls=0;} -echo "
"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; + if ($answersTODAY > 0) + { + $PCThold_sec_stat_one = ( ($hold_sec_stat_one / $answersTODAY) * 100); + $PCThold_sec_stat_one = round($PCThold_sec_stat_one, 2); + $PCThold_sec_stat_one = sprintf("%01.2f", $PCThold_sec_stat_one); + $PCThold_sec_stat_two = ( ($hold_sec_stat_two / $answersTODAY) * 100); + $PCThold_sec_stat_two = round($PCThold_sec_stat_two, 2); + $PCThold_sec_stat_two = sprintf("%01.2f", $PCThold_sec_stat_two); + $AVGhold_sec_answer_calls = ($hold_sec_answer_calls / $answersTODAY); + $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); + if ($agent_non_pause_sec > 0) + { + $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); + $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); + } + else + {$AVG_ANSWERagent_non_pause_sec=0;} + } + else + { + $PCThold_sec_stat_one=0; + $PCThold_sec_stat_two=0; + $AVGhold_sec_answer_calls=0; + $AVG_ANSWERagent_non_pause_sec=0; + } -if ($adastats>1) - { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; } -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; - -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; - -echo ""; -echo ""; -echo ""; + { + if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $multi_drop++; + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active) from vicidial_campaigns;"; + + $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;"; + } + else + { + if ($DB > 0) {echo "\n|$with_inbound|$campaign_allow_inbound|\n";} + + if ( (ereg('Y',$with_inbound)) and ($campaign_allow_inbound > 0) ) + { + $multi_drop++; + $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaignsSQL = "'$closer_campaigns'"; + if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} + + $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + + $stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + } + else + { + $stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + + $stmtB="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + } + } + if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";} + + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $DIALlev = $row[0]; + $DIALstatusA = $row[1]; + $DIALstatusB = $row[2]; + $DIALstatusC = $row[3]; + $DIALstatusD = $row[4]; + $DIALstatusE = $row[5]; + $DIALorder = $row[6]; + $DIALfilter = $row[7]; + $HOPlev = $row[8]; + $DIALmethod = $row[9]; + $maxDIALlev = $row[10]; + $DROPmax = $row[11]; + $targetDIFF = $row[12]; + $ADAintense = $row[13]; + $ADAavailonly = $row[14]; + $TAPERtime = $row[15]; + $CALLtime = $row[16]; + $DIALtimeout = $row[17]; + $DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); + $agent_pause_codes_active = $row[19]; + $stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; + if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select count(*) from vicidial_hopper;"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VDhop = $row[0]; + + $rslt=mysql_query($stmtB, $link); + $row=mysql_fetch_row($rslt); + $DAleads = $row[0]; + $callsTODAY = $row[1]; + $dropsTODAY = $row[2]; + $drpctTODAY = $row[3]; + $diffONEMIN = $row[4]; + $agentsONEMIN = $row[5]; + $balanceFILL = $row[6]; + $answersTODAY = $row[7]; + if ($multi_drop > 0) + { + if ( ($dropsTODAY > 0) and ($answersTODAY > 0) ) + { + $drpctTODAY = ( ($dropsTODAY / $answersTODAY) * 100); + $drpctTODAY = round($drpctTODAY, 2); + $drpctTODAY = sprintf("%01.2f", $drpctTODAY); + } + else + {$drpctTODAY=0;} + } + $VSCcat1 = $row[8]; + $VSCcat1tally = $row[9]; + $VSCcat2 = $row[10]; + $VSCcat2tally = $row[11]; + $VSCcat3 = $row[12]; + $VSCcat3tally = $row[13]; + $VSCcat4 = $row[14]; + $VSCcat4tally = $row[15]; + + if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) ) + { + $diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100); + $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); + } + else {$diffpctONEMIN = '0.00';} + + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + if ($group=='XXXX-ALL-ACTIVE-XXXX') + { + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; + } + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $balanceSHORT = $row[0]; + + echo "
CALLS TODAY:  $callsTODAY    TMA 1:  $PCThold_sec_stat_one%     Average Hold time for Answered Calls:  $AVGhold_sec_answer_calls   TIME:   $NOW_TIME
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DROPS TODAY:  $dropsTODAY    TMA 2:  $PCThold_sec_stat_two%     Average Hold time for Dropped Calls:  $AVGhold_sec_drop_calls  
ANSWERS TODAY:  $answersTODAY    (Agent non-pause time / Answers)Average Hold time for All Calls:  $AVGhold_sec_queue_calls  
DROP PERCENT:  $drpctTODAY%    PRODUCTIVITY:  $AVG_ANSWERagent_non_pause_sec    
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; -if ($drpctTODAY >= $DROPmax) - {echo "$drpctTODAY%";} +##### NOT INBOUND ONLY ### else - {echo "$drpctTODAY%";} -echo "    
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($adastats>1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; -echo ""; -echo ""; -echo ""; + echo ""; + echo ""; + echo ""; + } echo ""; echo ""; echo ""; echo "
DIAL LEVEL:  $DIALlev    TRUNK SHORT/FILL:  $balanceSHORT / $balanceFILL     FILTER:  $DIALfilter   TIME:   $NOW_TIME
- min   MAX LEVEL:  $maxDIALlev   DROPPED MAX:  $DROPmax%    TARGET DIFF:  $targetDIFF     INTENSITY:  $ADAintense    
DIAL TIMEOUT:  $DIALtimeout  TAPER TIME:  $TAPERtime  LOCAL TIME:  $CALLtime  AVAIL ONLY:  $ADAavailonly  
DIALABLE LEADS:  $DAleads     CALLS TODAY:  $callsTODAY     AVG AGENTS:  $agentsONEMIN     DIAL METHOD:  $DIALmethod    
HOPPER LEVEL:  $HOPlev     DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   DL DIFF:  $diffONEMIN     STATUSES:  $DIALstatuses    
LEADS IN HOPPER:  $VDhop     DROPPED PERCENT:  "; + if ($drpctTODAY >= $DROPmax) + {echo "$drpctTODAY%";} + else + {echo "$drpctTODAY%";} + echo "    DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
DIFF:  $diffpctONEMIN%     ORDER:  $DIALorder    
"; @@ -526,9 +778,15 @@ echo "
"; +echo "$ingroup_detail"; + if ($adastats<2) { - echo "+ VIEW MORE SETTINGS"; + echo "+ VIEW MORE"; + } +else + { + echo "+ VIEW LESS"; } if ($UGdisplay>0) { diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 2092a8af..df5bf791 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -849,6 +849,10 @@ if (isset($_GET["three_way_dial_prefix"])) {$three_way_dial_prefix=$_GET["thre elseif (isset($_POST["three_way_dial_prefix"])) {$three_way_dial_prefix=$_POST["three_way_dial_prefix"];} if (isset($_GET["forced_timeclock_login"])) {$forced_timeclock_login=$_GET["forced_timeclock_login"];} elseif (isset($_POST["forced_timeclock_login"])) {$forced_timeclock_login=$_POST["forced_timeclock_login"];} +if (isset($_GET["answer_sec_pct_rt_stat_one"])) {$answer_sec_pct_rt_stat_one=$_GET["answer_sec_pct_rt_stat_one"];} + elseif (isset($_POST["answer_sec_pct_rt_stat_one"])) {$answer_sec_pct_rt_stat_one=$_POST["answer_sec_pct_rt_stat_one"];} +if (isset($_GET["answer_sec_pct_rt_stat_two"])) {$answer_sec_pct_rt_stat_two=$_GET["answer_sec_pct_rt_stat_two"];} + elseif (isset($_POST["answer_sec_pct_rt_stat_two"])) {$answer_sec_pct_rt_stat_two=$_POST["answer_sec_pct_rt_stat_two"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -1019,6 +1023,8 @@ $did_id = ereg_replace("[^0-9]","",$did_id); $source_did = ereg_replace("[^0-9]","",$source_did); $modify_inbound_dids = ereg_replace("[^0-9]","",$modify_inbound_dids); $delete_inbound_dids = ereg_replace("[^0-9]","",$delete_inbound_dids); +$answer_sec_pct_rt_stat_one = ereg_replace("[^0-9]","",$answer_sec_pct_rt_stat_one); +$answer_sec_pct_rt_stat_two = ereg_replace("[^0-9]","",$answer_sec_pct_rt_stat_two); ### DIGITS and COLONS $shift_length = ereg_replace("[^\:0-9]","",$shift_length); @@ -1468,11 +1474,12 @@ $survey_camp_record_dir = ereg_replace(";","",$survey_camp_record_dir); # 81030-0348 - Added campaign pause code force option # 81030-2228 - Fixed DIDs creation issue # 81103-1408 - Added 3way call dial prefix option +# 81107-1551 - Added Stats Percent of Calls Answered Within X seconds fields to in-groups # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.5-148'; -$build = '81103-1408'; +$admin_version = '2.0.5-149'; +$build = '81107-1551'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -3358,6 +3365,11 @@ echo "\n"; echo "\n"; + + echo "\n"; + + echo "\n"; echo "\n";
No Delay Call Route - Setting this to Y will remove all wait times and audio prompts and attempt to send the call right to an agent. Does not override welcome message or on hold prompt settings. Default is N. +
+ +
+Stats Percent of Calls Answered Within X seconds - This field allows you to set the number of hold seconds that the realtime stats display will use to calculate the percentage of answered calls that were answered within X number of seconds on hold. + @@ -6691,7 +6703,7 @@ if ($ADD==2011) } else { - $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id=\"$source_group_id\";"; $rslt=mysql_query($stmt, $link); echo "
GROUP ADDED: $group_id\n"; @@ -8425,7 +8437,7 @@ if ($ADD==4111) echo "
GROUP MODIFIED: $group_id\n"; - $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message' where group_id='$group_id';"; + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysql_real_escape_string($web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message',answer_sec_pct_rt_stat_one='$answer_sec_pct_rt_stat_one',answer_sec_pct_rt_stat_two='$answer_sec_pct_rt_stat_two' where group_id='$group_id';"; $rslt=mysql_query($stmt, $link); ### LOG CHANGES TO LOG FILE ### @@ -13416,6 +13428,8 @@ if ($ADD==3111) $hold_recall_xfer_group = $row[50]; $no_delay_call_route = $row[51]; $play_welcome_message = $row[52]; + $answer_sec_pct_rt_stat_one = $row[53]; + $answer_sec_pct_rt_stat_two = $row[54]; ##### get in-groups listings for dynamic pulldown $stmt="SELECT group_id,group_name from vicidial_inbound_groups where group_id NOT IN('AGENTDIRECT') order by group_id"; @@ -13615,6 +13629,10 @@ if ($ADD==3111) echo "
In-Group Recording Override: $NWB#vicidial_inbound_groups-ingroup_recording_override$NWE
In-Group Recording Filename: $NWB#vicidial_inbound_groups-ingroup_rec_filename$NWE
Stats Percent of Calls Answered Within X seconds 1: $NWB#vicidial_inbound_groups-answer_sec_pct_rt_stat_one$NWE
Stats Percent of Calls Answered Within X seconds 2: $NWB#vicidial_inbound_groups-answer_sec_pct_rt_stat_one$NWE