From 2d9ccbcf935d1b9993a5afffbfb305b4a1f27338 Mon Sep 17 00:00:00 2001 From: mattf Date: Sat, 21 Jun 2014 20:06:03 +0000 Subject: [PATCH] Added update_settings agent call to grab selected user and campaign settings more frequently without having to log agent out and back in. git-svn-id: svn://192.168.202.10@2134 3d104415-ff17-0410-8863-d5cf3c621b8a --- www/agc/vdc_db_query.php | 79 ++++++++++++++++++++++++++++++++++++-- www/agc/vicidial.php | 82 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 155 insertions(+), 6 deletions(-) diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 1a7b612e..9c163bac 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -356,12 +356,13 @@ # 140520-1957 - Fixed security_phrase variable label issues, fixed owner only dialing SQL inefficiency # 140610-1519 - Fixed issue with manual dial wait_sec being inflated in Asterisk 1.8 # 140617-1044 - Fixed issue with non-latin, issue #773 +# 140621-1544 - Added update_settings function # -$version = '2.8-252'; -$build = '140617-1044'; +$version = '2.10-253'; +$build = '140621-1544'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=591; +$mysql_log_count=594; $one_mysql_log=0; require_once("dbconnect_mysqli.php"); @@ -1485,6 +1486,78 @@ if ($ACTION == 'UpdateFields') } +################################################################################ +### update_settings - sends current vicidial_user and vicidial_campaigns settings +################################################################################ +if ($ACTION == 'update_settings') + { + $SettingS_InfO=''; + $stmt="SELECT count(*) from vicidial_live_agents where user='$user';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00592',$user,$server_ip,$session_name,$one_mysql_log);} + $vla_records = mysqli_num_rows($rslt); + if ($vla_records > 0) + { + $rowx=mysqli_fetch_row($rslt); + $agent_count = $rowx[0]; + $SettingS_InfO .= "Agent Session: $agent_count\n"; + + ##### grab the data from vicidial_users for the user + $stmt="SELECT wrapup_seconds_override FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00593',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $user_set_ct = mysqli_num_rows($rslt); + if ($user_set_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $wrapup_seconds_override = trim("$row[0]"); + + + ##### grab the data from vicidial_users for the user + $stmt="SELECT wrapup_seconds,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo,dial_timeout FROM vicidial_campaigns where campaign_id='$campaign' LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00594',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_set_ct = mysqli_num_rows($rslt); + if ($camp_set_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $wrapup_seconds = trim("$row[0]"); + $dead_max = trim("$row[1]"); + $dispo_max = trim("$row[2]"); + $pause_max = trim("$row[3]"); + $dead_max_dispo = trim("$row[4]"); + $dispo_max_dispo = trim("$row[5]"); + $dial_timeout = trim("$row[6]"); + } + + if ($wrapup_seconds_override >= 0) + {$wrapup_seconds = $wrapup_seconds_override;} + if ( ($pause_max < 10) or (strlen($pause_max)<2) ) + {$pause_max=0;} + if ( ($pause_max > 9) and ($pause_max <= $dial_timeout) ) + {$pause_max = ($dial_timeout + 10);} + + $SettingS_InfO .= "SETTINGS GATHERED\n"; + $SettingS_InfO .= "wrapup_seconds: " . $wrapup_seconds . "\n"; + $SettingS_InfO .= "dead_max: " . $dead_max . "\n"; + $SettingS_InfO .= "dispo_max: " . $dispo_max . "\n"; + $SettingS_InfO .= "pause_max: " . $pause_max . "\n"; + $SettingS_InfO .= "dead_max_dispo: " . $dead_max_dispo . "\n"; + $SettingS_InfO .= "dispo_max_dispo: " . $dispo_max_dispo . "\n"; + $SettingS_InfO .= "dial_timeout: " . $dial_timeout . "\n"; + $SettingS_InfO .= "\n"; + } + echo $SettingS_InfO; + } + else + { + echo "ERROR: no agent session\n"; + } + } + + ################################################################################ ### manDiaLnextCaLL - for manual VICIDiaL dialing this will grab the next lead ### in the campaign, reserve it, send data back to client and diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 0deca2c2..39dbdb7e 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -434,10 +434,11 @@ # 140612-2152 - branched 2.9 version, raised trunk to 2.10 # 140617-1041 - Fixed issue with non-latin, issue #773 # 140617-2015 - Added vicidial_users wrapup_seconds_override option +# 140621-1557 - Added update_settings call to grab selected user and campaign settings more frequently # -$version = '2.10-404c'; -$build = '140617-2015'; +$version = '2.10-405c'; +$build = '140621-1557'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=80; $one_mysql_log=0; @@ -3879,6 +3880,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var dead_auto_dispo_count=0; var dead_auto_dispo_finish=0; var cid_lock=0; + var UpdatESettingSChecK=0; var manual_dial_search_checkbox=''; var hide_call_log_info=''; var DiaLControl_auto_HTML = "\"\"Resume\""; @@ -7442,6 +7444,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Send the Manual Dial Next Number request function ManualDialNext(mdnCBid,mdnBDleadid,mdnDiaLCodE,mdnPhonENumbeR,mdnStagE,mdVendorid,mdgroupalias,mdtype) { + UpdatESettingS(); if (waiting_on_dispo > 0) { alert_box("System Delay, Please try again
code:" + agent_log_id + " - " + waiting_on_dispo + ""); @@ -8023,6 +8026,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Send the Manual Dial Only - dial the previewed lead function ManualDialOnly(taskaltnum) { + UpdatESettingS(); in_lead_preview_state=0; inOUT = 'OUT'; alt_dial_status_display = 0; @@ -8534,6 +8538,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // alert(xmlhttprequestcheckauto.responseText); AutoDialWaiting = 0; QUEUEpadding = 0; + UpdatESettingSChecK = 1; var VDIC_data_VDAC=check_VDIC_array[1].split("|"); VDIC_web_form_address = VICIDiaL_web_form_address @@ -9079,7 +9084,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { // alert(xmlhttprequestcheckemail.responseText); AutoDialWaiting = 0; - + UpdatESettingSChecK = 1; + var VDIC_data_VDAC=check_VDIC_array[1].split("|"); VDIC_web_form_address = VICIDiaL_web_form_address VDIC_web_form_address_two = VICIDiaL_web_form_address_two @@ -11008,6 +11014,71 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } +// ################################################################################ +// Update selected user and campaign settings + function UpdatESettingS() + { + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + VUVCsettings_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=update_settings&format=text&agent_log_id=" + agent_log_id + "&campaign=" + campaign; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(VUVCsettings_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var update_settings_content = null; + var update_settings_content = xmlhttp.responseText; + var settings_array=update_settings_content.split("\n"); + if (settings_array[0] == 'Agent Session: 1') + { + if (settings_array[1] == 'SETTINGS GATHERED') + { + var wrapup_seconds_array=settings_array[2].split("wrapup_seconds: "); + wrapup_seconds=wrapup_seconds_array[1]; + var dead_max_array=settings_array[3].split("dead_max: "); + dead_max=dead_max_array[1]; + var dispo_max_array=settings_array[4].split("dispo_max: "); + dispo_max=dispo_max_array[1]; + var pause_max_array=settings_array[5].split("pause_max: "); + pause_max=pause_max_array[1]; + var dead_max_dispo_array=settings_array[6].split("dead_max_dispo: "); + dead_max_dispo=dead_max_dispo_array[1]; + var dispo_max_dispo_array=settings_array[7].split("dispo_max_dispo: "); + dispo_max_dispo=dispo_max_dispo_array[1]; + var dial_timeout_array=settings_array[8].split("dial_timeout: "); + dial_timeout=dial_timeout_array[1]; + } + } + // alert(VUVCsettings_query); + // alert(xmlhttp.responseText + "\n|" + settings_array[1] + "\n|" + settings_array[2] + "|" + wrapup_seconds + "|" + pause_max + "|" + dial_timeout); + } + } + delete xmlhttp; + } + } + + // ################################################################################ // Populate the dtmf and xfer number for each preset link in xfer-conf frame function DtMf_PreSet_a() @@ -13844,6 +13915,11 @@ function phone_number_format(formatphone) { vcFormIFrame.document.form_custom_fields.submit(); } } + if (UpdatESettingSChecK > 0) + { + UpdatESettingSChecK=0; + UpdatESettingS(); + } if (AgentDispoing > 0) { WaitingForNextStep=1;