diff --git a/LANG_www/agc_el/calendar.css b/LANG_www/agc_el/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/LANG_www/agc_el/calendar.css @@ -0,0 +1,95 @@ +/* calendar icon */ +img.tcalIcon { + cursor: pointer; + margin-left: 1px; + vertical-align: middle; +} +/* calendar container element */ +div#tcal { + position: absolute; + visibility: hidden; + z-index: 100; + width: 158px; + padding: 2px 0 0 0; +} +/* all tables in calendar */ +div#tcal table { + width: 100%; + border: 1px solid silver; + border-collapse: collapse; + background-color: white; +} +/* navigation table */ +div#tcal table.ctrl { + border-bottom: 0; +} +/* navigation buttons */ +div#tcal table.ctrl td { + width: 15px; + height: 20px; +} +/* month year header */ +div#tcal table.ctrl th { + background-color: white; + color: black; + border: 0; +} +/* week days header */ +div#tcal th { + border: 1px solid silver; + border-collapse: collapse; + text-align: center; + padding: 3px 0; + font-family: tahoma, verdana, arial; + font-size: 10px; + background-color: gray; + color: white; +} +/* date cells */ +div#tcal td { + border: 0; + border-collapse: collapse; + text-align: center; + padding: 2px 0; + font-family: tahoma, verdana, arial; + font-size: 11px; + width: 22px; + cursor: pointer; +} +/* date highlight + in case of conflicting settings order here determines the priority from least to most important */ +div#tcal td.othermonth { + color: silver; +} +div#tcal td.weekend { + background-color: #ACD6F5; +} +div#tcal td.today { + border: 1px solid red; +} +div#tcal td.selected { + background-color: #FFB3BE; +} +/* iframe element used to suppress windowed controls in IE5/6 */ +iframe#tcalIF { + position: absolute; + visibility: hidden; + z-index: 98; + border: 0; +} +/* transparent shadow */ +div#tcalShade { + position: absolute; + visibility: hidden; + z-index: 99; +} +div#tcalShade table { + border: 0; + border-collapse: collapse; + width: 100%; +} +div#tcalShade table td { + border: 0; + border-collapse: collapse; + padding: 0; +} diff --git a/LANG_www/agc_el/calendar_db.js b/LANG_www/agc_el/calendar_db.js new file mode 100644 index 00000000..14828ed7 --- /dev/null +++ b/LANG_www/agc_el/calendar_db.js @@ -0,0 +1,335 @@ +// Tigra Calendar v4.0.2 (2009-01-12) Database (yyyy-mm-dd) +// http://www.softcomplex.com/products/tigra_calendar/ +// Public Domain Software... You're welcome. + +// default settins +var A_TCALDEF = { + 'months' : ['Φεβρουάριος', 'February', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'], + 'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], + 'yearscroll': true, // show year scroller + 'weekstart': 0, // first day of week: 0-Su or 1-Mo + 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx. + 'imgpath' : '../agc/images/' // directory with calendar images +} +// date parsing function +function f_tcalParseDate (s_date) { + + var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/; + if (!re_date.exec(s_date)) + return alert ("Ακυρο date: '" + s_date + "'.\nAccepted format is yyyy-mm-dd.") + var n_day = Number(RegExp.$3), + n_month = Number(RegExp.$2), + n_year = Number(RegExp.$1); + + if (n_year < 100) + n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900); + if (n_month < 1 || n_month > 12) + return alert ("Ακυρο month value: '" + n_month + "'.\nAllowed range is 01-12."); + var d_numdays = new Date(n_year, n_month, 0); + if (n_day > d_numdays.getDate()) + return alert("Ακυρο day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + "."); + + return new Date (n_year, n_month - 1, n_day); +} +// date generating function +function f_tcalGenerDate (d_date) { + return ( + d_date.getFullYear() + "-" + + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-" + + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + ); +} + +// implementation +function tcal (a_cfg, a_tpl) { + + // apply default template if not specified + if (!a_tpl) + a_tpl = A_TCALDEF; + + // register in global collections + if (!window.A_TCALS) + window.A_TCALS = []; + if (!window.A_TCALSIDX) + window.A_TCALSIDX = []; + + this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length; + window.A_TCALS[this.s_id] = this; + window.A_TCALSIDX[window.A_TCALSIDX.length] = this; + + // assign methods + this.f_show = f_tcal_show; + this.f_hide = f_tcal_hide; + this.f_toggle = f_tcalToggle; + this.f_update = f_tcalUpdate; + this.f_relDate = f_tcalRelDate; + this.f_parseDate = f_tcalParseDate; + this.f_generDate = f_tcalGenerDate; + + // create calendar icon + this.s_iconId = 'tcalico_' + this.s_id; + this.e_icon = f_getElement(this.s_iconId); + if (!this.e_icon) { + document.write('Open Calendar'); + this.e_icon = f_getElement(this.s_iconId); + } + // save received parameters + this.a_cfg = a_cfg; + this.a_tpl = a_tpl; +} + +function f_tcal_show (d_date) { + + // find input field + if (!this.a_cfg.controlname) + throw("TC: control name is not specified"); + if (this.a_cfg.formname) { + var e_form = document.forms[this.a_cfg.formname]; + if (!e_form) + throw("TC: form '" + this.a_cfg.formname + "' can not be found"); + this.e_input = e_form.elements[this.a_cfg.controlname]; + } + else + this.e_input = f_getElement(this.a_cfg.controlname); + + if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT') + throw("TC: element '" + this.a_cfg.controlname + "' does not exist in " + + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document')); + + // dynamically create HTML elements if needed + this.e_div = f_getElement('tcal'); + if (!this.e_div) { + this.e_div = document.createElement("DIV"); + this.e_div.id = 'tcal'; + document.body.appendChild(this.e_div); + } + this.e_shade = f_getElement('tcalShade'); + if (!this.e_shade) { + this.e_shade = document.createElement("DIV"); + this.e_shade.id = 'tcalShade'; + document.body.appendChild(this.e_shade); + } + this.e_iframe = f_getElement('tcalIF') + if (b_ieFix && !this.e_iframe) { + this.e_iframe = document.createElement("IFRAME"); + this.e_iframe.style.filter = 'alpha(opacity=0)'; + this.e_iframe.id = 'tcalIF'; + this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif'; + document.body.appendChild(this.e_iframe); + } + + // hide all calendars + f_tcal_hideAll(); + + // generate HTML and show calendar + this.e_icon = f_getElement(this.s_iconId); + if (!this.f_update()) + return; + + this.e_div.style.visibility = 'visible'; + this.e_shade.style.visibility = 'visible'; + if (this.e_iframe) + this.e_iframe.style.visibility = 'visible'; + + // change icon and status + this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif'; + this.e_icon.title = 'Close Calendar'; + this.b_visible = true; +} + +function f_tcal_hide (n_date) { + if (n_date) + this.e_input.value = this.f_generDate(new Date(n_date)); + + // no action if not visible + if (!this.b_visible) + return; + + // hide elements + if (this.e_iframe) + this.e_iframe.style.visibility = 'hidden'; + if (this.e_shade) + this.e_shade.style.visibility = 'hidden'; + this.e_div.style.visibility = 'hidden'; + + // change icon and status + this.e_icon = f_getElement(this.s_iconId); + this.e_icon.src = this.a_tpl.imgpath + 'cal.gif'; + this.e_icon.title = 'Open Calendar'; + this.b_visible = false; +} + +function f_tcalToggle () { + return this.b_visible ? this.f_hide() : this.f_show(); +} + +function f_tcalUpdate (d_date) { + + var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : f_tcalResetTime(new Date()); + var d_selected = this.e_input.value == '' + ? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today) + : this.f_parseDate(this.e_input.value); + + // figure out date to display + if (!d_date) + // selected by default + d_date = d_selected; + else if (typeof(d_date) == 'number') + // get from number + d_date = f_tcalResetTime(new Date(d_date)); + else if (typeof(d_date) == 'string') + // parse from string + this.f_parseDate(d_date); + + if (!d_date) return false; + + // first date to display + var d_firstday = new Date(d_date); + d_firstday.setDate(1); + d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7); + + var a_class, s_html = '' + + (this.a_tpl.yearscroll ? '' : '') + + '' + + (this.a_tpl.yearscroll ? '' : '') + + '
' + + this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear() + + '
'; + + // print weekdays titles + for (var i = 0; i < 7; i++) + s_html += ''; + s_html += '' ; + + // print calendar table + var n_date, n_month, d_current = new Date(d_firstday); + while (d_current.getMonth() == d_date.getMonth() || + d_current.getMonth() == d_firstday.getMonth()) { + + // print row heder + s_html +=''; + for (var n_wday = 0; n_wday < 7; n_wday++) { + + a_class = []; + n_date = d_current.getDate(); + n_month = d_current.getMonth(); + + // other month + if (d_current.getMonth() != d_date.getMonth()) + a_class[a_class.length] = 'othermonth'; + // weekend + if (d_current.getDay() == 0 || d_current.getDay() == 6) + a_class[a_class.length] = 'weekend'; + // today + if (d_current.valueOf() == d_today.valueOf()) + a_class[a_class.length] = 'today'; + // selected + if (d_current.valueOf() == d_selected.valueOf()) + a_class[a_class.length] = 'selected'; + + s_html += '' + + d_current.setDate(++n_date); + while (d_current.getDate() != n_date && d_current.getMonth() == n_month) { + d_current.setHours(d_current.getHours + 1); + d_current = f_tcalResetTime(d_current); + } + } + // print row footer + s_html +=''; + } + s_html +='
' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + '
' : '>') + n_date + '
'; + + // update HTML, positions and sizes + this.e_div.innerHTML = s_html; + + var n_width = this.e_div.offsetWidth; + var n_height = this.e_div.offsetHeight; + var n_top = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight; + var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth; + if (n_left < 0) n_left = 0; + + this.e_div.style.left = n_left + 'px'; + this.e_div.style.top = n_top + 'px'; + + this.e_shade.style.width = (n_width + 8) + 'px'; + this.e_shade.style.left = (n_left - 1) + 'px'; + this.e_shade.style.top = (n_top - 1) + 'px'; + this.e_shade.innerHTML = b_ieFix + ? '
' + : '
'; + + if (this.e_iframe) { + this.e_iframe.style.left = n_left + 'px'; + this.e_iframe.style.top = n_top + 'px'; + this.e_iframe.style.width = (n_width + 6) + 'px'; + this.e_iframe.style.height = (n_height + 6) +'px'; + } + return true; +} + +function f_getPosition (e_elemRef, s_coord) { + var n_pos = 0, n_offset, + e_elem = e_elemRef; + + while (e_elem) { + n_offset = e_elem["offset" + s_coord]; + n_pos += n_offset; + e_elem = e_elem.offsetParent; + } + // margin correction in some browsers + if (b_ieMac) + n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']); + else if (b_safari) + n_pos -= n_offset; + + e_elem = e_elemRef; + while (e_elem != document.body) { + n_offset = e_elem["scroll" + s_coord]; + if (n_offset && e_elem.style.overflow == 'scroll') + n_pos -= n_offset; + e_elem = e_elem.parentNode; + } + return n_pos; +} + +function f_tcalRelDate (d_date, d_diff, s_units) { + var s_units = (s_units == 'y' ? 'FullYear' : 'Month'); + var d_result = new Date(d_date); + d_result['set' + s_units](d_date['get' + s_units]() + d_diff); + if (d_result.getDate() != d_date.getDate()) + d_result.setDate(0); + return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"'; +} + +function f_tcal_hideAll () { + for (var i = 0; i < window.A_TCALSIDX.length; i++) + window.A_TCALSIDX[i].f_hide(); +} + +function f_tcalResetTime (d_date) { + d_date.setHours(0); + d_date.setMinutes(0); + d_date.setSeconds(0); + d_date.setMilliseconds(0); + return d_date; +} + +f_getElement = document.all ? + function (s_id) { return document.all[s_id] } : + function (s_id) { return document.getElementById(s_id) }; + +if (document.addEventListener) + window.addEventListener('scroll', f_tcal_hideAll, false); +if (window.attachEvent) + window.attachEvent('onscroll', f_tcal_hideAll); + +// global variables +var s_userAgent = navigator.userAgent.toLowerCase(), + re_webkit = /WebKit\/(\d+)/i; +var b_mac = s_userAgent.indexOf('mac') != -1, + b_ie5 = s_userAgent.indexOf('msie 5') != -1, + b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1; +var b_ieFix = b_ie5 || b_ie6, + b_ieMac = b_mac && b_ie5, + b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500; diff --git a/LANG_www/agc_el/conf_exten_check.php b/LANG_www/agc_el/conf_exten_check.php index 0ca93631..709ca680 100644 --- a/LANG_www/agc_el/conf_exten_check.php +++ b/LANG_www/agc_el/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to send whether the meetme conference has live channels connected and which they are # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -50,10 +50,12 @@ # 91130-2022 - Added code for manager override of in-group selection # 91228-1341 - Added API fields update functions # 100109-1337 - Fixed Manual dial live call detection +# 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions +# 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-27'; +$build = '100727-2209'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=32; $one_mysql_log=0; @@ -135,12 +137,12 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; - if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n"; exit; } - else +else { if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) @@ -200,6 +202,8 @@ echo " $Aagent_log_id=''; $Acallerid=''; $DEADcustomer=0; + $Astatus=''; + $Acampaign_id=''; ### see if the agent has a record in the vicidial_live_agents table $stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; @@ -387,7 +391,7 @@ echo " } ### grab the API hangup and API dispo fields in vicidial_live_agents - $stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds,external_dtmf,external_transferconf,external_park,external_timer_action_destination 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);} @@ -401,6 +405,10 @@ echo " $timer_action = $row[6]; $timer_action_message = $row[7]; $timer_action_seconds = $row[8]; + $external_dtmf = $row[9]; + $external_transferconf = $row[10]; + $external_park = $row[11]; + $timer_action_destination = $row[12]; if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -570,7 +578,7 @@ echo " if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Κατάσταση: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n"; + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Κατάσταση: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . "\n"; if (strlen($timer_action) > 3) { diff --git a/LANG_www/agc_el/functions.php b/LANG_www/agc_el/functions.php new file mode 100644 index 00000000..9af6831b --- /dev/null +++ b/LANG_www/agc_el/functions.php @@ -0,0 +1,522 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# + + + +##### BEGIN gather values for display of custom list fields for a lead ##### +function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) + { + $STARTtime = date("U"); + $TODAY = date("Y-m-d"); + $NOW_TIME = date("Y-m-d H:i:s"); + + $vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|'; + + require("dbconnect.php"); + + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05002',$user,$server_ip,$session_name,$one_mysql_log);} + $tablecount_to_print = mysql_num_rows($rslt); + if ($tablecount_to_print > 0) + { + $stmt="SELECT count(*) from custom_$list_id;"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05003',$user,$server_ip,$session_name,$one_mysql_log);} + $fieldscount_to_print = mysql_num_rows($rslt); + if ($fieldscount_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $custom_records_count = $rowx[0]; + + $select_SQL=''; + $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05004',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $fields_list=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $A_field_id[$o] = $rowx[0]; + $A_field_label[$o] = $rowx[1]; + $A_field_name[$o] = $rowx[2]; + $A_field_description[$o] = $rowx[3]; + $A_field_rank[$o] = $rowx[4]; + $A_field_help[$o] = $rowx[5]; + $A_field_type[$o] = $rowx[6]; + $A_field_options[$o] = $rowx[7]; + $A_field_size[$o] = $rowx[8]; + $A_field_max[$o] = $rowx[9]; + $A_field_default[$o] = $rowx[10]; + $A_field_cost[$o] = $rowx[11]; + $A_field_required[$o] = $rowx[12]; + $A_multi_position[$o] = $rowx[13]; + $A_name_position[$o] = $rowx[14]; + $A_field_order[$o] = $rowx[15]; + $A_field_value[$o] = ''; + + if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + { + if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) + { + $select_SQL .= "8,"; + $A_field_select[$o]='----EMPTY----'; + } + else + { + $select_SQL .= "$A_field_label[$o],"; + $A_field_select[$o]=$A_field_label[$o]; + } + } + else + { + $select_SQL .= "8,"; + $A_field_value[$o] = '--A--' . $A_field_label[$o] . '--B--'; + } + $o++; + $rank_select .= ""; + } + $o++; + $rank_select .= ""; + $last_rank = $o; + $select_SQL = preg_replace("/.$/",'',$select_SQL); + + $list_lead_ct=0; + if (strlen($select_SQL)>0) + { + ##### BEGIN grab the data from custom table for the lead_id + $stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$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) + { + $row=mysql_fetch_row($rslt); + $o=0; + while ($fields_to_print >= $o) + { + $A_field_value[$o] = trim("$row[$o]"); + if ($A_field_select[$o]=='----EMPTY----') + {$A_field_value[$o]='';} + if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + {$A_field_value[$o] = '--A--' . $A_field_label[$o] . '--B--';} + $o++; + } + } + else + { + if ($DB) {echo "ERROR: no custom data for this lead: $lead_id\n";} + } + ##### END grab the data from custom table for the lead_id + + + $CFoutput .= "\n"; + $CFoutput .= "
\n"; + if ($fields_to_print < 1) + {$CFoutput .= "";} + + $o=0; + $last_field_rank=0; + while ($fields_to_print > $o) + { + $helpHTML=''; + if (strlen($A_field_help[$o])>0) + {$helpHTML="  help+";} + if ($last_field_rank=="$A_field_rank[$o]") + {$CFoutput .= "         ";} + else + { + $CFoutput .= "\n"; + $CFoutput .= "
There are no custom fields for this list
$helpHTML
";} + else + { + if ($last_field_rank=="$A_field_rank[$o]") + {$CFoutput .= "  ";} + else + {$CFoutput .= "
";} + } + $field_HTML=''; + + if ($A_field_type[$o]=='SELECT') + { + $field_HTML .= "\n"; + } + if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='RADIO') or ($A_field_type[$o]=='CHECKBOX') ) + { + $field_options_array = explode("\n",$A_field_options[$o]); + $field_options_count = count($field_options_array); + $te=0; + while ($te < $field_options_count) + { + if (preg_match("/,/",$field_options_array[$te])) + { + $field_selected=''; + $field_options_value_array = explode(",",$field_options_array[$te]); + if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') ) + { + if (strlen($A_field_value[$o]) > 0) + { + if (preg_match("/$field_options_value_array[0]/",$A_field_value[$o])) + {$field_selected = 'SELECTED';} + } + else + { + if ($A_field_default[$o] == "$field_options_value_array[0]") {$field_selected = 'SELECTED';} + } + $field_HTML .= "\n"; + } + if ( ($A_field_type[$o]=='RADIO') or ($A_field_type[$o]=='CHECKBOX') ) + { + if ($A_multi_position[$o]=='VERTICAL') + {$field_HTML .= "   ";} + if (strlen($A_field_value[$o]) > 0) + { + if (preg_match("/$field_options_value_array[0]/",$A_field_value[$o])) + {$field_selected = 'CHECKED';} + } + else + { + if ($A_field_default[$o] == "$field_options_value_array[0]") {$field_selected = 'CHECKED';} + } + $field_HTML .= " $field_options_value_array[1]\n"; + if ($A_multi_position[$o]=='VERTICAL') + {$field_HTML .= "
\n";} + } + } + $te++; + } + } + if ( ($A_field_type[$o]=='SELECT') or ($A_field_type[$o]=='MULTI') ) + { + $field_HTML .= "\n"; + } + if ($A_field_type[$o]=='TEXT') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + $field_HTML .= "\n"; + } + if ($A_field_type[$o]=='AREA') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + $field_HTML .= ""; + } + if ($A_field_type[$o]=='DISPLAY') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "$A_field_default[$o]\n"; + } + if ($A_field_type[$o]=='SCRIPT') + { + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "$A_field_options[$o]\n"; + } + if ($A_field_type[$o]=='DATE') + { + if ( (strlen($A_field_default[$o])<1) or ($A_field_default[$o]=='NULL') ) {$A_field_default[$o]=0;} + $day_diff = $A_field_default[$o]; + $default_date = date("Y-m-d", mktime(date("H"),date("i"),date("s"),date("m"),date("d")+$day_diff,date("Y"))); + if (strlen($A_field_value[$o]) > 0) {$default_date = $A_field_value[$o];} + + $field_HTML .= "\n"; + $field_HTML .= "\n"; + } + if ($A_field_type[$o]=='TIME') + { + $minute_diff = $A_field_default[$o]; + $default_time = date("H:i:s", mktime(date("H"),date("i")+$minute_diff,date("s"),date("m"),date("d"),date("Y"))); + $default_hour = date("H", mktime(date("H"),date("i")+$minute_diff,date("s"),date("m"),date("d"),date("Y"))); + $default_minute = date("i", mktime(date("H"),date("i")+$minute_diff,date("s"),date("m"),date("d"),date("Y"))); + if (strlen($A_field_value[$o]) > 2) + { + $default_time = $A_field_value[$o]; + $time_field_value = explode(':',$default_time); + $default_hour = $time_field_value[0]; + $default_minute = $time_field_value[1]; + } + $field_HTML .= ""; + $field_HTML .= ""; + $field_HTML .= ""; + } + + if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') ) + { + $CFoutput .= " $field_HTML $helpHTML"; + } + else + { + $CFoutput .= " $field_HTML\n"; + } + + $last_field_rank=$A_field_rank[$o]; + $o++; + } + $CFoutput .= "
\n"; + } + else + {$CFoutput .= "ERROR: no custom list fields\n";} + } + else + {$CFoutput .= "ERROR: no custom list fields table\n";} + + + ##### BEGIN parsing for vicidial variables ##### + if (preg_match("/--A--/",$CFoutput)) + { + if ( (eregi('--A--user_custom_',$CFoutput)) or (eregi('--A--fullname',$CFoutput)) ) + { + $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five,full_name from vicidial_users where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05006',$user,$server_ip,$session_name,$one_mysql_log);} + $VUC_ct = mysql_num_rows($rslt); + if ($VUC_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_custom_one = trim($row[0]); + $user_custom_two = trim($row[1]); + $user_custom_three = trim($row[2]); + $user_custom_four = trim($row[3]); + $user_custom_five = trim($row[4]); + $fullname = trim($row[5]); + } + } + + if (eregi('--A--dialed_',$CFoutput)) + { + $dialed_number = $phone_number; + $dialed_label = 'NONE'; + + ### find the dialed number and label for this call + $stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05008',$user,$server_ip,$session_name,$one_mysql_log);} + $vl_dialed_ct = mysql_num_rows($rslt); + if ($vl_dialed_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number = $row[0]; + $dialed_label = $row[1]; + } + } + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05007',$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) + { + $row=mysql_fetch_row($rslt); + $dispo = trim($row[3]); + $tsr = trim($row[4]); + $vendor_id = trim($row[5]); + $vendor_lead_code = trim($row[5]); + $source_id = trim($row[6]); + $list_id = trim($row[7]); + $gmt_offset_now = trim($row[8]); + $phone_code = trim($row[10]); + $phone_number = trim($row[11]); + $title = trim($row[12]); + $first_name = trim($row[13]); + $middle_initial = trim($row[14]); + $last_name = trim($row[15]); + $address1 = trim($row[16]); + $address2 = trim($row[17]); + $address3 = trim($row[18]); + $city = trim($row[19]); + $state = trim($row[20]); + $province = trim($row[21]); + $postal_code = trim($row[22]); + $country_code = trim($row[23]); + $gender = trim($row[24]); + $date_of_birth = trim($row[25]); + $alt_phone = trim($row[26]); + $email = trim($row[27]); + $security = trim($row[28]); + $comments = trim($row[29]); + $called_count = trim($row[30]); + $rank = trim($row[32]); + $owner = trim($row[33]); + } + + $CFoutput = eregi_replace('--A--lead_id--B--',"$lead_id",$CFoutput); + $CFoutput = eregi_replace('--A--vendor_id--B--',"$vendor_id",$CFoutput); + $CFoutput = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$CFoutput); + $CFoutput = eregi_replace('--A--list_id--B--',"$list_id",$CFoutput); + $CFoutput = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$CFoutput); + $CFoutput = eregi_replace('--A--phone_code--B--',"$phone_code",$CFoutput); + $CFoutput = eregi_replace('--A--phone_number--B--',"$phone_number",$CFoutput); + $CFoutput = eregi_replace('--A--title--B--',"$title",$CFoutput); + $CFoutput = eregi_replace('--A--first_name--B--',"$first_name",$CFoutput); + $CFoutput = eregi_replace('--A--middle_initial--B--',"$middle_initial",$CFoutput); + $CFoutput = eregi_replace('--A--last_name--B--',"$last_name",$CFoutput); + $CFoutput = eregi_replace('--A--address1--B--',"$address1",$CFoutput); + $CFoutput = eregi_replace('--A--address2--B--',"$address2",$CFoutput); + $CFoutput = eregi_replace('--A--address3--B--',"$address3",$CFoutput); + $CFoutput = eregi_replace('--A--city--B--',"$city",$CFoutput); + $CFoutput = eregi_replace('--A--state--B--',"$state",$CFoutput); + $CFoutput = eregi_replace('--A--province--B--',"$province",$CFoutput); + $CFoutput = eregi_replace('--A--postal_code--B--',"$postal_code",$CFoutput); + $CFoutput = eregi_replace('--A--country_code--B--',"$country_code",$CFoutput); + $CFoutput = eregi_replace('--A--gender--B--',"$gender",$CFoutput); + $CFoutput = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$CFoutput); + $CFoutput = eregi_replace('--A--alt_phone--B--',"$alt_phone",$CFoutput); + $CFoutput = eregi_replace('--A--email--B--',"$email",$CFoutput); + $CFoutput = eregi_replace('--A--security_phrase--B--',"$security_phrase",$CFoutput); + $CFoutput = eregi_replace('--A--comments--B--',"$comments",$CFoutput); + $CFoutput = eregi_replace('--A--user--B--',"$user",$CFoutput); + $CFoutput = eregi_replace('--A--pass--B--',"$pass",$CFoutput); + $CFoutput = eregi_replace('--A--campaign--B--',"$campaign",$CFoutput); + $CFoutput = eregi_replace('--A--server_ip--B--',"$server_ip",$CFoutput); + $CFoutput = eregi_replace('--A--session_id--B--',"$session_id",$CFoutput); + $CFoutput = eregi_replace('--A--dialed_number--B--',"$dialed_number",$CFoutput); + $CFoutput = eregi_replace('--A--dialed_label--B--',"$dialed_label",$CFoutput); + $CFoutput = eregi_replace('--A--source_id--B--',"$source_id",$CFoutput); + $CFoutput = eregi_replace('--A--rank--B--',"$rank",$CFoutput); + $CFoutput = eregi_replace('--A--owner--B--',"$owner",$CFoutput); + $CFoutput = eregi_replace('--A--fullname--B--',"$fullname",$CFoutput); + $CFoutput = eregi_replace('--A--uniqueid--B--',"$uniqueid",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$CFoutput); + $CFoutput = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_a--B--',"$preset_number_a",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_b--B--',"$preset_number_b",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_c--B--',"$preset_number_c",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_d--B--',"$preset_number_d",$CFoutput); + $CFoutput = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$CFoutput); + $CFoutput = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$CFoutput); + $CFoutput = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$CFoutput); + $CFoutput = eregi_replace('--A--did_id--B--',"$did_id",$CFoutput); + $CFoutput = eregi_replace('--A--did_extension--B--',"$did_extension",$CFoutput); + $CFoutput = eregi_replace('--A--did_pattern--B--',"$did_pattern",$CFoutput); + $CFoutput = eregi_replace('--A--did_description--B--',"$did_description",$CFoutput); + $CFoutput = eregi_replace('--A--closecallid--B--',"$closecallid",$CFoutput); + $CFoutput = eregi_replace('--A--xfercallid--B--',"$xfercallid",$CFoutput); + $CFoutput = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$CFoutput); + + # custom fields replacement + $o=0; + while ($fields_to_print > $o) + { + $CFoutput = eregi_replace("--A--$A_field_label[$o]--B--","$A_field_value[$o]",$CFoutput); + $o++; + } + + if ($DB > 0) {echo "$CFoutput
\n";} + } + ##### END parsing for vicidial variables ##### + + + return $CFoutput; + } +##### END gather values for display of custom list fields for a lead ##### + + + + + +##### 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; + } + + +?> \ No newline at end of file diff --git a/LANG_www/agc_el/manager_send.php b/LANG_www/agc_el/manager_send.php index b5d5b751..a46f3cfc 100644 --- a/LANG_www/agc_el/manager_send.php +++ b/LANG_www/agc_el/manager_send.php @@ -1,5 +1,5 @@ LICENSE: AGPLv2 # @@ -12,7 +12,7 @@ # - $user # - $pass # optional variables: -# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','SysCIDdtmfOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') # - $queryCID - ('CN012345678901234567',...) # - $format - ('text','debug') # - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) @@ -41,6 +41,8 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -95,11 +97,18 @@ # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records # 100327-0846 - Fix for list_id override answering machine message +# 100423-2304 - Added alertCID +# 100527-1014 - Added SysCIDdtmfOriginate function +# 100813-0833 - Added preset_name variable and logging +# 101004-1345 - Added Ivr park functions +# 101024-1638 - Added park_log logging for parked calls +# 101107-2331 - Added CALLERONHOLD/CALLEROFFHOLD queue_log entries +# -$version = '2.2.0-47'; -$build = '100327-0846'; +$version = '2.4-53'; +$build = '101107-2331'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=115; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +194,11 @@ if (isset($_GET["agent_dialed_type"])) {$agent_dialed_type=$_GET["agent_diale elseif (isset($_POST["agent_dialed_type"])) {$agent_dialed_type=$_POST["agent_dialed_type"];} if (isset($_GET["nodeletevdac"])) {$nodeletevdac=$_GET["nodeletevdac"];} elseif (isset($_POST["nodeletevdac"])) {$nodeletevdac=$_POST["nodeletevdac"];} +if (isset($_GET["alertCID"])) {$alertCID=$_GET["alertCID"];} + elseif (isset($_POST["alertCID"])) {$alertCID=$_POST["alertCID"];} +if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];} + elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -289,6 +303,20 @@ if ($format=='debug') +###################### +# ACTION=SysCIDdtmfOriginate - prep the send dtmf command +###################### +if ($ACTION=="SysCIDdtmfOriginate") + { + $stmt="UPDATE vicidial_live_agents SET external_dtmf='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02092',$user,$server_ip,$session_name,$one_mysql_log);} + + $ACTION="SysCIDOriginate"; + } + + ###################### # ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls @@ -390,7 +418,7 @@ if ($ACTION=="OriginateVDRelogin") if ($ACTION=="Originate") { - if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<10) ) + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or ( (strlen($queryCID)<10) && ($alertCID < 1) ) ) { echo "ERROR Exten $exten δεν ισχύει or queryCID $queryCID δεν ισχύει, Originate εντολή που δεν έγινε εισαγωγή\n"; } @@ -422,10 +450,34 @@ if ($ACTION=="Originate") if ($agent_dialed_number > 0) { - $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$exten','$channel','0','$outbound_cid','$RAWaccount')"; + if (strlen($lead_id)<1) {$lead_id='0';} + $customer_hungup=''; + if ( ($stage > 0) and (preg_match("/3WAY/",$agent_dialed_type)) ) + {$customer_hungup = 'BEFORE_CALL';} + $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id,preset_name,campaign_id,customer_hungup) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$exten','$channel','$lead_id','$outbound_cid','$RAWaccount','$preset_name','$campaign','$customer_hungup')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00192',$user,$server_ip,$session_name,$one_mysql_log);} + + if (strlen($preset_name) > 0) + { + $stmt = "SELECT count(*) from vicidial_xfer_stats where campaign_id='$campaign' and preset_name='$preset_name';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02093',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_xfer_stats SET xfer_count=(xfer_count+1) where campaign_id='$campaign' and preset_name='$preset_name';"; + } + else + { + $stmt = "INSERT INTO vicidial_xfer_stats SET campaign_id='$campaign',preset_name='$preset_name',xfer_count='1';"; + } + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02094',$user,$server_ip,$session_name,$one_mysql_log);} + } } } } @@ -734,6 +786,32 @@ if ($ACTION=="RedirectVD") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02024',$user,$server_ip,$session_name,$one_mysql_log);} } + + if (strlen($preset_name) > 0) + { + $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,preset_name,campaign_id) values('$user','$NOW_TIME','BLIND_XFER','$server_ip','$exten','$channel','$lead_id','$preset_name','$campaign')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02095',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt = "SELECT count(*) from vicidial_xfer_stats where campaign_id='$campaign' and preset_name='$preset_name';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02096',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "UPDATE vicidial_xfer_stats SET xfer_count=(xfer_count+1) where campaign_id='$campaign' and preset_name='$preset_name';"; + } + else + { + $stmt = "INSERT INTO vicidial_xfer_stats SET campaign_id='$campaign',preset_name='$preset_name',xfer_count='1';"; + } + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02097',$user,$server_ip,$session_name,$one_mysql_log);} + } + $ACTION="Redirect"; } } @@ -762,10 +840,73 @@ if ($ACTION=="RedirectToPark") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);} $ACTION="Redirect"; + $stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='ΣΤΑΘΜΕΥΣΗED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',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,'02098',$user,$server_ip,$session_name,$one_mysql_log);} + + + ############################################# + ##### START 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,'02099',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $time_id=0; + $stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02100',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + $queue = $row[1]; + $agent = $row[2]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + if ($VAC_eq_ct > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='ΣΤΑΘΜΕΥΣΗ',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02101',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + # $fp = fopen ("./vicidial_debug.txt", "a"); # fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n"); # fclose($fp); } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02086',$user,$server_ip,$session_name,$one_mysql_log);} } if ($ACTION=="RedirectFromPark") @@ -789,9 +930,281 @@ if ($ACTION=="RedirectFromPark") $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"; + + $parked_sec=0; + $stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02102',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_pl_ct = mysql_num_rows($rslt); + if ($VAC_pl_ct > 0) + { + $row=mysql_fetch_row($rslt); + $parked_sec = ($StarTtime - $row[0]); + + $stmt = "UPDATE park_log SET status='GRABBED',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02103',$user,$server_ip,$session_name,$one_mysql_log);} + + ############################################# + ##### START 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,'02104',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $time_id=0; + $stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02105',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + $queue = $row[1]; + $agent = $row[2]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + if ($VAC_eq_ct > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLEROFFHOLD',data1='$parked_sec',data2='ΣΤΑΘΜΕΥΣΗ',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02106',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + } } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02087',$user,$server_ip,$session_name,$one_mysql_log);} } +if ($ACTION=="RedirectToParkIVR") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχύει:\n"; + echo "Channel $channel πρέπει να είναι μεγαλύτερος από 2 χαρακτήρες\n"; + echo "queryCID $queryCID πρέπει να είναι μεγαλύτερος από 14 χαρακτήρες\n"; + echo "exten $exten πρέπει να τεθεί\n"; + echo "extenName $extenName πρέπει να τεθεί\n"; + echo "ext_context $ext_context πρέπει να τεθεί\n"; + echo "ext_priority $ext_priority πρέπει να τεθεί\n"; + echo "parkedby $parkedby πρέπει να τεθεί\n"; + echo "\nRedirectToPark Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','$CalLCID','$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"; + + $stmt = "UPDATE vicidial_auto_calls SET extension='ΣΤΑΘΜΕΥΣΗ_IVR' where callerid='$CalLCID' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02088',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRΣΤΑΘΜΕΥΣΗED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',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,'02107',$user,$server_ip,$session_name,$one_mysql_log);} + + ############################################# + ##### START 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,'02108',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $time_id=0; + $stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02109',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + $queue = $row[1]; + $agent = $row[2]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + if ($VAC_eq_ct > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='IVRΣΤΑΘΜΕΥΣΗ',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02110',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n"); + # fclose($fp); + } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02089',$user,$server_ip,$session_name,$one_mysql_log);} + } + +if ($ACTION=="RedirectFromParkIVR") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "Μία από αυτές τις μεταβλητές δεν ισχύει:\n"; + echo "Channel $channel πρέπει να είναι μεγαλύτερος από 2 χαρακτήρες\n"; + echo "queryCID $queryCID πρέπει να είναι μεγαλύτερος από 14 χαρακτήρες\n"; + echo "exten $exten πρέπει να τεθεί\n"; + echo "ext_context $ext_context πρέπει να τεθεί\n"; + echo "ext_priority $ext_priority πρέπει να τεθεί\n"; + echo "\nRedirectFromPark Action μην σταλμένος\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);} + $ACTION="Redirect"; + + $stmt = "UPDATE vicidial_auto_calls SET extension='' where callerid='$CalLCID' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02090',$user,$server_ip,$session_name,$one_mysql_log);} + + $parked_sec=0; + $stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02111',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_pl_ct = mysql_num_rows($rslt); + if ($VAC_pl_ct > 0) + { + $row=mysql_fetch_row($rslt); + $parked_sec = ($StarTtime - $row[0]); + + $stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02112',$user,$server_ip,$session_name,$one_mysql_log);} + + ############################################# + ##### START 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,'02113',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $time_id=0; + $stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02114',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + $queue = $row[1]; + $agent = $row[2]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + if ($VAC_eq_ct > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLEROFFHOLD',data1='$parked_sec',data2='IVRΣΤΑΘΜΕΥΣΗ',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02115',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + } + } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02091',$user,$server_ip,$session_name,$one_mysql_log);} + } + + if ($ACTION=="RedirectName") { if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) @@ -1105,7 +1518,7 @@ if ($ACTION=="RedirectXtraNeW") if ($WeBRooTWritablE > 0) { $fp = fopen ("./vicidial_debug.txt", "a"); - fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|$session_id|\n"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|$session_id|\n"); fclose($fp); } } @@ -1650,7 +2063,7 @@ exit; 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); + # mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log); $errno=''; $error=''; if ( ($mel > 0) or ($one_mysql_log > 0) ) { diff --git a/LANG_www/agc_el/timeclock.php b/LANG_www/agc_el/timeclock.php index 864f27a4..bb3b35de 100644 --- a/LANG_www/agc_el/timeclock.php +++ b/LANG_www/agc_el/timeclock.php @@ -9,10 +9,11 @@ # 80525-2351 - Added an audit log that is not to be editable # 80602-0641 - Fixed status update bug # 90508-0727 - Changed to PHP long tags +# 100621-1023 - Added admin_web_directory variable # -$version = '2.2.0-5'; -$build = '90508-0727'; +$version = '2.2.0-6'; +$build = '100621-1023'; $StarTtimE = date("U"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -87,7 +88,7 @@ require("dbconnect.php"); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;"; +$stmt = "SELECT use_non_latin,admin_home_url,admin_web_directory FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -95,8 +96,9 @@ $i=0; while ($i < $qm_conf_ct) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; - $welcomeURL = $row[1]; + $non_latin = $row[0]; + $welcomeURL = $row[1]; + $admin_web_directory = $row[2]; $i++; } ##### END SETTINGS LOOKUP ##### @@ -338,7 +340,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($referrer=='agent') {$BACKlink = "ΕΠΙΣΤΡΟΦΗ στην οθόνη Συνδεσης του Χειριστή";} if ($referrer=='admin') - {$BACKlink = "ΕΠΙΣΤΡΟΦΗ στην Διαχείριση";} + {$BACKlink = "ΕΠΙΣΤΡΟΦΗ στην Διαχείριση";} if ($referrer=='welcome') {$BACKlink = "ΕΠΙΣΤΡΟΦΗ στην οθόνη υποδοχής";} diff --git a/LANG_www/agc_el/vdc_db_query.php b/LANG_www/agc_el/vdc_db_query.php index a95e4f07..75927bb6 100644 --- a/LANG_www/agc_el/vdc_db_query.php +++ b/LANG_www/agc_el/vdc_db_query.php @@ -12,7 +12,7 @@ # - $pass # optional variables: # - $format - ('text','debug') -# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields') +# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields','CALLLOGview','LEADINFOview','customer_3way_hangup_process') # - $stage - ('start','finish','lookup','new') # - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') # - $conf_exten - ('8600011',...) @@ -87,6 +87,8 @@ # - $agent_territories - ('ABC001','ABC002'...) # - $alt_num_status - ('0','1') # - $DiaL_SecondS - ('0','1','2',...) +# - $date - ('2010-02-19') +# - $custom_field_names - ('|start_date|finish_date|favorite_color|') # # CHANGELOG: # 50629-1044 - First build of script @@ -231,16 +233,41 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection -# 100413-1342 - Fixes for extended alt-dial +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 100424-1630 - Added uniqueid display options +# 100622-2217 - Added field labels +# 100624-1401 - Fix for dispo call url bug related to dialed number and label +# 100625-0915 - Fix for auto-dial bug for presets and timer actions +# 100712-1447 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any +# 100803-0822 - Added CAMPLISTS_ALL for manual_dial_filter(issue #369) +# 100823-1612 - Added DID variables on inbound calls +# 100902-1348 - Added closecallid and xfercallid variables +# 100903-0041 - Changed lead_id max length to 10 digits +# 100908-1102 - Added customer_3way_hangup_process function +# 100916-2144 - Added custom list names export with lead data +# 100927-1618 - Added ability to use custom fields in web form and dispo_call_url +# 101001-1451 - Added full name display to Call Log functionality +# 101022-1243 - Fixed missing variables from start and dispo call urls +# 101108-0115 - Added ADDMEMBER option for queue_log +# 101111-1556 - Added source to vicidial_hopper inserts # -$version = '2.2.0-143'; -$build = '100413-1342'; +$version = '2.4-168'; +$build = '101111-1556'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=310; +$mysql_log_count=352; $one_mysql_log=0; require("dbconnect.php"); @@ -420,6 +447,12 @@ if (isset($_GET["alt_num_status"])) {$alt_num_status=$_GET["alt_num_status"]; elseif (isset($_POST["alt_num_status"])) {$alt_num_status=$_POST["alt_num_status"];} if (isset($_GET["DiaL_SecondS"])) {$DiaL_SecondS=$_GET["DiaL_SecondS"];} elseif (isset($_POST["DiaL_SecondS"])) {$DiaL_SecondS=$_POST["DiaL_SecondS"];} +if (isset($_GET["date"])) {$date=$_GET["date"];} + elseif (isset($_POST["date"])) {$date=$_POST["date"];} +if (isset($_GET["custom_field_names"])) {$FORMcustom_field_names=$_GET["custom_field_names"];} + elseif (isset($_POST["custom_field_names"])) {$FORMcustom_field_names=$_POST["custom_field_names"];} +if (isset($_GET["qm_phone"])) {$qm_phone=$_GET["qm_phone"];} + elseif (isset($_POST["qm_phone"])) {$qm_phone=$_POST["qm_phone"];} header ("Content-type: text/html; charset=utf-8"); @@ -435,7 +468,7 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; - +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} ##### Hangup Cause Dictionary ##### $hangup_cause_dictionary = array( @@ -514,7 +547,7 @@ if ($non_latin < 1) $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec); $phone_code = ereg_replace("[^0-9]","",$phone_code); - $phone_number = ereg_replace("[^0-9]","",$phone_number); + $phone_number = ereg_replace("[^0-9a-zA-Z]","",$phone_number); } else { @@ -834,6 +867,34 @@ if ($ACTION == 'regCLOSER') $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);} + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_addmember_enabled FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00349',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $queuemetrics_addmember_enabled = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_queuemetrics_logging > 0) and ($queuemetrics_addmember_enabled > 0) ) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + } + $in_groups_pre = preg_replace('/-$/','',$closer_choice); $in_groups = explode(" ",$in_groups_pre); $in_groups_ct = count($in_groups); @@ -862,6 +923,16 @@ if ($ACTION == 'regCLOSER') 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);} + + if ( ($enable_queuemetrics_logging > 0) and ($queuemetrics_addmember_enabled > 0) ) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$in_groups[$k]',agent='Agent/$user',verb='ADDMEMBER2',data1='$qm_phone',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'0350',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } $k++; } @@ -1065,7 +1136,8 @@ if ($ACTION == 'manDiaLnextCaLL') else { ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $eac_phone=''; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00015',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1073,7 +1145,8 @@ if ($ACTION == 'manDiaLnextCaLL') if ($vla_cc_ct > 0) { $row=mysql_fetch_row($rslt); - $calls_today = $row[0]; + $calls_today = $row[0]; + $eac_phone = $row[1]; } else {$calls_today ='0';} @@ -1144,7 +1217,16 @@ if ($ACTION == 'manDiaLnextCaLL') { $rowx=mysql_fetch_row($rslt); if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} - if (ereg("N", $rowx[1])) {$inactive_lists++;} + if (ereg("ALL",$manual_dial_filter)) + { + if (ereg("N", $rowx[1])) + {$inactive_lists++; $camp_lists .= "'$rowx[0]',";} + } + else + { + if (ereg("N", $rowx[1])) + {$inactive_lists++;} + } $o++; } $camp_lists = eregi_replace(".$","",$camp_lists); @@ -1655,7 +1737,7 @@ if ($ACTION == 'manDiaLnextCaLL') if ($affected_rows > 0) { - $stmt="SELECT lead_id,list_id,gmt_offset_now,state FROM vicidial_list where status='QUEUE' and user='$user' order by modify_date desc LIMIT 1;"; + $stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id FROM vicidial_list where status='QUEUE' and user='$user' order by modify_date desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00243',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1667,8 +1749,9 @@ if ($ACTION == 'manDiaLnextCaLL') $list_id = $row[1]; $gmt_offset_now = $row[2]; $state = $row[3]; + $entry_list_id = $row[4]; - $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0';"; + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0',source='Q';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00244',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1701,7 +1784,7 @@ if ($ACTION == 'manDiaLnextCaLL') } ##### grab the data from vicidial_list for the lead_id - $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id 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";} @@ -1741,6 +1824,8 @@ if ($ACTION == 'manDiaLnextCaLL') $called_count = trim("$row[30]"); $rank = trim("$row[32]"); $owner = trim("$row[33]"); + $entry_list_id = trim("$row[34]"); + if ($entry_list_id < 100) {$entry_list_id = $list_id;} } $called_count++; @@ -1760,8 +1845,8 @@ if ($ACTION == 'manDiaLnextCaLL') if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) { # generate callerID for unique identifier in xfer_log file - $PADlead_id = sprintf("%09s", $lead_id); - while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; @@ -1866,15 +1951,52 @@ if ($ACTION == 'manDiaLnextCaLL') } } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where use_custom_cid='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00313',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $uccid_ct = mysql_num_rows($rslt); + if ($uccid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_custom_cid = $row[0]; + } + if ($use_custom_cid > 0) + { + $temp_CID = preg_replace("/\D/",'',$security); + if (strlen($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} + } if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} - $PADlead_id = sprintf("%09s", $lead_id); - while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} + + ### check for extension append in campaign + $use_eac=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where extension_appended_cidname='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00322',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $eacid_ct = mysql_num_rows($rslt); + if ($eacid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_eac = $row[0]; + } # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; - if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} - else {$CIDstring = "$MqueryCID";} + $EAC=''; + if ($use_eac > 0) + { + $eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone); + $EAC=" $eac_extension"; + } + if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";} + else {$CIDstring = "$MqueryCID$EAC";} ### whether to omit phone_code or not if (eregi('Y',$omit_phone_code)) @@ -1942,7 +2064,7 @@ if ($ACTION == 'manDiaLnextCaLL') $val_pause_sec=0; $stmt = "SELECT pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00323',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vald_ct = mysql_num_rows($rslt); if ($vald_ct > 0) @@ -1955,7 +2077,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00324',$user,$server_ip,$session_name,$one_mysql_log);} if ($agent_dialed_number > 0) @@ -2084,6 +2206,50 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($row[4]) > 0) {$VDCL_xferconf_e_number = $row[4];} } + + $custom_field_names='|'; + $custom_field_names_SQL=''; + $custom_field_values='----------'; + $custom_field_types='|'; + ### find the names of all custom fields, if any + $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00334',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffn_ct = mysql_num_rows($rslt); + $d=0; + while ($cffn_ct > $d) + { + $row=mysql_fetch_row($rslt); + $custom_field_names .= "$row[0]|"; + $custom_field_names_SQL .= "$row[0],"; + $custom_field_types .= "$row[1]|"; + $custom_field_values .= "----------"; + $d++; + } + if ($cffn_ct > 0) + { + $custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL); + ### find the values of the named custom fields + $stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00335',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffv_ct = mysql_num_rows($rslt); + if ($cffv_ct > 0) + { + $custom_field_values='----------'; + $row=mysql_fetch_row($rslt); + $d=0; + while ($cffn_ct > $d) + { + $custom_field_values .= "$row[$d]----------"; + $d++; + } + $custom_field_values = preg_replace("/\n/"," ",$custom_field_values); + $custom_field_values = preg_replace("/\r/","",$custom_field_values); + } + } } @@ -2134,6 +2300,10 @@ if ($ACTION == 'manDiaLnextCaLL') $LeaD_InfO .= $VDCL_xferconf_c_number . "\n"; $LeaD_InfO .= $VDCL_xferconf_d_number . "\n"; $LeaD_InfO .= $VDCL_xferconf_e_number . "\n"; + $LeaD_InfO .= $entry_list_id . "\n"; + $LeaD_InfO .= $custom_field_names . "\n"; + $LeaD_InfO .= $custom_field_values . "\n"; + $LeaD_InfO .= $custom_field_types . "\n"; echo $LeaD_InfO; } @@ -2251,7 +2421,7 @@ if ($ACTION == 'manDiaLonly') else { ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00043',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2259,12 +2429,26 @@ if ($ACTION == 'manDiaLonly') if ($vla_cc_ct > 0) { $row=mysql_fetch_row($rslt); - $calls_today =$row[0]; + $calls_today = $row[0]; + $eac_phone = $row[1]; } else {$calls_today ='0';} $calls_today++; + ### check for extension append in campaign + $use_eac=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where extension_appended_cidname='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00325',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $eacid_ct = mysql_num_rows($rslt); + if ($eacid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_eac = $row[0]; + } + ### prepare variables to place manual call from VICIDiaL $CCID_on=0; $CCID=''; $local_DEF = 'Local/'; @@ -2308,14 +2492,38 @@ if ($ACTION == 'manDiaLonly') } } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT count(*) FROM vicidial_campaigns where use_custom_cid='Y' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00314',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $uccid_ct = mysql_num_rows($rslt); + if ($uccid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $use_custom_cid = $row[0]; + } + if ($use_custom_cid > 0) + { + $temp_CID = preg_replace("/\D/",'',$security); + if (strlen($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} + } - $PADlead_id = sprintf("%09s", $lead_id); - while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; - if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} - else {$CIDstring = "$MqueryCID";} + $EAC=''; + if ($use_eac > 0) + { + $eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone); + $EAC=" $eac_extension"; + } + if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";} + else {$CIDstring = "$MqueryCID$EAC";} if ( ($usegroupalias > 0) and (strlen($account)>1) ) { @@ -2395,7 +2603,7 @@ if ($ACTION == 'manDiaLonly') $val_wait_sec=0; $stmt = "SELECT dispo_epoch,wait_epoch,pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00326',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vald_ct = mysql_num_rows($rslt); if ($vald_ct > 0) @@ -2413,12 +2621,12 @@ if ($ACTION == 'manDiaLonly') $stmt="UPDATE vicidial_agent_log set status='ALTNUM',dispo_sec='$val_dispo_sec' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00327',$user,$server_ip,$session_name,$one_mysql_log);} $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00328',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -2430,14 +2638,14 @@ if ($ACTION == 'manDiaLonly') $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','ANDIAL');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00329',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); $agent_log_id = mysql_insert_id($link); $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id',last_state_change='$NOW_TIME' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00330',$VD_login,$server_ip,$session_name,$one_mysql_log);} $VLAaffected_rows_update = mysql_affected_rows($link); } else @@ -2445,7 +2653,7 @@ if ($ACTION == 'manDiaLonly') $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00331',$user,$server_ip,$session_name,$one_mysql_log);} } echo "$agent_log_id\n"; @@ -2644,9 +2852,12 @@ if ($stage == "start") { if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) { - $fp = fopen ("./vicidial_debug.txt", "a"); - fwrite ($fp, "$NOW_TIME|VL_LOG_0|$uniqueid|$lead_id|$user|$list_id|$campaign|$start_epoch|$phone_number|$agent_log_id|\n"); - fclose($fp); + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|VL_LOG_0|$uniqueid|$lead_id|$user|$list_id|$campaign|$start_epoch|$phone_number|$agent_log_id|\n"); + fclose($fp); + } echo "ΔΕΝ ΕΓΙΝΕ ΕΙΣΑΓΩΓΗ ΣΤΗΝ ΚΑΤΑΓΡΑΦΗ ΓΕΓΟΝΟΤΩΝ\n"; echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign δεν ισχύει\n"; @@ -2775,13 +2986,13 @@ if ($stage == "end") $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); ##### look for the start epoch in the vicidial_closer_log table - $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id,status FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $VDIDselect = "VDCL_LID $lead_id $phone_number $user $four_hours_ago"; } else { ##### look for the start epoch in the vicidial_log table - $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } $rslt=mysql_query($stmt, $link); @@ -2795,6 +3006,7 @@ if ($stage == "end") $VDterm_reason = $row[1]; $VDvicidial_id = $row[2]; $VDcampaign_id = $row[3]; + $VDstatus = $row[4]; $length_in_sec = ($StarTtime - $start_epoch); } else @@ -2836,7 +3048,9 @@ if ($stage == "end") if ($VLA_inOUT == 'INBOUND') { - $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec', status='$status_dispo' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $vcl_statusSQL=''; + if ($VDstatus == 'INCALL') {$vcl_statusSQL = ",status='$status_dispo'";} + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vcl_statusSQL where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00062',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2844,6 +3058,10 @@ if ($stage == "end") if ($affected_rows > 0) { echo "$uniqueid\n$channel\n"; + + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|INBND_LOG_4|$VDstatus|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$start_epoch|$stmt|\n"); + # fclose($fp); } else { @@ -2981,7 +3199,7 @@ if ($stage == "end") if ($VD_alt_dnc_count < 1) { ### insert record into vicidial_hopper for alt_phone call attempt - $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';"; + $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',source='A';"; 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);} @@ -3058,7 +3276,7 @@ if ($stage == "end") if ($VD_alt_dnc_count < 1) { ### insert record into vicidial_hopper for address3 call attempt - $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';"; + $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',source='A';"; 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);} @@ -3085,7 +3303,7 @@ if ($stage == "end") {$Xlast=0;} $VD_altdialx=''; - $stmt="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT gmt_offset_now,state,list_id,entry_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";} @@ -3096,6 +3314,7 @@ if ($stage == "end") $EA_gmt_offset_now = $row[0]; $EA_state = $row[1]; $EA_list_id = $row[2]; + $EA_entry_list_id = $row[3]; } $alt_dial_phones_count=0; $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; @@ -3173,7 +3392,7 @@ if ($stage == "end") { if ($alt_dial_phones_count == $Xlast) {$Xlast = 'LAST';} - $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';"; + $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',source='A';"; 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);} @@ -3462,7 +3681,7 @@ if ($stage == "end") if (strlen($SQLterm) > 0) { ##### update the duration and end time in the vicidial_log table - $stmt="UPDATE vicidial_closer_log set $SQLterm, status='$status_dispo' where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00092',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3594,7 +3813,9 @@ if ($stage == "end") { if (strlen($hangup_channels[$loop_count])>5) { - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','','','','','','','','','');"; + $variable = "Variable: ctuserserverconfleadphone=$loop_count$US$user$US$server_ip$US$conf_exten$US$lead_id$US$phone_number"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','$variable','','','','','','','','');"; 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);} @@ -3657,9 +3878,12 @@ if ($stage == "end") if (!ereg('.',$VDvicidial_id)) {$vidSQL = ",vicidial_id='$VDvicidial_id'";} - $fp = fopen ("./vicidial_debug.txt", "a"); - fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n"); - fclose($fp); + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n"); + fclose($fp); + } } } $length_in_sec = ($StarTtime - $start_time); @@ -3724,7 +3948,7 @@ if ($stage == "end") } } } - $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',dispo_epoch='$StarTtime' $talk_epochSQL $dead_secSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',dispo_epoch='$StarTtime',uniqueid='$uniqueid' $talk_epochSQL $dead_secSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00102',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3798,6 +4022,8 @@ if ($ACTION == 'VDADcheckINCOMING') $alt_phone_note=''; $alt_phone_active=''; $alt_phone_count=''; + $INclosecallid=''; + $INxfercallid=''; if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) { @@ -3864,7 +4090,7 @@ if ($ACTION == 'VDADcheckINCOMING') 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 lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id 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";} @@ -3902,6 +4128,8 @@ if ($ACTION == 'VDADcheckINCOMING') $called_count = trim("$row[30]"); $rank = trim("$row[32]"); $owner = trim("$row[33]"); + $entry_list_id = trim("$row[34]"); + if ($entry_list_id < 100) {$entry_list_id = $list_id;} } ##### if lead is a callback, grab the callback comments @@ -3932,6 +4160,19 @@ if ($ACTION == 'VDADcheckINCOMING') $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);} + ### gather custom_call_id from vicidial_log_extended table + $custom_call_id=''; + $stmt="SELECT custom_call_id FROM vicidial_log_extended where uniqueid='$uniqueid';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00333',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vle_record_ct = mysql_num_rows($rslt); + if ($vle_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $custom_call_id = $row[0]; + } + ### update the log status to INCALL $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; @@ -3945,7 +4186,6 @@ if ($ACTION == 'VDADcheckINCOMING') $user_group = trim("$row[0]"); } - $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); @@ -4012,7 +4252,7 @@ if ($ACTION == 'VDADcheckINCOMING') else { $call_type = 'IN'; - $stmt = "SELECT campaign_id from vicidial_closer_log where lead_id = '$lead_id' order by call_date desc limit 1;"; + $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$lead_id' 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,'00183',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4020,13 +4260,15 @@ if ($ACTION == 'VDADcheckINCOMING') if ($VDCL_mvac_ct > 0) { $row=mysql_fetch_row($rslt); - $VDADchannel_group =$row[0]; + $VDADchannel_group = $row[0]; + $INclosecallid = $row[1]; + $INxfercallid = $row[2]; } } if ($WeBRooTWritablE > 0) { $fp = fopen ("./vicidial_debug.txt", "a"); - fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|$dialed_number|$dialed_label\n"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|$dialed_number|$dialed_label|$INclosecallid|$INxfercallid|\n"); fclose($fp); } } @@ -4051,7 +4293,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $stmt = "SELECT campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action,timer_action_message,timer_action_seconds,timer_action_destination 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);} @@ -4059,19 +4301,23 @@ if ($ACTION == 'VDADcheckINCOMING') if ($VDIG_cid_ct > 0) { $row=mysql_fetch_row($rslt); - $VDCL_campaign_script = $row[0]; - $VDCL_get_call_launch = $row[1]; - $VDCL_xferconf_a_dtmf = $row[2]; - $VDCL_xferconf_a_number = $row[3]; - $VDCL_xferconf_b_dtmf = $row[4]; - $VDCL_xferconf_b_number = $row[5]; - $VDCL_default_xfer_group = $row[6]; + $VDCL_campaign_script = $row[0]; + $VDCL_get_call_launch = $row[1]; + $VDCL_xferconf_a_dtmf = $row[2]; + $VDCL_xferconf_a_number = $row[3]; + $VDCL_xferconf_b_dtmf = $row[4]; + $VDCL_xferconf_b_number = $row[5]; + $VDCL_default_xfer_group = $row[6]; if (strlen($VDCL_default_xfer_group)<2) {$VDCL_default_xfer_group='X';} - $VDCL_start_call_url = $row[7]; - $VDCL_dispo_call_url = $row[8]; - $VDCL_xferconf_c_number = $row[9]; - $VDCL_xferconf_d_number = $row[10]; - $VDCL_xferconf_e_number = $row[11]; + $VDCL_start_call_url = $row[7]; + $VDCL_dispo_call_url = $row[8]; + $VDCL_xferconf_c_number = $row[9]; + $VDCL_xferconf_d_number = $row[10]; + $VDCL_xferconf_e_number = $row[11]; + $VDCL_timer_action = $row[12]; + $VDCL_timer_action_message = $row[13]; + $VDCL_timer_action_seconds = $row[14]; + $VDCL_timer_action_destination = $row[15]; } ### Check for List ID override settings @@ -4098,7 +4344,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - echo "|||||$VDCL_campaign_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|X|X|||||$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number\n|\n"; + echo "|||||$VDCL_campaign_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|X|X|||||$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number||||$VDCL_timer_action_destination||||||\n|\n"; if (ereg('X',$dialed_label)) { @@ -4135,6 +4381,21 @@ if ($ACTION == 'VDADcheckINCOMING') $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);} + if (strlen($closecallid)<1) + { + $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' 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,'00336',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_mvac_ct = mysql_num_rows($rslt); + if ($VDCL_mvac_ct > 0) + { + $row=mysql_fetch_row($rslt); + $INclosecallid = $row[0]; + $INxfercallid = $row[1]; + } + } + $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); @@ -4159,7 +4420,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $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,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + $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,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination 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);} @@ -4190,8 +4451,11 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_xferconf_c_number = $row[20]; $VDCL_xferconf_d_number = $row[21]; $VDCL_xferconf_e_number = $row[22]; + $VDCL_uniqueid_status_display = $row[23]; + $VDCL_uniqueid_status_prefix = $row[24]; + $VDCL_timer_action_destination = $row[25]; - $stmt = "select campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "select campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination 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);} @@ -4225,6 +4489,8 @@ if ($ACTION == 'VDADcheckINCOMING') {$VDCL_xferconf_d_number = $row[12];} if (strlen($VDCL_xferconf_e_number) < 1) {$VDCL_xferconf_e_number = $row[13];} + if (strlen($VDCL_timer_action_destination) < 1) + {$VDCL_timer_action_destination = $row[14];} if ( ( (ereg('NONE',$VDCL_ingroup_script)) and (strlen($VDCL_ingroup_script) < 5) ) or (strlen($VDCL_ingroup_script) < 1) ) { @@ -4279,7 +4545,7 @@ if ($ACTION == 'VDADcheckINCOMING') } else { - $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination 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);} @@ -4302,6 +4568,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_xferconf_c_number = $row[12]; $VDCL_xferconf_d_number = $row[13]; $VDCL_xferconf_e_number = $row[14]; + $VDCL_timer_action_destination = $row[15]; } $script_recording_delay=0; @@ -4368,9 +4635,38 @@ if ($ACTION == 'VDADcheckINCOMING') } } + $DID_id=''; + $DID_extension=''; + $DID_pattern=''; + $DID_description=''; + + $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' 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,'00337',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIDL_ct = mysql_num_rows($rslt); + if ($VDIDL_ct > 0) + { + $row=mysql_fetch_row($rslt); + $DID_id = $row[0]; + $DID_extension = $row[1]; + + $stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00338',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIDL_ct = mysql_num_rows($rslt); + if ($VDIDL_ct > 0) + { + $row=mysql_fetch_row($rslt); + $DID_pattern = $row[0]; + $DID_description = $row[1]; + } + } + ### if web form is set then send στο 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|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|\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|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|\n";} + 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|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\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|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\n";} $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; if ($DB) {echo "$stmt\n";} @@ -4412,6 +4708,51 @@ if ($ACTION == 'VDADcheckINCOMING') } } + $custom_field_names='|'; + $custom_field_names_SQL=''; + $custom_field_values='----------'; + $custom_field_types='|'; + ### find the names of all custom fields, if any + $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00339',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffn_ct = mysql_num_rows($rslt); + $d=0; + while ($cffn_ct > $d) + { + $row=mysql_fetch_row($rslt); + $custom_field_names .= "$row[0]|"; + $custom_field_names_SQL .= "$row[0],"; + $custom_field_types .= "$row[1]|"; + $custom_field_values .= "----------"; + $d++; + } + if ($cffn_ct > 0) + { + $custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL); + ### find the values of the named custom fields + $stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00340',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffv_ct = mysql_num_rows($rslt); + if ($cffv_ct > 0) + { + $custom_field_values='----------'; + $row=mysql_fetch_row($rslt); + $d=0; + while ($cffn_ct > $d) + { + $custom_field_values .= "$row[$d]----------"; + $d++; + } + $custom_field_values = preg_replace("/\n/"," ",$custom_field_values); + $custom_field_values = preg_replace("/\r/","",$custom_field_values); + } + } + + $comments = eregi_replace("\r",'',$comments); $comments = eregi_replace("\n",'!N',$comments); @@ -4458,6 +4799,10 @@ if ($ACTION == 'VDADcheckINCOMING') $LeaD_InfO .= $rank . "\n"; $LeaD_InfO .= $owner . "\n"; $LeaD_InfO .= $script_recording_delay . "\n"; + $LeaD_InfO .= $entry_list_id . "\n"; + $LeaD_InfO .= $custom_field_names . "\n"; + $LeaD_InfO .= $custom_field_values . "\n"; + $LeaD_InfO .= $custom_field_types . "\n"; echo $LeaD_InfO; @@ -4564,8 +4909,8 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_start_call_url = eregi_replace('--A--phone_pass--B--',urlencode(trim($phone_pass)),$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--fronter--B--',urlencode(trim($fronter)),$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--closer--B--',urlencode(trim($closer)),$VDCL_start_call_url); - $VDCL_start_call_url = eregi_replace('--A--group--B--',urlencode(trim($group)),$VDCL_start_call_url); - $VDCL_start_call_url = eregi_replace('--A--channel_group--B--',urlencode(trim($channel_group)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--group--B--',urlencode(trim($VDADchannel_group)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--channel_group--B--',urlencode(trim($VDADchannel_group)),$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--SQLdate--B--',urlencode(trim($SQLdate)),$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--epoch--B--',urlencode(trim($epoch)),$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--uniqueid--B--',urlencode(trim($uniqueid)),$VDCL_start_call_url); @@ -4592,11 +4937,50 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_start_call_url = eregi_replace('--A--user_custom_five--B--',urlencode(trim($user_custom_five)),$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--talk_time--B--',"0",$VDCL_start_call_url); $VDCL_start_call_url = eregi_replace('--A--talk_time_min--B--',"0",$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--entry_list_id--B--',urlencode(trim($entry_list_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--did_id--B--',urlencode(trim($DID_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--did_extension--B--',urlencode(trim($DID_extension)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--did_pattern--B--',urlencode(trim($DID_pattern)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--did_description--B--',urlencode(trim($DID_description)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--closecallid--B--',urlencode(trim($INclosecallid)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--xfercallid--B--',urlencode(trim($INxfercallid)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--agent_log_id--B--',urlencode(trim($agent_log_id)),$VDCL_start_call_url); + + if (strlen($custom_field_names)>2) + { + $custom_field_names = preg_replace("/^\||\|$/",'',$custom_field_names); + $custom_field_names = preg_replace("/\|/",",",$custom_field_names); + $custom_field_names_ARY = explode(',',$custom_field_names); + $custom_field_names_ct = count($custom_field_names_ARY); + $custom_field_names_SQL = $custom_field_names; + + ##### BEGIN grab the data from custom table for the lead_id + $stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00344',$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) + { + $row=mysql_fetch_row($rslt); + $o=0; + while ($custom_field_names_ct > $o) + { + $form_field_value = trim("$row[$o]"); + $field_name_id = $custom_field_names_ARY[$o]; + $field_name_tag = "--A--" . $field_name_id . "--B--"; + $VDCL_start_call_url = eregi_replace("$field_name_tag","$form_field_value",$VDCL_start_call_url); + $o++; + } + } + } + if ($DB > 0) {echo "$VDCL_start_call_url
\n";} $SCUfile = file("$VDCL_start_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} ##### BEGIN special filtering and response for Vtiger account balance function ##### + # http://vtiger/vicidial/api.php?mode=callxfer&contactwsid=--A--vendor_lead_code--B--&minuteswarning=3 $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00294',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4606,27 +4990,71 @@ if ($ACTION == 'VDADcheckINCOMING') $row=mysql_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } - if ( ($enable_vtiger_integration > 0) and (ereg('callxfer',$VDCL_start_call_url)) and (ereg('contactwsid',$VDCL_start_call_url)) ) + if ( ( ($enable_vtiger_integration > 0) and (ereg('callxfer',$VDCL_start_call_url)) and (ereg('contactwsid',$VDCL_start_call_url)) ) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) { $SCUoutput=''; foreach ($SCUfile as $SCUline) {$SCUoutput .= "$SCUline";} # {"result":true,"durationLimit":3071} - if (strlen($SCUoutput) > 4) + if ( (strlen($SCUoutput) > 4) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) { - $SCUresponse = explode('durationLimit',$SCUoutput); - $durationLimit = preg_replace('/\D/','',$SCUresponse[1]); - $durationLimitSEC = ( ( ($durationLimit + 0) - 3) * 60); # minutes - 3 for 3-minute-warning - if ($durationLimitSEC < 5) {$durationLimitSEC = 5;} + $minuteswarning=3; # default to 3 + if (preg_match("/minuteswarning/",$VDCL_start_call_url)) + { + $minuteswarningARY = explode('minuteswarning=',$VDCL_start_call_url); + $minuteswarning = preg_replace('/&.*/','',$minuteswarningARY[1]); + } + ### add this to the Start Call URL for callcard calls to be logged "&minuteswarning=1&callcard=1" + if (preg_match("/callcard=/",$VDCL_start_call_url)) + { + $stmt="SELECT balance_minutes_start FROM callcard_log where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00315',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $bms_ct = mysql_num_rows($rslt); + if ($bms_ct > 0) + { + $row=mysql_fetch_row($rslt); + $durationLimit = $row[0]; - $stmt="UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='3 minute warning for customer',external_timer_action_seconds='$durationLimitSEC' where user='$user';"; + $stmt="UPDATE callcard_log set agent_time='$NOW_TIME',agent='$user' where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00316',$user,$server_ip,$session_name,$one_mysql_log);} + $ccl_update = mysql_affected_rows($link); + } + } + else + { + $SCUresponse = explode('durationLimit',$SCUoutput); + $durationLimit = preg_replace('/\D/','',$SCUresponse[1]); + } + if (strlen($durationLimit) < 1) {$durationLimit = 0;} + $durationLimitSECnext = ( ($minuteswarning + 0) * 60); + $durationLimitSEC = ( ( ($durationLimit + 0) - $minuteswarning) * 60); # minutes - 3 for 3-minute-warning + if ($durationLimitSEC < 5) {$durationLimitSEC = 5;} + if ( ($durationLimitSECnext < 30) or (strlen($durationLimitSECnext)<1) ) {$durationLimitSECnext = 30;} + + $timer_action_destination=''; + if (preg_match("/nextstep=/",$VDCL_start_call_url)) + { + $nextstepARY = explode('nextstep=',$VDCL_start_call_url); + $nextstep = preg_replace("/&.*/",'',$nextstepARY[1]); + $nextmessageARY = explode('nextmessage=',$VDCL_start_call_url); + $nextmessage = preg_replace("/&.*/",'',$nextmessageARY[1]); + $destinationARY = explode('destination=',$VDCL_start_call_url); + $destination = preg_replace("/&.*/",'',$destinationARY[1]); + $timer_action_destination = "nextstep---$nextstep--$durationLimitSECnext--$destination--$nextmessage--"; + } + + $stmt="UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='$minuteswarning minute warning for customer',external_timer_action_seconds='$durationLimitSEC',external_timer_action_destination='$timer_action_destination' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00295',$user,$server_ip,$session_name,$one_mysql_log);} $vla_update_timer = mysql_affected_rows($link); $fp = fopen ("./call_url_log.txt", "a"); - fwrite ($fp, "$VDCL_start_call_url\n$SCUoutput\n$durationLimit|$durationLimitSEC|$vla_update_timer\n"); + fwrite ($fp, "$VDCL_start_call_url\n$SCUoutput\n$durationLimit|$durationLimitSEC|$vla_update_timer|$minuteswarning|$uniqueid|\n"); fclose($fp); } } @@ -4770,7 +5198,7 @@ if ($ACTION == 'userLOGout') { ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages,queuemetrics_loginout,queuemetrics_addmember_enabled 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";} @@ -4778,13 +5206,15 @@ if ($ACTION == 'userLOGout') if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $enable_queuemetrics_logging = $row[0]; - $queuemetrics_server_ip = $row[1]; - $queuemetrics_dbname = $row[2]; - $queuemetrics_login = $row[3]; - $queuemetrics_pass = $row[4]; - $queuemetrics_log_id = $row[5]; - $allow_sipsak_messages = $row[6]; + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $allow_sipsak_messages = $row[6]; + $queuemetrics_loginout = $row[7]; + $queuemetrics_addmember_enabled = $row[8]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -4796,6 +5226,10 @@ if ($ACTION == 'userLOGout') if ($enable_queuemetrics_logging > 0) { + $QM_LOGOFF = 'AGENTLOGOFF'; + if ($queuemetrics_loginout=='CALLBACK') + {$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); @@ -4805,7 +5239,7 @@ if ($ACTION == 'userLOGout') # $rslt=mysql_query($stmt, $linkB); # $affected_rows = mysql_affected_rows($linkB); - $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; + $stmt = "SELECT time_id,data1 FROM queue_log where agent='Agent/$user' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00139',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -4816,18 +5250,45 @@ if ($ACTION == 'userLOGout') { $row=mysql_fetch_row($rslt); $logintime = $row[0]; + $loginphone = $row[1]; $i++; } $time_logged_in = ($StarTtime - $logintime); if ($time_logged_in > 1000000) {$time_logged_in=1;} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QM_LOGOFF',data1='$loginphone',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00140',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); + if ($queuemetrics_addmember_enabled > 0) + { + $stmt = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$user' and verb IN('ADDMEMBER','ADDMEMBER2') order by time_id desc;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00351',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + echo "$stmt\n"; + $amq_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $amq_conf_ct) + { + $row=mysql_fetch_row($rslt); + $AMqueue[$i] = $row[0]; + $i++; + } + + $i=0; + while ($i < $amq_conf_ct) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$AMqueue[$i]',agent='Agent/$user',verb='REMOVEMEMBER',data1='$loginphone',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00352',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + $i++; + } + } mysql_close($linkB); } } @@ -4853,7 +5314,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "SELECT dispo_call_url from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT dispo_call_url,queuemetrics_callstatus_override from vicidial_campaigns vc,vicidial_live_agents vla where vla.campaign_id=vc.campaign_id and vla.user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00284',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4861,11 +5322,12 @@ if ($ACTION == 'updateDISPO') if ($VC_dcu_ct > 0) { $row=mysql_fetch_row($rslt); - $dispo_call_url =$row[0]; + $dispo_call_url = $row[0]; + $queuemetrics_callstatus_override = $row[1]; } ### reset the API fields in vicidial_live_agents record - $stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='',external_update_fields='0',external_update_fields_data='',external_timer_action_seconds='-1',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='',external_update_fields='0',external_update_fields_data='',external_timer_action_seconds='-1',external_dtmf='',external_transferconf='',external_park='',last_state_change='$NOW_TIME' 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);} @@ -4892,6 +5354,10 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142',$user,$server_ip,$session_name,$one_mysql_log);} + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|DISPO_CALL |$MDnextCID|$stage|$campaign|$lead_id|$dispo_choice|$user|$uniqueid|$auto_dial_level|$agent_log_id|\n"); + # fclose($fp); + $stmt = "SELECT count(*) from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -4899,15 +5365,21 @@ if ($ACTION == 'updateDISPO') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { + $call_type='IN'; $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);} + $VCLaffected_rows = mysql_affected_rows($link); + + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|DISPO_CALL2|$VCLaffected_rows|$stmt|\n"); + # fclose($fp); $stmt = "UPDATE vicidial_live_inbound_agents set last_call_finish=NOW() where group_id='$stage' and user='$user' limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00310',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00322',$user,$server_ip,$session_name,$one_mysql_log);} $stmt = "SELECT dispo_call_url from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} @@ -4918,6 +5390,7 @@ if ($ACTION == 'updateDISPO') } else { + $call_type='OUT'; $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); if ( ($auto_dial_level < 1) or (preg_match('/^M/',$MDnextCID)) ) @@ -5017,8 +5490,8 @@ if ($ACTION == 'updateDISPO') {$VLphone_code = "$phone_code";} } - $PADlead_id = sprintf("%09s", $lead_id); - while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} $FAKEcall_id = "$StarTtime.$PADlead_id"; $stmt = "INSERT INTO vicidial_log set uniqueid='$FAKEcall_id',lead_id='$lead_id',list_id='$VLlist_id',campaign_id='$campaign',call_date='$NOW_TIME',start_epoch='$StarTtime',end_epoch='$StarTtime',length_in_sec='0',status='$dispo_choice',phone_code='$VLphone_code',phone_number='$VLphone_number',user='$user',comments='MANUAL',processed='N',user_group='$user_group',term_reason='AGENT',alt_dial='$VLalt';"; if ($DB) {echo "$stmt\n";} @@ -5083,7 +5556,7 @@ if ($ACTION == 'updateDISPO') $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]');"; + $stmt="INSERT IGNORE 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";} @@ -5096,7 +5569,7 @@ if ($ACTION == 'updateDISPO') $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');"; + $stmt="INSERT IGNORE 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";} @@ -5141,7 +5614,7 @@ if ($ACTION == 'updateDISPO') } } } - $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',status='$dispo_choice' $dispo_epochSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',status='$dispo_choice',uniqueid='$uniqueid' $dispo_epochSQL $lead_id_commentsSQL where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00151',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5688,7 +6161,7 @@ if ($ACTION == 'updateDISPO') ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_callstatus FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00159',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5702,10 +6175,11 @@ if ($ACTION == 'updateDISPO') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_callstatus = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### - if ($enable_queuemetrics_logging > 0) + if ( ($enable_queuemetrics_logging > 0) and ( ( ($queuemetrics_callstatus > 0) or ($queuemetrics_callstatus_override=='YES') ) and ($queuemetrics_callstatus_override!='NO') ) ) { $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); @@ -5721,8 +6195,10 @@ if ($ACTION == 'updateDISPO') mysql_close($linkB); } - - ### Issue Dispo Call URL if defined + + ############################################ + ### BEGIN Issue Dispo Call URL if defined + ############################################ if (strlen($dispo_call_url) > 7) { $talk_time=0; @@ -5801,11 +6277,83 @@ if ($ACTION == 'updateDISPO') if (strlen($status_name) < 1) {$status_name = $dispo_choice;} } $dispo_name = urlencode(trim($status_name)); - + if (eregi('--A--dialed_',$dispo_call_url)) + { + $dialed_number = $phone_number; + $dialed_label = 'NONE'; + + if ($call_type=='OUT') + { + ### find the dialed number and label for this call + $stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00341',$user,$server_ip,$session_name,$one_mysql_log);} + $vl_dialed_ct = mysql_num_rows($rslt); + if ($vl_dialed_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialed_number = $row[0]; + $dialed_label = $row[1]; + } + } + } + + if (eregi('--A--did_',$dispo_call_url)) + { + $DID_id=''; + $DID_extension=''; + $DID_pattern=''; + $DID_description=''; + + $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' 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,'00346',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIDL_ct = mysql_num_rows($rslt); + if ($VDIDL_ct > 0) + { + $row=mysql_fetch_row($rslt); + $DID_id = $row[0]; + $DID_extension = $row[1]; + + $stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00347',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIDL_ct = mysql_num_rows($rslt); + if ($VDIDL_ct > 0) + { + $row=mysql_fetch_row($rslt); + $DID_pattern = $row[0]; + $DID_description = $row[1]; + } + } + } + + if ((eregi('callid--B--',$dispo_call_url)) or (eregi('group--B--',$dispo_call_url))) + { + $INclosecallid=''; + $INxfercallid=''; + $VDADchannel_group=$campaign; + $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where uniqueid='$uniqueid' 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,'00348',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_mvac_ct = mysql_num_rows($rslt); + if ($VDCL_mvac_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group = $row[0]; + $INclosecallid = $row[1]; + $INxfercallid = $row[2]; + } + } + ##### grab the data from vicidial_list for the lead_id - $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id 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,'00290',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5843,6 +6391,7 @@ if ($ACTION == 'updateDISPO') $called_count = urlencode(trim($row[30])); $rank = urlencode(trim($row[32])); $owner = urlencode(trim($row[33])); + $entry_list_id = urlencode(trim($row[34])); } $dispo_call_url = preg_replace('/^VAR/','',$dispo_call_url); @@ -5878,9 +6427,9 @@ if ($ACTION == 'updateDISPO') $dispo_call_url = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$dispo_call_url); $dispo_call_url = eregi_replace('--A--phone_pass--B--',"$phone_pass",$dispo_call_url); $dispo_call_url = eregi_replace('--A--fronter--B--',"$fronter",$dispo_call_url); - $dispo_call_url = eregi_replace('--A--closer--B--',"$closer",$dispo_call_url); - $dispo_call_url = eregi_replace('--A--group--B--',"$group",$dispo_call_url); - $dispo_call_url = eregi_replace('--A--channel_group--B--',"$channel_group",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--closer--B--',"$user",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--group--B--',"$VDADchannel_group",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--channel_group--B--',"$VDADchannel_group",$dispo_call_url); $dispo_call_url = eregi_replace('--A--SQLdate--B--',"$SQLdate",$dispo_call_url); $dispo_call_url = eregi_replace('--A--epoch--B--',"$epoch",$dispo_call_url); $dispo_call_url = eregi_replace('--A--uniqueid--B--',"$uniqueid",$dispo_call_url); @@ -5910,6 +6459,43 @@ if ($ACTION == 'updateDISPO') $dispo_call_url = eregi_replace('--A--talk_time_ms--B--',"$talk_time_ms",$dispo_call_url); $dispo_call_url = eregi_replace('--A--talk_time_min--B--',"$talk_time_min",$dispo_call_url); $dispo_call_url = eregi_replace('--A--agent_log_id--B--',"$CALL_agent_log_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--did_id--B--',urlencode(trim($DID_id)),$dispo_call_url); + $dispo_call_url = eregi_replace('--A--did_extension--B--',urlencode(trim($DID_extension)),$dispo_call_url); + $dispo_call_url = eregi_replace('--A--did_pattern--B--',urlencode(trim($DID_pattern)),$dispo_call_url); + $dispo_call_url = eregi_replace('--A--did_description--B--',urlencode(trim($DID_description)),$dispo_call_url); + $dispo_call_url = eregi_replace('--A--closecallid--B--',urlencode(trim($INclosecallid)),$dispo_call_url); + $dispo_call_url = eregi_replace('--A--xfercallid--B--',urlencode(trim($INxfercallid)),$dispo_call_url); + + if (strlen($FORMcustom_field_names)>2) + { + $custom_field_names = preg_replace("/^\||\|$/",'',$FORMcustom_field_names); + $custom_field_names = preg_replace("/\|/",",",$custom_field_names); + $custom_field_names_ARY = explode(',',$custom_field_names); + $custom_field_names_ct = count($custom_field_names_ARY); + $custom_field_names_SQL = $custom_field_names; + + ##### BEGIN grab the data from custom table for the lead_id + $stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00345',$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) + { + $row=mysql_fetch_row($rslt); + $o=0; + while ($custom_field_names_ct > $o) + { + $form_field_value = trim("$row[$o]"); + $field_name_id = $custom_field_names_ARY[$o]; + $field_name_tag = "--A--" . $field_name_id . "--B--"; + $dispo_call_url = eregi_replace("$field_name_tag","$form_field_value",$dispo_call_url); + $o++; + } + } + } + if ($DB > 0) {echo "$dispo_call_url
\n";} $SCUfile = file("$dispo_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} @@ -5932,7 +6518,91 @@ if ($ACTION == 'updateDISPO') fwrite ($fp, "$dispo_call_url\n$SCUoutput\n"); fclose($fp); } + + ### add this to the Dispo URL for callcard calls to be logged "&callcard=--A--talk_time_min--B--" + if (preg_match("/callcard/",$dispo_call_url)) + { + $stmt="SELECT balance_minutes_start,card_id FROM callcard_log where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00317',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $bms_ct = mysql_num_rows($rslt); + $fp = fopen ("./call_url_log.txt", "a"); + fwrite ($fp, "$dispo_call_url\n$stmt|$bms_ct\n"); + fclose($fp); + + if ($bms_ct > 0) + { + $row=mysql_fetch_row($rslt); + $balance_minutes_start = $row[0]; + $card_id = $row[1]; + + $current_minutes = ($balance_minutes_start - $talk_time_min); + + $stmt="UPDATE callcard_log set agent_talk_sec='$talk_time',agent_talk_min='$talk_time_min',dispo_time='$NOW_TIME',agent_dispo='$dispo' where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00318',$user,$server_ip,$session_name,$one_mysql_log);} + $ccl_update = mysql_affected_rows($link); + + $stmt="UPDATE callcard_accounts set balance_minutes='$current_minutes' where card_id='$card_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00319',$user,$server_ip,$session_name,$one_mysql_log);} + $cca_update = mysql_affected_rows($link); + + $stmt="UPDATE callcard_accounts_details set balance_minutes='$current_minutes' where card_id='$card_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00320',$user,$server_ip,$session_name,$one_mysql_log);} + $ccad_update = mysql_affected_rows($link); + } + } } + ############################################ + ### END Issue Dispo Call URL if defined + ############################################ + + + ##### check if system is set to generate logfile for dispos + $stmt="SELECT enable_agc_dispo_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00311',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $enable_agc_dispo_log_ct = mysql_num_rows($rslt); + if ($enable_agc_dispo_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_dispo_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_dispo_log > 0) ) + { + $talk_time = 0; + $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00312',$user,$server_ip,$session_name,$one_mysql_log);} + $VAL_talk_ct = mysql_num_rows($rslt); + if ($VAL_talk_ct > 0) + { + $row=mysql_fetch_row($rslt); + $talk_sec = $row[0]; + $dead_sec = $row[1]; + $talk_time = ($talk_sec - $dead_sec); + if ($talk_time < 1) + { + $talk_time = 0; + } + } + + # DATETIME|campaign|lead_id|phone_number|user|type|Call_ID||province|talk_sec| + # 2010-02-19 11:11:11|TESTCAMP|65432|3125551212|1234|D|Y09876543210987654||note|123| + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|D|$MDnextCID||$province|$talk_sec|\n"); + fclose($fp); + } + echo 'Lead ' . $lead_id . ' έχει αλλαχτεί ' . $dispo_choice . " Κατάσταση\nNext agent_log_id:\n" . $agent_log_id . "\n"; } @@ -6074,7 +6744,10 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) if ($comments != 'NO_STATUS_CHANGE') { - $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; + $vla_lead_wipeSQL=''; + if ($ACTION == 'VDADready') + {$vla_lead_wipeSQL = ",lead_id=0";} + $stmt="UPDATE vicidial_live_agents set status='$stage' $vla_lead_wipeSQL 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);} @@ -6302,7 +6975,7 @@ if ($ACTION == 'PauseCodeSubmit') $stmt = "select pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -6312,12 +6985,12 @@ if ($ACTION == 'PauseCodeSubmit') $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00307',$user,$server_ip,$session_name,$one_mysql_log);} $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00309',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00308',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -6329,14 +7002,14 @@ if ($ACTION == 'PauseCodeSubmit') $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','$status');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00307',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00309',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); $agent_log_id = mysql_insert_id($link); $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id',last_state_change='$NOW_TIME' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00308',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00310',$VD_login,$server_ip,$session_name,$one_mysql_log);} $VLAaffected_rows_update = mysql_affected_rows($link); } @@ -6434,6 +7107,8 @@ if ($ACTION == 'AGENTSview') echo ""; ### Gather agents data and statuses + $agentviewlistSQL=''; + $j=0; $stmt="SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user $AGENTviewSQL order by vu.full_name;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -6447,6 +7122,7 @@ if ($ACTION == 'AGENTSview') $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; if ( ($status=='READY') or ($status=='CLOSER') ) { @@ -6482,10 +7158,12 @@ if ($ACTION == 'AGENTSview') if ($comments=='AgentXferViewSelect') { - echo ""; - if ($agent_status_view_time > 0) - {echo "";} - echo ""; + $AXVSuserΤΑΞΙΝ[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = $call_time; + $AXVSstatuscolor[$j] = $statuscolor; + $j++; } else { @@ -6498,8 +7176,89 @@ if ($ACTION == 'AGENTSview') } $loop_count++; } + $agentviewlistSQL = eregi_replace(".$","",$agentviewlistSQL); + if (strlen($agentviewlistSQL)<3) + {$agentviewlistSQL = "''";} + + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + { + $stmt="SELECT user,full_name from vicidial_users where user NOT IN($agentviewlistSQL) order by full_name;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00301',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$agents_count = mysql_num_rows($rslt);} + $loop_count=0; + while ($agents_count > $loop_count) + { + $row=mysql_fetch_row($rslt); + $user = $row[0]; + $full_name = $row[1]; + + if ($comments=='AgentXferViewSelect') + { + $AXVSuserΤΑΞΙΝ[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = '0:00'; + $AXVSstatuscolor[$j] = 'white'; + $j++; + } + else + { + echo ""; + if ($agent_status_view_time > 0) + {echo "";} + echo ""; + } + $loop_count++; + } + } + + ### BEGIN Display the agent transfer select view ### + $k=0; + if ($comments=='AgentXferViewSelect') + { + echo "
  $row[0] - $row[2]   $call_time  
  "; + echo "$user - $full_name"; + echo "   0:00  
"; + echo "
"; + + $AXVSrecords=100; + $AXVScolumns=1; + $AXVSfontsize='12px'; + if ($j > 30) {$AXVScolumns++;} + if ($j > 60) {$AXVScolumns++; $AXVSfontsize='11px';} + if ($j > 90) {$AXVScolumns++; $AXVSfontsize='10px';} + if ($j > 120) {$AXVScolumns++; $AXVSfontsize='9px';} + $AXVSrecords = ($j / $AXVScolumns); + $AXVSrecords = round($AXVSrecords, 0); + $m=0; + + sort($AXVSuserΤΑΞΙΝ); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserΤΑΞΙΝ[$k]); + $i = $order_split[1]; + + echo ""; + if ($agent_status_view_time > 0) + {echo "";} + echo ""; + + $k++; + $m++; + if ($m >= $AXVSrecords) + { + echo "
  $AXVSuser[$i] - $AXVSfull_name[$i]   $AXVScall_time[$i]  
  "; + $m=0; + } + } + echo "
"; + } + echo "

\n"; echo "    -READY      -INCALL      -PAUSED  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} echo "\n"; } @@ -6697,6 +7456,263 @@ if ($ACTION == 'CALLSINQUEUEview') } +################################################################################ +### CALLLOGview - display one day calls for an agent +################################################################################ +if ($ACTION == 'CALLLOGview') + { + if (strlen($date) < 10) + {$date = $NOW_DATE;} + if (strlen($stage) < 3) + {$stage = '670';} + + $date_array = explode("-",$date); + $day_next = mktime(7, 0, 0, $date_array[1], ($date_array[2] + 1), $date_array[0]); + $next_day_date = date("Y-m-d",$day_next); + $day_old = mktime(7, 0, 0, $date_array[1], ($date_array[2] - 1), $date_array[0]); + $past_day_date = date("Y-m-d",$day_old); + $week_old = mktime(7, 0, 0, $date_array[1], ($date_array[2] - 7), $date_array[0]); + $past_week_date = date("Y-m-d",$week_old); + + echo "
\n"; + echo ""; + echo " << $past_week_date     "; + echo " < $past_day_date     "; + if ($NOW_DATE != $date) + {echo " $next_day_date >     ";} + echo " "; + echo "GO       "; + echo "close"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + + $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments from vicidial_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLstart_epoch[$g] = $row[0]; + $ALLcall_date[$g] = $row[1]; + $ALLcampaign_id[$g] = $row[2]; + $ALLlength_in_sec[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLphone_code[$g] = $row[5]; + $ALLphone_number[$g] = $row[6]; + $ALLlead_id[$g] = $row[7]; + $ALLhangup_reason[$g] = $row[8]; + $ALLalt_dial[$g] = $row[9]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT first_name,last_name FROM vicidial_list WHERE lead_id='$ALLlead_id[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $rowA=mysql_fetch_row($rsltA); + $Allfirst_name[$g] = $rowA[0]; + $Alllast_name[$g] = $rowA[1]; + + $g++; + $u++; + } + + $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds from vicidial_closer_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$in_logs_to_print|$stmt|";} + + $u=0; + while ($in_logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLstart_epoch[$g] = $row[0]; + $ALLcall_date[$g] = $row[1]; + $ALLcampaign_id[$g] = $row[2]; + $ALLlength_in_sec[$g] = ($row[3] - $row[9]); + if ($ALLlength_in_sec[$g] < 0) {$ALLlength_in_sec[$g]=0;} + $ALLstatus[$g] = $row[4]; + $ALLphone_code[$g] = $row[5]; + $ALLphone_number[$g] = $row[6]; + $ALLlead_id[$g] = $row[7]; + $ALLhangup_reason[$g] = $row[8]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT first_name,last_name FROM vicidial_list WHERE lead_id='$ALLlead_id[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $rowA=mysql_fetch_row($rsltA); + $Allfirst_name[$g] = $rowA[0]; + $Alllast_name[$g] = $rowA[1]; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {echo "";} + + $u=0; + while ($g > $u) + { + $sort_split = explode("-----",$ALLsort[$u]); + $i = $sort_split[1]; + + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
  #     DATE/TIME     LENGTH     ΚΑΤΑΣΤΑΣΗ     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     ΚΛΗΣΗ  
No calls στο this day
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $ALLphone_number[$i] $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Close Call Log"; + echo "
"; + } + + +################################################################################ +### LEADINFOview - display the information for a lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + ### BEGIN find any custom field labels ### + $label_title = 'Τίτλος'; + $label_first_name = 'Πρώτο'; + $label_middle_initial = 'MI'; + $label_last_name = 'Επίθετο'; + $label_address1 = 'Διεύθυνση1'; + $label_address2 = 'Διεύθυνση2'; + $label_address3 = 'Διεύθυνση3'; + $label_city = 'Πόλη'; + $label_state = 'Κράτος'; + $label_province = 'Επαρχία'; + $label_postal_code = 'Ταχ.Κωδ.'; + $label_vendor_lead_code = 'ID προμηθευτού'; + $label_gender = 'Gender'; + $label_phone_number = 'Τηλ'; + $label_phone_code = 'Κωδικός Κλήσης'; + $label_alt_phone = 'Εναλ/κό Τηλ'; + $label_security_phrase = 'Παρουσίαση'; + $label_email = 'Ηλεκτρονικό ταχυδρομείο'; + $label_comments = 'Σχόλια'; + + $stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0])>0) {$label_title = $row[0];} + if (strlen($row[1])>0) {$label_first_name = $row[1];} + if (strlen($row[2])>0) {$label_middle_initial = $row[2];} + if (strlen($row[3])>0) {$label_last_name = $row[3];} + if (strlen($row[4])>0) {$label_address1 = $row[4];} + if (strlen($row[5])>0) {$label_address2 = $row[5];} + if (strlen($row[6])>0) {$label_address3 = $row[6];} + if (strlen($row[7])>0) {$label_city = $row[7];} + if (strlen($row[8])>0) {$label_state = $row[8];} + if (strlen($row[9])>0) {$label_province = $row[9];} + if (strlen($row[10])>0) {$label_postal_code = $row[10];} + if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];} + if (strlen($row[12])>0) {$label_gender = $row[12];} + if (strlen($row[13])>0) {$label_phone_number = $row[13];} + if (strlen($row[14])>0) {$label_phone_code = $row[14];} + if (strlen($row[15])>0) {$label_alt_phone = $row[15];} + if (strlen($row[16])>0) {$label_security_phrase = $row[16];} + if (strlen($row[17])>0) {$label_email = $row[17];} + if (strlen($row[18])>0) {$label_comments = $row[18];} + ### END find any custom field labels ### + + echo "
\n"; + echo ""; + + $stmt="select status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id='$lead_id'limit 1;"; + $rslt=mysql_query($stmt, $link); + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + # echo ""; + # echo ""; + # echo ""; + } + + echo "
Κατάσταση:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Αποκαλούμενος Since Επίθετο Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         DIAL
$label_title:   $row[7]
$label_first_name:   $row[8]
$label_middle_initial:   $row[9]
$label_last_name:   $row[10]
$label_address1:   $row[11]
$label_address2:   $row[12]
$label_address3:   $row[13]
$label_city:   $row[14]
$label_state:   $row[15]
$label_province:   $row[16]
$label_postal_code:   $row[17]
Country:   $row[18]
$label_gender:   $row[19]
$label_alt_phone:   $row[20] -         DIAL
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Αποκαλούμενος Count:   $row[24]
Επίθετο Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
"; + echo "
"; + echo "Close Info Box"; + echo "
"; + } + } + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6717,12 +7733,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6747,13 +7763,27 @@ if ($ACTION == 'CALLSINQUEUEgrab') } echo "SUCCESS: Call $stage grabbed for $user"; - exit; } else { echo "ERROR: Call $stage could not be grabbed for $user\n"; - exit; } + + $stmtD="SELECT * from vicidial_auto_calls where auto_call_id='$stage';"; + $rslt=mysql_query($stmtD, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00321',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$DEBUGvac_count = mysql_num_rows($rslt);} + if ($DEBUGvac_count > 0) + { + $row=mysql_fetch_row($rslt); + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|GRAB_CALL |$stmtU|$VACaffected_rows|$stmtD|$row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|$row[14]|$row[15]|$row[16]|$row[17]|$row[18]|\n"); + fclose($fp); + } + } + exit; } } @@ -6818,7 +7848,30 @@ if ($ACTION == 'CalLBacKCounT') $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status IN('LIVE');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00332',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $cbcount_live=$row[0]; + + echo "$cbcount|$cbcount_live"; + } + + + + +################################################################################ +### customer_3way_hangup_process - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'customer_3way_hangup_process') + { + $stmt="UPDATE user_call_log SET customer_hungup='$status',customer_hungup_seconds='$stage' where lead_id='$lead_id' and user='$user' and call_type LIKE \"%3WAY%\" order by user_call_log_id desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00342',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "DONE: $stage|$lead_id|$status"; } @@ -6844,6 +7897,21 @@ if ($ACTION == 'DiaLableLeaDsCounT') } +################################################################################ +### Clear_API_Field - clears a single vicidial_live_agents field +################################################################################ +if ($ACTION == 'Clear_API_Field') + { + $stmt="UPDATE vicidial_live_agents SET $comments='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00343',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "DONE: $comments"; + } + + + if ($format=='debug') @@ -6859,11 +7927,11 @@ exit; ##### Hangup Cause Description Map ##### function hangup_cause_description($code) - { - global $hangup_cause_dictionary; - if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } - else { return "Unidentified Hangup Cause Code."; } - } +{ +global $hangup_cause_dictionary; +if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } +else { return "Unidentified Hangup Cause Code."; } +} ##### MySQL Error Logging ##### diff --git a/LANG_www/agc_el/vdc_form_display.php b/LANG_www/agc_el/vdc_form_display.php new file mode 100644 index 00000000..dc51eb31 --- /dev/null +++ b/LANG_www/agc_el/vdc_form_display.php @@ -0,0 +1,458 @@ + LICENSE: AGPLv2 +# +# This script is designed display the contents of the FORM tab in the agent +# interface, as well as take submission of the form submission when the agent +# dispositions the call +# +# CHANGELOG: +# 100630-1119 - First build of script +# 100703-1124 - Added submit_button,admin_submit fields, which will log to admin log +# 100712-2322 - Added code to log vicidial_list.entry_list_id field if data altered +# 100916-1749 - Added non-lead variable parsing +# + +$version = '2.4-4'; +$build = '100916-1749'; + +require("dbconnect.php"); +require("functions.php"); + + +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["submit_button"])) {$submit_button=$_GET["submit_button"];} + elseif (isset($_POST["submit_button"])) {$submit_button=$_POST["submit_button"];} +if (isset($_GET["admin_submit"])) {$admin_submit=$_GET["admin_submit"];} + elseif (isset($_POST["admin_submit"])) {$admin_submit=$_POST["admin_submit"];} +if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];} + elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];} + +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];} + elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];} + elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];} +if (isset($_GET["closer"])) {$closer=$_GET["closer"];} + elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];} + elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];} +if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} + elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];} + elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];} +if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];} + elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];} + elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} + elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} +if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];} + elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];} +if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];} + elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];} +if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];} + elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];} +if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];} + elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];} +if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];} + elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];} +if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];} + elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} +if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];} + elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];} +if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} + elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} +if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];} + elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];} +if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];} + elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];} +if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];} + elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];} +if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];} + elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];} +if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];} + elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];} +if (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];} + elseif (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];} +if (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];} + elseif (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];} +if (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];} + elseif (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];} +if (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];} + elseif (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];} +if (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];} + elseif (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];} +if (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];} + elseif (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];} +if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];} + elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];} +if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];} + elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];} +if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];} + elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];} +if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];} + elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];} +if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];} + elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];} +if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];} + elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];} +if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];} + elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];} +if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];} + elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} + +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 + +if ($stage=='WELCOME') + {echo "FORM"; exit;} + +$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'; +$script_height = ($script_height - 20); +if (strlen($bgcolor) < 6) {$bgcolor='FFFFFF';} + +$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|'; + +$IFRAME=0; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,custom_fields_enabled FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $timeclock_end_of_day = $row[1]; + $agentonly_callback_campaign_lock = $row[2]; + $custom_fields_enabled = $row[3]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec); + $phone_code = ereg_replace("[^0-9]","",$phone_code); + $phone_number = ereg_replace("[^0-9]","",$phone_number); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and modify_leads='1';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$VUmodify=$row[0]; + +$stmt="SELECT count(*) from vicidial_live_agents where user='$user';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$LVAactive=$row[0]; + +if ($custom_fields_enabled < 1) + { + echo "Custom Fields Disabled: |$custom_fields_enabled|\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + exit; + } + +if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ( ($LVAactive < 1) and ($VUmodify < 1) ) ) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + exit; + } +else + { + # do nothing for now + } + + +### BEGIN parse submission of the custom fields form ### +if ($stage=='SUBMIT') + { + $update_sent=0; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$list_id\";"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06001',$user,$server_ip,$session_name,$one_mysql_log);} + $tablecount_to_print = mysql_num_rows($rslt); + if ($tablecount_to_print > 0) + { + $update_SQL=''; + $VL_update_SQL=''; + $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06003',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $fields_list=''; + $o=0; + while ($fields_to_print > $o) + { + $new_field_value=''; + $form_field_value=''; + $rowx=mysql_fetch_row($rslt); + $A_field_id[$o] = $rowx[0]; + $A_field_label[$o] = $rowx[1]; + $A_field_name[$o] = $rowx[2]; + $A_field_type[$o] = $rowx[6]; + $A_field_size[$o] = $rowx[8]; + $A_field_max[$o] = $rowx[9]; + $A_field_required[$o] = $rowx[12]; + $A_field_value[$o] = ''; + $field_name_id = $A_field_label[$o]; + + if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];} + elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];} + + if ( ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='CHECKBOX') or ($A_field_type[$o]=='RADIO') ) + { + $k=0; + $multi_count = count($form_field_value); + $multi_array = $form_field_value; + while ($k < $multi_count) + { + $new_field_value .= "$multi_array[$k],"; + $k++; + } + $form_field_value = preg_replace("/,$/","",$new_field_value); + } + + if ($A_field_type[$o]=='TIME') + { + if (isset($_GET["MINUTE_$field_name_id"])) {$form_field_valueM=$_GET["MINUTE_$field_name_id"];} + elseif (isset($_POST["MINUTE_$field_name_id"])) {$form_field_valueM=$_POST["MINUTE_$field_name_id"];} + if (isset($_GET["HOUR_$field_name_id"])) {$form_field_valueH=$_GET["HOUR_$field_name_id"];} + elseif (isset($_POST["HOUR_$field_name_id"])) {$form_field_valueH=$_POST["HOUR_$field_name_id"];} + $form_field_value = "$form_field_valueH:$form_field_valueM:00"; + } + + $A_field_value[$o] = $form_field_value; + + if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + { + $VL_update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + } + else + { + $update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + } + + $SUBMIT_output .= "$A_field_name[$o]: $A_field_value[$o]
"; + } + $o++; + } + + $custom_update_count=0; + if (strlen($update_SQL)>3) + { + $custom_record_lead_count=0; + $stmt="SELECT count(*) from custom_$list_id where lead_id='$lead_id';"; + if ($DB>0) {echo "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06004',$user,$server_ip,$session_name,$one_mysql_log);} + $fieldleadcount_to_print = mysql_num_rows($rslt); + if ($fieldleadcount_to_print > 0) + { + $rowx=mysql_fetch_row($rslt); + $custom_record_lead_count = $rowx[0]; + } + $update_SQL = preg_replace("/,$/","",$update_SQL); + $custom_table_update_SQL = "INSERT INTO custom_$list_id SET lead_id='$lead_id',$update_SQL;"; + if ($custom_record_lead_count > 0) + {$custom_table_update_SQL = "UPDATE custom_$list_id SET $update_SQL where lead_id='$lead_id';";} + + $rslt=mysql_query($custom_table_update_SQL, $link); + $custom_update_count = mysql_affected_rows($link); + if ($DB) {echo "$custom_update_count|$custom_table_update_SQL\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $update_sent++; + } + + if (strlen($VL_update_SQL)>3) + { + $custom_update_vl_SQL=''; + if ($custom_update_count > 0) + {$custom_update_vl_SQL = "entry_list_id='$list_id',";} + $VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL); + $list_table_update_SQL = "UPDATE vicidial_list SET $custom_update_vl_SQL $VL_update_SQL where lead_id='$lead_id';"; + + $rslt=mysql_query($list_table_update_SQL, $link); + $list_update_count = mysql_affected_rows($link); + if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + + $update_sent++; + } + else + { + if ($custom_update_count > 0) + { + $list_table_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';"; + $rslt=mysql_query($list_table_update_SQL, $link); + $list_update_count = mysql_affected_rows($link); + if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";} + if (!$rslt) {die('Could not execute: ' . mysql_error());} + } + } + + if ( ($admin_submit=='YES') and ($update_sent > 0) ) + { + ### LOG INSERTION Admin Log Table ### + $ip = getenv("REMOTE_ADDR"); + $SQL_log = "$list_table_update_SQL|$custom_table_update_SQL|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='LEADS', event_type='MODIFY', record_id='$lead_id', event_code='ADMIN MODIFY CUSTOM LEAD', event_sql=\"$SQL_log\", event_notes='$custom_update_count|$list_update_count';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + } + } + else + {$CFoutput .= "ERROR: no custom list fields table\n";} + + echo "Custom Form Output:\n
\n"; + + echo "$SUBMIT_output"; + + echo "
\n"; + echo "\n"; + echo "
\n"; + } +### END parse submission of the custom fields form ### +else + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "ViciDial Form Display Script"; + echo "\n"; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + echo ""; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + require("functions.php"); + + $CFoutput = custom_list_fields_values($lead_id,$list_id,$uniqueid,$user); + + echo "$CFoutput"; + + if ($submit_button=='YES') + { + echo "\n"; + echo "

\n"; + } + echo "


\n"; + echo "\n"; + } + + +exit; + +?> diff --git a/LANG_www/agc_el/vdc_script_display.php b/LANG_www/agc_el/vdc_script_display.php index 8c9bb87d..fb63caf6 100644 --- a/LANG_www/agc_el/vdc_script_display.php +++ b/LANG_www/agc_el/vdc_script_display.php @@ -11,10 +11,13 @@ # 91204-1913 - Added recording_filename and recording_id variables # 91211-1103 - Added user_custom_... variables # 100116-0702 - Added preset variables +# 100127-1611 - Added ignore_list_script_override option +# 100823-1644 - Added DID variables +# 100902-1344 - Added closecallid, xfercallid, agent_log_id variables # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-8'; +$build = '100902-1344'; require("dbconnect.php"); @@ -160,10 +163,29 @@ if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];} elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];} if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];} elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];} -if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} +if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];} + elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];} +if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];} + elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];} +if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];} + elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];} +if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];} + elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];} +if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];} + elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];} +if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];} + elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];} +if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];} + elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];} +if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];} -if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];} +if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];} elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];} +if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_uses_custom_fields"];} + elseif (isset($_POST["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_POST["CF_uses_custom_fields"];} +if (isset($_GET["entry_list_id"])) {$entry_list_id=$_GET["entry_list_id"];} + elseif (isset($_POST["entry_list_id"])) {$entry_list_id=$_POST["entry_list_id"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +199,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +273,19 @@ if (strlen($in_script) < 1) else {$call_script = $in_script;} +$ignore_list_script_override='N'; +$stmt = "SELECT ignore_list_script_override FROM vicidial_inbound_groups where group_id='$group';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$ilso_ct = mysql_num_rows($rslt); +if ($ilso_ct > 0) + { + $row=mysql_fetch_row($rslt); + $ignore_list_script_override = $row[0]; + } +if ($ignore_list_script_override=='Y') + {$ignore_list_script=1;} + if ($ignore_list_script < 1) { $stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';"; @@ -262,6 +296,12 @@ if ($ignore_list_script < 1) {$call_script = $agent_script_override;} } +$stmt="SELECT list_name,list_description from vicidial_lists where list_id='$list_id';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$list_name = $row[0]; +$list_description = $row[1]; + $stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -275,6 +315,8 @@ if (eregi("iframe src",$script_text)) $vendor_id = eregi_replace(' ','+',$vendor_id); $vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code); $list_id = eregi_replace(' ','+',$list_id); + $list_name = eregi_replace(' ','+',$list_name); + $list_description = eregi_replace(' ','+',$list_description); $gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now); $phone_code = eregi_replace(' ','+',$phone_code); $phone_number = eregi_replace(' ','+',$phone_number); @@ -342,12 +384,18 @@ if (eregi("iframe src",$script_text)) $preset_number_f = eregi_replace(' ','+',$preset_number_f); $preset_dtmf_a = eregi_replace(' ','+',$preset_dtmf_a); $preset_dtmf_b = eregi_replace(' ','+',$preset_dtmf_b); + $did_id = eregi_replace(' ','+',$did_id); + $did_extension = eregi_replace(' ','+',$did_extension); + $did_pattern = eregi_replace(' ','+',$did_pattern); + $did_description = eregi_replace(' ','+',$did_description); } $script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text); $script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text); $script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); $script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--list_name--B--',"$list_name",$script_text); +$script_text = eregi_replace('--A--list_description--B--',"$list_description",$script_text); $script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); $script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); $script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); @@ -415,6 +463,36 @@ $script_text = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$scr $script_text = eregi_replace('--A--preset_number_f--B--',"$preset_number_f",$script_text); $script_text = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$script_text); $script_text = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$script_text); +$script_text = eregi_replace('--A--did_id--B--',"$did_id",$script_text); +$script_text = eregi_replace('--A--did_extension--B--',"$did_extension",$script_text); +$script_text = eregi_replace('--A--did_pattern--B--',"$did_pattern",$script_text); +$script_text = eregi_replace('--A--did_description--B--',"$did_description",$script_text); +$script_text = eregi_replace('--A--closecallid--B--',"$closecallid",$script_text); +$script_text = eregi_replace('--A--xfercallid--B--',"$xfercallid",$script_text); +$script_text = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$script_text); +$script_text = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$script_text); + +if ($CF_uses_custom_fields=='Y') + { + ### find the names of all custom fields, if any + $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cffn_ct = mysql_num_rows($rslt); + $d=0; + while ($cffn_ct > $d) + { + $row=mysql_fetch_row($rslt); + $field_name_id = $row[0]; + $field_name_tag = "--A--" . $field_name_id . "--B--"; + if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];} + elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];} + $script_text = eregi_replace("$field_name_tag","$form_field_value",$script_text); + if ($DB) {echo "$d|$field_name_id|$field_name_tag|$form_field_value|
\n";} + $d++; + } + } + $script_text = eregi_replace("\n","
",$script_text); $script_text = stripslashes($script_text); diff --git a/LANG_www/agc_el/vdc_script_notes.php b/LANG_www/agc_el/vdc_script_notes.php new file mode 100644 index 00000000..1ec78d25 --- /dev/null +++ b/LANG_www/agc_el/vdc_script_notes.php @@ -0,0 +1,648 @@ + LICENSE: AGPLv2 +# +# This script is designed open in the SCRIPT tab in the agent interface through +# an IFRAME. It will create a new record for every SUBMIT +# +# Example of a ViciDial agent SCRIPT using this script: +# +# +# CHANGELOG: +# 100215-0744 - First build of script +# 100622-2230 - Added field labels +# + +$version = '2.4-2'; +$build = '100622-2230'; + +require("dbconnect.php"); + + +if (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} + elseif (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} +if (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} + elseif (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + $vendor_lead_code = $vendor_id; +if (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} + elseif (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} +if (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];} + elseif (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];} +if (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} + elseif (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} +if (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} + elseif (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} +if (isset($_POST["title"])) {$title=$_POST["title"];} + elseif (isset($_GET["title"])) {$title=$_GET["title"];} +if (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} + elseif (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} +if (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];} + elseif (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];} +if (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} + elseif (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} +if (isset($_POST["address1"])) {$address1=$_POST["address1"];} + elseif (isset($_GET["address1"])) {$address1=$_GET["address1"];} +if (isset($_POST["address2"])) {$address2=$_POST["address2"];} + elseif (isset($_GET["address2"])) {$address2=$_GET["address2"];} +if (isset($_POST["address3"])) {$address3=$_POST["address3"];} + elseif (isset($_GET["address3"])) {$address3=$_GET["address3"];} +if (isset($_POST["city"])) {$city=$_POST["city"];} + elseif (isset($_GET["city"])) {$city=$_GET["city"];} +if (isset($_POST["state"])) {$state=$_POST["state"];} + elseif (isset($_GET["state"])) {$state=$_GET["state"];} +if (isset($_POST["province"])) {$province=$_POST["province"];} + elseif (isset($_GET["province"])) {$province=$_GET["province"];} +if (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} + elseif (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} +if (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} + elseif (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} +if (isset($_POST["gender"])) {$gender=$_POST["gender"];} + elseif (isset($_GET["gender"])) {$gender=$_GET["gender"];} +if (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];} + elseif (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];} +if (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} + elseif (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} +if (isset($_POST["email"])) {$email=$_POST["email"];} + elseif (isset($_GET["email"])) {$email=$_GET["email"];} +if (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];} + elseif (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];} +if (isset($_POST["comments"])) {$comments=$_POST["comments"];} + elseif (isset($_GET["comments"])) {$comments=$_GET["comments"];} +if (isset($_POST["user"])) {$user=$_POST["user"];} + elseif (isset($_GET["user"])) {$user=$_GET["user"];} +if (isset($_POST["pass"])) {$pass=$_POST["pass"];} + elseif (isset($_GET["pass"])) {$pass=$_GET["pass"];} +if (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} + elseif (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} +if (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} + elseif (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} +if (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];} + elseif (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];} +if (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} + elseif (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} +if (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];} + elseif (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];} +if (isset($_POST["closer"])) {$closer=$_POST["closer"];} + elseif (isset($_GET["closer"])) {$closer=$_GET["closer"];} +if (isset($_POST["group"])) {$group=$_POST["group"];} + elseif (isset($_GET["group"])) {$group=$_GET["group"];} +if (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} + elseif (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} +if (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];} + elseif (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];} +if (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} + elseif (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} +if (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} + elseif (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} +if (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];} + elseif (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];} +if (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];} + elseif (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];} +if (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} + elseif (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} +if (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];} + elseif (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];} +if (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} + elseif (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} +if (isset($_POST["phone"])) {$phone=$_POST["phone"];} + elseif (isset($_GET["phone"])) {$phone=$_GET["phone"];} +if (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} + elseif (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} +if (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} + elseif (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} +if (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];} + elseif (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];} +if (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];} + elseif (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];} +if (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];} + elseif (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];} +if (isset($_POST["rank"])) {$rank=$_POST["rank"];} + elseif (isset($_GET["rank"])) {$rank=$_GET["rank"];} +if (isset($_POST["owner"])) {$owner=$_POST["owner"];} + elseif (isset($_GET["owner"])) {$owner=$_GET["owner"];} +if (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];} + elseif (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];} +if (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];} + elseif (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];} +if (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];} + elseif (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];} +if (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];} + elseif (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];} +if (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} + elseif (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} +if (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];} + elseif (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];} +if (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} + elseif (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} +if (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];} + elseif (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];} +if (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];} + elseif (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];} +if (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];} + elseif (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];} +if (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];} + elseif (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];} +if (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];} + elseif (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];} +if (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];} + elseif (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];} +if (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];} + elseif (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];} +if (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];} + elseif (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];} +if (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];} + elseif (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];} +if (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];} + elseif (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];} +if (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];} + elseif (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];} +if (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];} + elseif (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];} +if (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];} + elseif (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];} +if (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];} + elseif (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} +if (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];} + elseif (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];} + +if (isset($_POST["DB"])) {$DB=$_POST["DB"];} + elseif (isset($_GET["DB"])) {$DB=$_GET["DB"];} +if (isset($_POST["process"])) {$process=$_POST["process"];} + elseif (isset($_GET["process"])) {$process=$_GET["process"];} +if (isset($_POST["vicidial_id"])) {$vicidial_id=$_POST["vicidial_id"];} + elseif (isset($_GET["vicidial_id"])) {$vicidial_id=$_GET["vicidial_id"];} +if (isset($_POST["call_date"])) {$call_date=$_POST["call_date"];} + elseif (isset($_GET["call_date"])) {$call_date=$_GET["call_date"];} +if (isset($_POST["order_id"])) {$order_id=$_POST["order_id"];} + elseif (isset($_GET["order_id"])) {$order_id=$_GET["order_id"];} +if (isset($_POST["appointment_date"])) {$appointment_date=$_POST["appointment_date"];} + elseif (isset($_GET["appointment_date"])) {$appointment_date=$_GET["appointment_date"];} +if (isset($_POST["appointment_time"])) {$appointment_time=$_POST["appointment_time"];} + elseif (isset($_GET["appointment_time"])) {$appointment_time=$_GET["appointment_time"];} +if (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} + elseif (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} +if (isset($_POST["notesid"])) {$notesid=$_POST["notesid"];} + elseif (isset($_GET["notesid"])) {$notesid=$_GET["notesid"];} +if ($notesid < 100) + {$notesid=0;} +if (strlen($vicidial_id) < 1) + {$vicidial_id = $uniqueid;} +if (strlen($appointment_time) < 1) + {$appointment_time = '12:00:00';} + +$appointment_timeARRAY = explode(":",$appointment_time); +$appointment_hour = $appointment_timeARRAY[0]; +$appointment_min = $appointment_timeARRAY[1]; + +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'; + +if (strlen($call_date) < 1) + {$call_date = $NOW_TIME;} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $timeclock_end_of_day = $row[1]; + $agentonly_callback_campaign_lock = $row[2]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec); + $phone_code = ereg_replace("[^0-9]","",$phone_code); + $phone_number = ereg_replace("[^0-9]","",$phone_number); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + +if ($DB > 0) + { + echo "
$lead_id|$entry_date|$modify_date|$status|$user|$vendor_lead_code|$source_id|$list_id|$gmt_offset_now|$called_since_last_reset|$phone_code|$phone_number|$title|$first_name|$middle_initial|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country_code|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$last_local_call_time|$rank|$owner|\n
"; + } + +### BEGIN find any custom field labels ### +$label_title = 'Τίτλος'; +$label_first_name = 'Πρώτο'; +$label_middle_initial = 'MI'; +$label_last_name = 'Επίθετο'; +$label_address1 = 'Διεύθυνση1'; +$label_address2 = 'Διεύθυνση2'; +$label_address3 = 'Διεύθυνση3'; +$label_city = 'Πόλη'; +$label_state = 'Κράτος'; +$label_province = 'Επαρχία'; +$label_postal_code = 'Ταχ.Κωδ.'; +$label_vendor_lead_code = 'ID προμηθευτού'; +$label_gender = 'Gender'; +$label_phone_number = 'Τηλ'; +$label_phone_code = 'Κωδικός Κλήσης'; +$label_alt_phone = 'Εναλ/κό Τηλ'; +$label_security_phrase = 'Παρουσίαση'; +$label_email = 'Ηλεκτρονικό ταχυδρομείο'; +$label_comments = 'Σχόλια'; + +$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +if (strlen($row[0])>0) {$label_title = $row[0];} +if (strlen($row[1])>0) {$label_first_name = $row[1];} +if (strlen($row[2])>0) {$label_middle_initial = $row[2];} +if (strlen($row[3])>0) {$label_last_name = $row[3];} +if (strlen($row[4])>0) {$label_address1 = $row[4];} +if (strlen($row[5])>0) {$label_address2 = $row[5];} +if (strlen($row[6])>0) {$label_address3 = $row[6];} +if (strlen($row[7])>0) {$label_city = $row[7];} +if (strlen($row[8])>0) {$label_state = $row[8];} +if (strlen($row[9])>0) {$label_province = $row[9];} +if (strlen($row[10])>0) {$label_postal_code = $row[10];} +if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];} +if (strlen($row[12])>0) {$label_gender = $row[12];} +if (strlen($row[13])>0) {$label_phone_number = $row[13];} +if (strlen($row[14])>0) {$label_phone_code = $row[14];} +if (strlen($row[15])>0) {$label_alt_phone = $row[15];} +if (strlen($row[16])>0) {$label_security_phrase = $row[16];} +if (strlen($row[17])>0) {$label_email = $row[17];} +if (strlen($row[18])>0) {$label_comments = $row[18];} +### END find any custom field labels ### + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +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($user)<2) or (strlen($pass)<2) or ($auth==0)) + { + echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Σημειώσεις"; +echo "\n"; +echo "\n"; +echo "\n"; +?> + +\n"; +echo "\n"; + +if ($process > 0) + { + #Update vicidial_list record + $stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + #Update the agent screen with new data + $stmt="UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='vendor_lead_code,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,phone_code,phone_number,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($notesid < 100) + { + # Insert into vicidial_call_notes + $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $notesid = mysql_insert_id($link); + } + else + { + # update vicidial_call_notes record + $stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + + echo "
Data Changes Accepted

"; + } + +$URLarray = explode("?", $PHP_SELF); +$URLsubmit = $URLarray[0]; +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+> + + + + + + + + + + + + + + + + + + +
: *
: *
: *
:
:
: *
: + *
: *
: *
Order ID:
Appointment Date/Time: + + + + + + + +
Appointment Σημειώσεις:

+
Please click ΥΠΟΒΑΛΕΤΕ to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + + + + + + + + + + diff --git a/LANG_www/agc_el/vicidial.php b/LANG_www/agc_el/vicidial.php index f4250380..ae613249 100644 --- a/LANG_www/agc_el/vicidial.php +++ b/LANG_www/agc_el/vicidial.php @@ -8,6 +8,7 @@ # - manager_send.php: Sends manager actions to the DB for execution # - conf_exten_check.php: time sync and status updater, calls in queue # - vdc_script_display.php: displays script with variables +# - vdc_form_display.php: display custom fields form # # CHANGELOG # 50607-1426 - First Build of VICIDIAL web client basic login process finished @@ -272,23 +273,64 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field -# 100309-1709 - small fix for IE CRM popup -# 100315-1149 - fix for rare recording_log uniqueid issue on manual dial calls to same number -# 100327-0902 - fix for manual dial answering machine message -# 100413-1347 - Various fixes for logging and extended alt-dialing +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 100423-1156 - Added more user logging data and manual_dial_override, blind monitor warnings, uniqueid display and codec features +# 100428-0544 - Added uniqueid display option for PRESERVE +# 100513-0714 - Added options.php option to hide the timeclock link +# 100513-2337 - Changed user_login_first to attempt full login if phone_login/pass are filled in +# 100527-2212 - Added API send_dtmf, transfer_conference and park_call functions +# 100616-1622 - Allowed longer manual dial numbers +# 100622-2209 - Added field labels +# 100625-1118 - Added poor-network-connection-mitigating code +# 100629-1158 - Added initial code for custom list fields +# 100702-1315 - Custom List Fields functionality enabled +# 100712-1441 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any +# 100723-1522 - Added LOCKED options for quick transfer button feature +# 100726-1233 - Added HANGUP, CALLMENU, EXTENSION, IN_GROUP timer actions +# 100803-2324 - Cleanup of URLDecode (issue #375) +# 100811-0810 - Added webphone_url_override option from user Groups +# 100813-0554 - Added Campaign presets +# 100815-1015 - Added manual_dial_prefix campaign option +# 100823-1605 - Added DID variables for webform and scripting +# 100827-1436 - Added webphone dialpad options +# 100902-0046 - Added initial loading screen +# 100902-1349 - Added closecallid, xfercallid, agent_log_id as webform and script variables +# 100908-0955 - Added customer 3way hangup +# 100912-1304 - Changed Dispo screen phone number display to dialed_number +# 100927-1616 - Added custom fields ability to web forms and optimized related code +# 101004-1322 - Added "IVR Park Call" button in agent interface +# 101006-1358 - Raised limits on several dynamic items from the database +# 101008-0356 - Added manual_preview_dial and two new variables for recording filenames +# 101012-1656 - Added scroll command at dispo submission to for scrolling to the top of the screen +# 101024-1639 - Added parked call counter +# 101108-0110 - Added ADDMEMBER option for queue_log # -$version = '2.2.0-258'; -$build = '100413-1347'; +$version = '2.4-298'; +$build = '101108-0110'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=69; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -365,7 +407,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled 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";} @@ -384,6 +426,8 @@ if ($qm_conf_ct > 0) $outbound_autodial_active = $row[8]; $enable_second_webform = $row[9]; $user_territories_active = $row[10]; + $static_agent_url = $row[11]; + $custom_fields_enabled = $row[12]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -391,49 +435,98 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### -$conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording -$dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently -$HKuser_level = '5'; # minimum vicidial user_level for HotKeys -$campaign_login_list = '1'; # show drop-down list of campaigns at login -$manual_dial_preview = '1'; # allow preview lead option when manual dial -$multi_line_comments = '1'; # set to 1 to allow multi-line comment box -$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login -$view_scripts = '1'; # set to 1 to show the SCRIPTS tab -$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo -$callholdstatus = '1'; # set to 1 to show calls στο hold count -$agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count - $campagentstatctmax = '3'; # Number of δευτερόλεπτα for campaign call and agent stats -$show_campname_pulldown = '1'; # set to 1 to show campaign name στο login pulldown -$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL -$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server -$clientDST = '1'; # set to 1 to check for DST στο server for agent time -$no_delete_sessions = '1'; # set to 1 to not delete sessions at logout -$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels -$PreseT_DiaL_LinKs = '0'; # set to 1 to show a ΚΛΗΣΗ link for Dial Presets -$LogiNAJAX = '1'; # set to 1 to do lookups στο campaigns for login -$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" -$hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Κλείσιμο Πελάτη -$LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout -$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login -$DefaulTAlTDiaL = '0'; # set to 1 to enable ALT ΚΛΗΣΗ by default if enabled for the campaign -$AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option -$disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +if (file_exists('options.php')) + { + require('options.php'); + } +else + { + $conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording + $dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently + $HKuser_level = '5'; # minimum vicidial user_level for HotKeys + $campaign_login_list = '1'; # show drop-down list of campaigns at login + $manual_dial_preview = '1'; # allow preview lead option when manual dial + $multi_line_comments = '1'; # set to 1 to allow multi-line comment box + $user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login + $view_scripts = '1'; # set to 1 to show the SCRIPTS tab + $dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo + $callholdstatus = '1'; # set to 1 to show calls στο hold count + $agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count + $campagentstatctmax = '3'; # Number of δευτερόλεπτα for campaign call and agent stats + $show_campname_pulldown = '1'; # set to 1 to show campaign name στο login pulldown + $webform_sessionname = '1'; # set to 1 to include the session_name in webform URL + $local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server + $clientDST = '1'; # set to 1 to check for DST στο server for agent time + $no_delete_sessions = '1'; # set to 1 to not delete sessions at logout + $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels + $PreseT_DiaL_LinKs = '0'; # set to 1 to show a ΚΛΗΣΗ link for Dial Presets + $LogiNAJAX = '1'; # set to 1 to do lookups στο campaigns for login + $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" + $hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Κλείσιμο Πελάτη + $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout + $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login + $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT ΚΛΗΣΗ by default if enabled for the campaign + $AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option + $disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen + $hide_timeclock_link = '0'; # set to 1 to hide the timeclock link στο the agent login screen + $conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups -$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window -$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 -$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 -$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 -$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 -$SIDEBAR_COLOR = '#F6F6F6'; + $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen -# options now set in DB: -#$alt_phone_dialing = '1'; # allow agents to call alt phone numbers -#$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks -# $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks -#$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session + $stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window + $BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 + $BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 + $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 + $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 + $FORM_COLOR = '#EFEFEF'; + $SIDEBAR_COLOR = '#F6F6F6'; + } +### BEGIN find any custom field labels ### +$label_title = 'Τίτλος'; +$label_first_name = 'Πρώτο'; +$label_middle_initial = 'MI'; +$label_last_name = 'Επίθετο'; +$label_address1 = 'Διεύθυνση1'; +$label_address2 = 'Διεύθυνση2'; +$label_address3 = 'Διεύθυνση3'; +$label_city = 'Πόλη'; +$label_state = 'Κράτος'; +$label_province = 'Επαρχία'; +$label_postal_code = 'Ταχ.Κωδ.'; +$label_vendor_lead_code = 'ID προμηθευτού'; +$label_gender = 'Gender'; +$label_phone_number = 'Τηλ'; +$label_phone_code = 'Κωδικός Κλήσης'; +$label_alt_phone = 'Εναλ/κό Τηλ'; +$label_security_phrase = 'Παρουσίαση'; +$label_email = 'Ηλεκτρονικό ταχυδρομείο'; +$label_comments = 'Σχόλια'; + +$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +if (strlen($row[0])>0) {$label_title = $row[0];} +if (strlen($row[1])>0) {$label_first_name = $row[1];} +if (strlen($row[2])>0) {$label_middle_initial = $row[2];} +if (strlen($row[3])>0) {$label_last_name = $row[3];} +if (strlen($row[4])>0) {$label_address1 = $row[4];} +if (strlen($row[5])>0) {$label_address2 = $row[5];} +if (strlen($row[6])>0) {$label_address3 = $row[6];} +if (strlen($row[7])>0) {$label_city = $row[7];} +if (strlen($row[8])>0) {$label_state = $row[8];} +if (strlen($row[9])>0) {$label_province = $row[9];} +if (strlen($row[10])>0) {$label_postal_code = $row[10];} +if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];} +if (strlen($row[12])>0) {$label_gender = $row[12];} +if (strlen($row[13])>0) {$label_phone_number = $row[13];} +if (strlen($row[14])>0) {$label_phone_code = $row[14];} +if (strlen($row[15])>0) {$label_alt_phone = $row[15];} +if (strlen($row[16])>0) {$label_security_phrase = $row[16];} +if (strlen($row[17])>0) {$label_email = $row[17];} +if (strlen($row[18])>0) {$label_comments = $row[18];} +### END find any custom field labels ### $US='_'; $CL=':'; @@ -451,6 +544,8 @@ if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} else {$server_port = "$CL$server_port";} $agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; $agcDIR = eregi_replace('vicidial.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} header ("Content-type: text/html; charset=utf-8"); @@ -664,66 +759,28 @@ else } if ($relogin == 'YES') -{ -echo "Agent web client: Επανασύνδεση\n"; -echo "\n"; -echo "\n"; -echo " Timeclock
\n"; -echo "\n"; -echo "\n"; -echo "\n";echo "\n";echo "
English Ελληνικά
\n"; -echo "
\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "


"; -echo ""; -echo ""; -echo "\n"; -echo "\n"; -echo ""; -echo "\n"; -echo ""; -echo "\n"; -echo ""; -echo "\n"; -echo ""; -echo "\n"; -echo ""; -echo "\n"; -echo "\n"; -echo "\n"; -echo "
Επανασύνδεση
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη:
Εκστρατεία: $camp_form_code
  \n"; -echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; -echo "\n\n"; -echo "\n\n"; -echo "\n\n"; -exit; -} - -if ($user_login_first == 1) -{ - if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) { - echo "Agent web client: Σύνδεση εκστρατείας\n"; + echo "Agent web client: Επανασύνδεση\n"; echo "\n"; echo "\n"; - echo " Timeclock
\n"; + if ($hide_timeclock_link < 1) + {echo " Timeclock
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; - echo "
\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; - #echo "\n"; - #echo "\n"; - echo "

Σύνδεση χρήστη

"; - echo ""; + echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; echo ""; echo "\n"; echo ""; @@ -731,7 +788,7 @@ echo ""; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "
Σύνδεση εκστρατείας Επανασύνδεση
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη: Εκστρατεία: $camp_form_code
  \n"; - echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; echo "\n\n"; @@ -739,22 +796,16 @@ echo "\n\n"; exit; } - else - { - if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) - { - $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01005',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $phone_login=$row[0]; - $phone_pass=$row[1]; - echo "Agent web client: Login\n"; +if ($user_login_first == 1) + { + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Agent web client: Σύνδεση εκστρατείας\n"; echo "\n"; echo "\n"; - echo " Timeclock
\n"; + if ($hide_timeclock_link < 1) + {echo " Timeclock
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; @@ -762,15 +813,14 @@ echo "\n"; echo "\n"; echo "\n"; - echo "


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

Σύνδεση χρήστη

"; + echo "
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; - echo "\n"; - echo ""; - echo "\n"; echo ""; echo "\n"; echo ""; @@ -785,262 +835,1568 @@ echo "
Σύνδεση Σύνδεση εκστρατείας
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη: \n\n"; echo "\n\n"; exit; + } + else + { + if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $phone_login=$row[0]; + $phone_pass=$row[1]; + if ( (strlen($phone_login) < 1) or (strlen($phone_pass) < 1) ) + { + echo "Agent web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Σύνδεση
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη:
Εκστρατεία: $camp_form_code
  \n"; + echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + } } } -} if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) -{ -echo "Agent web client: Σύνδεση Τηλεφώνου\n"; -echo "\n"; -echo "\n"; -echo " Timeclock
\n"; -echo "\n"; -echo "\n"; -echo "\n";echo "\n";echo "
English Ελληνικά
\n"; -echo "
\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "


"; -echo ""; -echo ""; -echo "\n"; -echo "\n"; -echo ""; -echo "\n"; -echo ""; -echo "\n"; -echo "\n"; -echo "\n"; -echo "
Σύνδεση Τηλεφώνου
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
  \n"; -echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; -echo "\n\n"; -echo "\n\n"; -echo "\n\n"; -exit; -} + { + echo "Agent web client: Σύνδεση Τηλεφώνου\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Σύνδεση Τηλεφώνου
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
  \n"; + echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } else -{ -if ($WeBRooTWritablE > 0) - {$fp = fopen ("./vicidial_auth_entries.txt", "a");} -$VDloginDISPLAY=0; + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) ) - { - $VDloginDISPLAY=1; - } - else - { - $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01006',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $auth=$row[0]; - - if($auth>0) { - $login=strtoupper($VD_login); - $password=strtoupper($VD_pass); - ##### grab the full name of the agent - $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $VDloginDISPLAY=1; + } + else + { + $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';"; + if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01006',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - $LOGfullname = $row[0]; - $user_level = $row[1]; - $VU_hotkeys_active = $row[2]; - $VU_agent_choose_ingroups = $row[3]; - $VU_scheduled_callbacks = $row[4]; - $agentonly_callbacks = $row[5]; - $agentcall_manual = $row[6]; - $VU_vicidial_recording = $row[7]; - $VU_vicidial_transfers = $row[8]; - $VU_closer_default_blended = $row[9]; - $VU_user_group = $row[10]; - $VU_vicidial_recording_override = $row[11]; - $VU_alter_custphone_override = $row[12]; - $VU_alert_enabled = $row[13]; - $VU_agent_shift_enforcement_override = $row[14]; - $VU_shift_override_flag = $row[15]; - $VU_allow_alerts = $row[16]; - $VU_closer_campaigns = $row[17]; - $VU_agent_choose_territories = $row[18]; - $VU_custom_one = $row[19]; - $VU_custom_two = $row[20]; - $VU_custom_three = $row[21]; - $VU_custom_four = $row[22]; - $VU_custom_five = $row[23]; + $auth=$row[0]; - if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';} - else {$VU_alert_enabled = 'OFF';} - $AgentAlert_allowed = $VU_allow_alerts; - - ### Gather timeclock and shift enforcement restriction settings - $stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts,agent_status_viewable_groups,agent_status_view_time from vicidial_user_groups where user_group='$VU_user_group';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $forced_timeclock_login = $row[0]; - $shift_enforcement = $row[1]; - $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[2]); - $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL); - $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')"; - $agent_status_viewable_groups = $row[3]; - $agent_status_viewable_groupsSQL = eregi_replace(' ','',$agent_status_viewable_groups); - $agent_status_viewable_groupsSQL = eregi_replace(' ',"','",$agent_status_viewable_groupsSQL); - $agent_status_viewable_groupsSQL = "user_group IN('$agent_status_viewable_groupsSQL')"; - $agent_status_view = 0; - if (strlen($agent_status_viewable_groups) > 2) - {$agent_status_view = 1;} - $agent_status_view_time=0; - if ($row[4] == 'Y') - {$agent_status_view_time=1;} - - ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR - if ( (ereg('Y',$forced_timeclock_login)) or ( (ereg('ADMIN_EXEMPT',$forced_timeclock_login)) and ($VU_user_level < 8) ) ) + if($auth>0) { - $last_agent_event=''; - $HHMM = date("Hi"); - $HHteod = substr($timeclock_end_of_day,0,2); - $MMteod = substr($timeclock_end_of_day,2,2); - - if ($HHMM < $timeclock_end_of_day) - {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));} - else - {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));} - - $EoDdate = date("Y-m-d H:i:s", $EoD); - - ##### grab timeclock logged-in time for each user ##### - $stmt="SELECT event from vicidial_timeclock_log where user='$VD_login' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;"; + $login=strtoupper($VD_login); + $password=strtoupper($VD_pass); + ##### grab the full name of the agent + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,agent_call_log_view_override,agent_choose_blended from vicidial_users where user='$VD_login' and pass='$VD_pass'"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01053',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $events_to_parse = mysql_num_rows($rslt); - if ($events_to_parse > 0) - { - $rowx=mysql_fetch_row($rslt); - $last_agent_event = $rowx[0]; - } - if ($DB>0) {echo "|$stmt|$events_to_parse|$last_agent_event|";} - if ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) ) - { - $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "Πρέπει πρώτα να συνδεθείτε στο TIMECLOCK
"; - } - } - ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_hotkeys_active = $row[2]; + $VU_agent_choose_ingroups = $row[3]; + $VU_scheduled_callbacks = $row[4]; + $agentonly_callbacks = $row[5]; + $agentcall_manual = $row[6]; + $VU_vicidial_recording = $row[7]; + $VU_vicidial_transfers = $row[8]; + $VU_closer_default_blended = $row[9]; + $VU_user_group = $row[10]; + $VU_vicidial_recording_override = $row[11]; + $VU_alter_custphone_override = $row[12]; + $VU_alert_enabled = $row[13]; + $VU_agent_shift_enforcement_override = $row[14]; + $VU_shift_override_flag = $row[15]; + $VU_allow_alerts = $row[16]; + $VU_closer_campaigns = $row[17]; + $VU_agent_choose_territories = $row[18]; + $VU_custom_one = $row[19]; + $VU_custom_two = $row[20]; + $VU_custom_three = $row[21]; + $VU_custom_four = $row[22]; + $VU_custom_five = $row[23]; + $VU_agent_call_log_view_override = $row[24]; + $VU_agent_choose_blended = $row[25]; - ### BEGIN - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR - if ( ( (ereg("START|ALL",$shift_enforcement)) and (!ereg("OFF",$VU_agent_shift_enforcement_override)) ) or (ereg("START|ALL",$VU_agent_shift_enforcement_override)) ) - { - $shift_ok=0; - if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) - { - $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "ERROR: There are no Shifts enabled for your user group
"; - } - else + + if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';} + else {$VU_alert_enabled = 'OFF';} + $AgentAlert_allowed = $VU_allow_alerts; + + ### Gather timeclock and shift enforcement restriction settings + $stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts,agent_status_viewable_groups,agent_status_view_time,agent_call_log_view,agent_xfer_consultative,agent_xfer_dial_override,agent_xfer_vm_transfer,agent_xfer_blind_transfer,agent_xfer_dial_with_customer,agent_xfer_park_customer_dial,agent_fullscreen,webphone_url_override,webphone_dialpad_override,webphone_systemkey_override from vicidial_user_groups where user_group='$VU_user_group';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $forced_timeclock_login = $row[0]; + $shift_enforcement = $row[1]; + $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[2]); + $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL); + $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')"; + $agent_status_viewable_groups = $row[3]; + $agent_status_viewable_groupsSQL = eregi_replace(' ','',$agent_status_viewable_groups); + $agent_status_viewable_groupsSQL = eregi_replace(' ',"','",$agent_status_viewable_groupsSQL); + $agent_status_viewable_groupsSQL = "user_group IN('$agent_status_viewable_groupsSQL')"; + $agent_status_view = 0; + if (strlen($agent_status_viewable_groups) > 2) + {$agent_status_view = 1;} + $agent_status_view_time=0; + if ($row[4] == 'Y') + {$agent_status_view_time=1;} + if ($row[5] == 'Y') + {$agent_call_log_view=1;} + if ($row[6] == 'Y') + {$agent_xfer_consultative=1;} + if ($row[7] == 'Y') + {$agent_xfer_dial_override=1;} + if ($row[8] == 'Y') + {$agent_xfer_vm_transfer=1;} + if ($row[9] == 'Y') + {$agent_xfer_blind_transfer=1;} + if ($row[10] == 'Y') + {$agent_xfer_dial_with_customer=1;} + if ($row[11] == 'Y') + {$agent_xfer_park_customer_dial=1;} + if ($VU_agent_call_log_view_override == 'Y') + {$agent_call_log_view=1;} + if ($VU_agent_call_log_view_override == 'N') + {$agent_call_log_view=0;} + $agent_fullscreen = $row[12]; + $webphone_url = $row[13]; + $webphone_dialpad_override = $row[14]; + $system_key = $row[15]; + if ( ($webphone_dialpad_override != 'DISABLED') and (strlen($webphone_dialpad_override) > 0) ) + {$webphone_dialpad = $webphone_dialpad_override;} + + ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + if ( (ereg('Y',$forced_timeclock_login)) or ( (ereg('ADMIN_EXEMPT',$forced_timeclock_login)) and ($VU_user_level < 8) ) ) { + $last_agent_event=''; $HHMM = date("Hi"); - $wday = date("w"); + $HHteod = substr($timeclock_end_of_day,0,2); + $MMteod = substr($timeclock_end_of_day,2,2); - $stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id"; + if ($HHMM < $timeclock_end_of_day) + {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));} + else + {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));} + + $EoDdate = date("Y-m-d H:i:s", $EoD); + + ##### grab timeclock logged-in time for each user ##### + $stmt="SELECT event from vicidial_timeclock_log where user='$VD_login' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $shifts_to_print = mysql_num_rows($rslt); - - $o=0; - while ( ($shifts_to_print > $o) and ($shift_ok < 1) ) + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01053',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $events_to_parse = mysql_num_rows($rslt); + if ($events_to_parse > 0) { $rowx=mysql_fetch_row($rslt); - $shift_id = $rowx[0]; - $shift_start_time = $rowx[1]; - $shift_length = $rowx[2]; - $shift_weekdays = $rowx[3]; - - if (eregi("$wday",$shift_weekdays)) - { - $HHshift_length = substr($shift_length,0,2); - $MMshift_length = substr($shift_length,3,2); - $HHshift_start_time = substr($shift_start_time,0,2); - $MMshift_start_time = substr($shift_start_time,2,2); - $HHshift_end_time = ($HHshift_length + $HHshift_start_time); - $MMshift_end_time = ($MMshift_length + $MMshift_start_time); - if ($MMshift_end_time > 59) - { - $MMshift_end_time = ($MMshift_end_time - 60); - $HHshift_end_time++; - } - if ($HHshift_end_time > 23) - {$HHshift_end_time = ($HHshift_end_time - 24);} - $HHshift_end_time = sprintf("%02s", $HHshift_end_time); - $MMshift_end_time = sprintf("%02s", $MMshift_end_time); - $shift_end_time = "$HHshift_end_time$MMshift_end_time"; - - if ( - ( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or - ( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or - ( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) ) - ) - {$shift_ok++;} - } - $o++; + $last_agent_event = $rowx[0]; } - - if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) ) + if ($DB>0) {echo "|$stmt|$events_to_parse|$last_agent_event|";} + if ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) ) { $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "ERROR: You are not allowed to log in outside of your shift
"; + $VDdisplayMESSAGE = "Πρέπει πρώτα να συνδεθείτε στο TIMECLOCK
"; } } - if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) ) + ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + + ### BEGIN - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR + if ( ( (ereg("START|ALL",$shift_enforcement)) and (!ereg("OFF",$VU_agent_shift_enforcement_override)) ) or (ereg("START|ALL",$VU_agent_shift_enforcement_override)) ) { - $VDdisplayMESSAGE.= "

MANAGER OVERRIDE:
\n"; - $VDdisplayMESSAGE.= "
\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "Διευθυντής Σύνδεση:
\n"; - $VDdisplayMESSAGE.= "Διευθυντής Κωδικός πρόσβασης:
\n"; - $VDdisplayMESSAGE.= "
\n"; + $shift_ok=0; + if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "ERROR: There are no Shifts enabled for your user group
"; + } + else + { + $HHMM = date("Hi"); + $wday = date("w"); + + $stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $shifts_to_print = mysql_num_rows($rslt); + + $o=0; + while ( ($shifts_to_print > $o) and ($shift_ok < 1) ) + { + $rowx=mysql_fetch_row($rslt); + $shift_id = $rowx[0]; + $shift_start_time = $rowx[1]; + $shift_length = $rowx[2]; + $shift_weekdays = $rowx[3]; + + if (eregi("$wday",$shift_weekdays)) + { + $HHshift_length = substr($shift_length,0,2); + $MMshift_length = substr($shift_length,3,2); + $HHshift_start_time = substr($shift_start_time,0,2); + $MMshift_start_time = substr($shift_start_time,2,2); + $HHshift_end_time = ($HHshift_length + $HHshift_start_time); + $MMshift_end_time = ($MMshift_length + $MMshift_start_time); + if ($MMshift_end_time > 59) + { + $MMshift_end_time = ($MMshift_end_time - 60); + $HHshift_end_time++; + } + if ($HHshift_end_time > 23) + {$HHshift_end_time = ($HHshift_end_time - 24);} + $HHshift_end_time = sprintf("%02s", $HHshift_end_time); + $MMshift_end_time = sprintf("%02s", $MMshift_end_time); + $shift_end_time = "$HHshift_end_time$MMshift_end_time"; + + if ( + ( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or + ( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or + ( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) ) + ) + {$shift_ok++;} + } + $o++; + } + + if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) ) + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "ERROR: You are not allowed to log in outside of your shift
"; + } + } + if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) ) + { + $VDdisplayMESSAGE.= "

MANAGER OVERRIDE:
\n"; + $VDdisplayMESSAGE.= "
\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "Διευθυντής Σύνδεση:
\n"; + $VDdisplayMESSAGE.= "Διευθυντής Κωδικός πρόσβασης:
\n"; + $VDdisplayMESSAGE.= "
\n"; + } + } + ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR + + + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + $user_abb = "$VD_login$VD_login$VD_login$VD_login"; + while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + + $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns =$row[0]; + + if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + { + echo "Agent web client: Σύνδεση εκστρατείας\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "Σύνδεση: \n
"; + echo "Κωδικός πρόσβασης:
\n"; + echo "Εκστρατεία: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01009',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + if ($TEST_all_statuses > 0) {$selectableSQL = '';} + else {$selectableSQL = "selectable='Y' and";} + $VARstatuses=''; + $VARstatusnames=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 300;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01010',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_statuses_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $VD_statuses_ct) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 300;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_statuses_camp = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $statuses[$i] =$row[0]; + $status_names[$i] =$row[1]; + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + + ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent + $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $HK_statuses_camp = mysql_num_rows($rslt); + $w=0; + $HKboxA=''; + $HKboxB=''; + $HKboxC=''; + while ($w < $HK_statuses_camp) + { + $row=mysql_fetch_row($rslt); + $HKhotkey[$w] =$row[0]; + $HKstatus[$w] =$row[1]; + $HKstatus_name[$w] =$row[2]; + $HKhotkeys = "$HKhotkeys'$HKhotkey[$w]',"; + $HKstatuses = "$HKstatuses'$HKstatus[$w]',"; + $HKstatusnames = "$HKstatusnames'$HKstatus_name[$w]',"; + if ($w < 3) + {$HKboxA = "$HKboxA $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ( ($w >= 3) and ($w < 6) ) + {$HKboxB = "$HKboxB $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + if ($w >= 6) + {$HKboxC = "$HKboxC $HKhotkey[$w] - $HKstatus[$w] - $HKstatus_name[$w]
";} + $w++; + } + $HKhotkeys = substr("$HKhotkeys", 0, -1); + $HKstatuses = substr("$HKstatuses", 0, -1); + $HKstatusnames = substr("$HKstatusnames", 0, -1); + + ##### grab the campaign settings + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $park_ext = $row[0]; + $park_file_name = $row[1]; + $web_form_address = stripslashes($row[2]); + $allow_closers = $row[3]; + $auto_dial_level = $row[4]; + $dial_timeout = $row[5]; + $dial_prefix = $row[6]; + $campaign_cid = $row[7]; + $campaign_vdad_exten = $row[8]; + $campaign_rec_exten = $row[9]; + $campaign_recording = $row[10]; + $campaign_rec_filename = $row[11]; + $campaign_script = $row[12]; + $get_call_launch = $row[13]; + $campaign_am_message_exten = '8320'; + $xferconf_a_dtmf = $row[15]; + $xferconf_a_number = $row[16]; + $xferconf_b_dtmf = $row[17]; + $xferconf_b_number = $row[18]; + $alt_number_dialing = $row[19]; + $VC_scheduled_callbacks = $row[20]; + $wrapup_seconds = $row[21]; + $wrapup_message = $row[22]; + $closer_campaigns = $row[23]; + $use_internal_dnc = $row[24]; + $allcalls_delay = $row[25]; + $omit_phone_code = $row[26]; + $agent_pause_codes_active = $row[27]; + $no_hopper_leads_logins = $row[28]; + $campaign_allow_inbound = $row[29]; + $manual_dial_list_id = $row[30]; + $default_xfer_group = $row[31]; + $xfer_groups = $row[32]; + $disable_alter_custphone = $row[33]; + $display_queue_count = $row[34]; + $manual_dial_filter = $row[35]; + $CopY_tO_ClipboarD = $row[36]; + $use_campaign_dnc = $row[37]; + $three_way_call_cid = $row[38]; + $dial_method = $row[39]; + $three_way_dial_prefix = $row[40]; + $web_form_target = $row[41]; + $vtiger_screen_login = $row[42]; + $agent_allow_group_alias = $row[43]; + $default_group_alias = $row[44]; + $quick_transfer_button = $row[45]; + $prepopulate_transfer_preset = $row[46]; + $view_calls_in_queue = $row[47]; + $view_calls_in_queue_launch = $row[48]; + $call_requeue_button = $row[49]; + $pause_after_each_call = $row[50]; + $no_hopper_dialing = $row[51]; + $agent_dial_owner_only = $row[52]; + $agent_display_dialable_leads = $row[53]; + $web_form_address_two = $row[54]; + $agent_select_territories = $row[55]; + $crm_popup_login = $row[56]; + $crm_login_address = $row[57]; + $timer_action = $row[58]; + $timer_action_message = $row[59]; + $timer_action_seconds = $row[60]; + $start_call_url = $row[61]; + $dispo_call_url = $row[62]; + $xferconf_c_number = $row[63]; + $xferconf_d_number = $row[64]; + $xferconf_e_number = $row[65]; + $use_custom_cid = $row[66]; + $scheduled_callbacks_alert = $row[67]; + $scheduled_callbacks_count = $row[68]; + $manual_dial_override = $row[69]; + $blind_monitor_warning = $row[70]; + $blind_monitor_message = $row[71]; + $blind_monitor_filename = $row[72]; + $timer_action_destination = $row[73]; + $enable_xfer_presets = $row[74]; + $hide_xfer_number_to_dial = $row[75]; + $manual_dial_prefix = $row[76]; + $customer_3way_hangup_logging = $row[77]; + $customer_3way_hangup_seconds = $row[78]; + $customer_3way_hangup_action = $row[79]; + $ivr_park_call = $row[80]; + $manual_preview_dial = $row[81]; + + + if ($manual_preview_dial == 'DISABLED') + {$manual_dial_preview = 0;} + if ($manual_dial_override == 'ALLOW_ALL') + {$agentcall_manual = 1;} + if ($manual_dial_override == 'DISABLE_ALL') + {$agentcall_manual = 0;} + if ($user_territories_active < 1) + {$agent_select_territories = 0;} + if (preg_match("/Y/",$agent_select_territories)) + {$agent_select_territories=1;} + else + {$agent_select_territories=0;} + + if (preg_match("/Y/",$agent_display_dialable_leads)) + {$agent_display_dialable_leads=1;} + else + {$agent_display_dialable_leads=0;} + + if (preg_match("/Y/",$no_hopper_dialing)) + {$no_hopper_dialing=1;} + else + {$no_hopper_dialing=0;} + + if ( (preg_match("/Y/",$call_requeue_button)) and ($auto_dial_level > 0) ) + {$call_requeue_button=1;} + else + {$call_requeue_button=0;} + + if ( (preg_match("/AUTO/",$view_calls_in_queue_launch)) and ($auto_dial_level > 0) ) + {$view_calls_in_queue_launch=1;} + else + {$view_calls_in_queue_launch=0;} + + if ( (!preg_match("/NONE/",$view_calls_in_queue)) and ($auto_dial_level > 0) ) + {$view_calls_in_queue=1;} + else + {$view_calls_in_queue=0;} + + if (preg_match("/Y/",$pause_after_each_call)) + {$dispo_check_all_pause=1;} + + $quick_transfer_button_enabled=0; + $quick_transfer_button_locked=0; + if (preg_match("/IN_GROUP|PRESET_1|PRESET_2|PRESET_3|PRESET_4|PRESET_5/",$quick_transfer_button)) + {$quick_transfer_button_enabled=1;} + if (preg_match("/LOCKED/",$quick_transfer_button)) + {$quick_transfer_button_locked=1;} + + $preset_populate=''; + $prepopulate_transfer_preset_enabled=0; + if (preg_match("/PRESET_1|PRESET_2|PRESET_3|PRESET_4|PRESET_5/",$prepopulate_transfer_preset)) + { + $prepopulate_transfer_preset_enabled=1; + if (preg_match("/PRESET_1/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_a_number;} + if (preg_match("/PRESET_2/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_b_number;} + if (preg_match("/PRESET_3/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_c_number;} + if (preg_match("/PRESET_4/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_d_number;} + if (preg_match("/PRESET_5/",$prepopulate_transfer_preset)) + {$preset_populate = $xferconf_e_number;} + } + + $VARpreset_names=''; + $VARpreset_numbers=''; + $VARpreset_dtmfs=''; + $VARpreset_hide_numbers=''; + if ($enable_xfer_presets == 'ENABLED') + { + ##### grab the presets for this campaign + $stmt="SELECT preset_name,preset_number,preset_dtmf,preset_hide_number FROM vicidial_xfer_presets WHERE campaign_id='$VD_campaign' order by preset_name limit 500;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01067',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_presets = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_presets) + { + $row=mysql_fetch_row($rslt); + $preset_names[$j] = $row[0]; + $preset_numbers[$j] = $row[1]; + $preset_dtmfs[$j] = $row[2]; + $preset_hide_numbers[$j] = $row[3]; + $VARpreset_names = "$VARpreset_names'$preset_names[$j]',"; + $VARpreset_numbers = "$VARpreset_numbers'$preset_numbers[$j]',"; + $VARpreset_dtmfs = "$VARpreset_dtmfs'$preset_dtmfs[$j]',"; + $VARpreset_hide_numbers = "$VARpreset_hide_numbers'$preset_hide_numbers[$j]',"; + $j++; + } + $VARpreset_names = substr("$VARpreset_names", 0, -1); + $VARpreset_numbers = substr("$VARpreset_numbers", 0, -1); + $VARpreset_dtmfs = substr("$VARpreset_dtmfs", 0, -1); + $VARpreset_hide_numbers = substr("$VARpreset_hide_numbers", 0, -1); + $VD_preset_names_ct = $j; + if ($j < 1) + {$enable_xfer_presets='DISABLED';} + } + + $default_group_alias_cid=''; + if (strlen($default_group_alias)>1) + { + $stmt = "select caller_id_number from groups_alias where group_alias_id='$default_group_alias';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01055',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidnum_ct = mysql_num_rows($rslt); + if ($VDIG_cidnum_ct > 0) + { + $row=mysql_fetch_row($rslt); + $default_group_alias_cid = $row[0]; + } + } + + $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VD_campaign' and user='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $default_web_vars = $row[0]; + } + + if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) + { + $campaign_recording = $VU_vicidial_recording_override; + echo "\n"; + } + if ( ($VC_scheduled_callbacks=='Y') and ($VU_scheduled_callbacks=='1') ) + {$scheduled_callbacks='1';} + if ($VU_vicidial_recording=='0') + {$campaign_recording='NEVER';} + if ($VU_alter_custphone_override=='ALLOW_ALTER') + {$disable_alter_custphone='N';} + if (strlen($manual_dial_prefix) < 1) + {$manual_dial_prefix = $dial_prefix;} + if (strlen($three_way_dial_prefix) < 1) + {$three_way_dial_prefix = $dial_prefix;} + if ($alt_number_dialing=='Y') + {$alt_phone_dialing='1';} + else + { + $alt_phone_dialing='0'; + $DefaulTAlTDiaL='0'; + } + if ($display_queue_count=='N') + {$callholdstatus='0';} + if ( ($dial_method == 'INBOUND_MAN') or ($outbound_autodial_active < 1) ) + {$VU_closer_default_blended=0;} + + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + if ( (ereg('Y',$agent_pause_codes_active)) or (ereg('FORCE',$agent_pause_codes_active)) ) + { + ##### grab the pause codes for this campaign + $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 100;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01014',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_pause_codes = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_pause_codes) + { + $row=mysql_fetch_row($rslt); + $pause_codes[$i] =$row[0]; + $pause_code_names[$i] =$row[1]; + $VARpause_codes = "$VARpause_codes'$pause_codes[$i]',"; + $VARpause_code_names = "$VARpause_code_names'$pause_code_names[$i]',"; + $i++; + $j++; + } + $VD_pause_codes_ct = ($VD_pause_codes_ct+$VD_pause_codes); + $VARpause_codes = substr("$VARpause_codes", 0, -1); + $VARpause_code_names = substr("$VARpause_code_names", 0, -1); + } + + ##### grab the inbound groups to choose from if campaign contains CLOSER + $VARingroups="''"; + if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) + { + $VARingroups=''; + $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 800;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01015',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $closer_ct = mysql_num_rows($rslt); + $INgrpCT=0; + while ($INgrpCT < $closer_ct) + { + $row=mysql_fetch_row($rslt); + $closer_groups[$INgrpCT] =$row[0]; + $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; + $INgrpCT++; + } + $VARingroups = substr("$VARingroups", 0, -1); + } + else + {$closer_campaigns = "''";} + + ##### gather territory listings for this agent if select territories is enabled + $VARterritories=''; + if ($agent_select_territories > 0) + { + $stmt="SELECT territory from vicidial_user_territories where user='$VD_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01062',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $territory_ct = mysql_num_rows($rslt); + $territoryCT=0; + while ($territoryCT < $territory_ct) + { + $row=mysql_fetch_row($rslt); + $territories[$territoryCT] =$row[0]; + $VARterritories = "$VARterritories'$territories[$territoryCT]',"; + $territoryCT++; + } + $VARterritories = substr("$VARterritories", 0, -1); + echo "\n"; + } + + ##### grab the allowable inbound groups to choose from for transfer options + $xfer_groups = preg_replace("/^ | -$/","",$xfer_groups); + $xfer_groups = preg_replace("/ /","','",$xfer_groups); + $xfer_groups = "'$xfer_groups'"; + $VARxfergroups="''"; + if ($allow_closers == 'Y') + { + $VARxfergroups=''; + $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 800;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01016',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $xfer_ct = mysql_num_rows($rslt); + $XFgrpCT=0; + while ($XFgrpCT < $xfer_ct) + { + $row=mysql_fetch_row($rslt); + $VARxfergroups = "$VARxfergroups'$row[0]',"; + $VARxfergroupsnames = "$VARxfergroupsnames'$row[1]',"; + if ($row[0] == "$default_xfer_group") {$default_xfer_group_name = $row[1];} + $XFgrpCT++; + } + $VARxfergroups = substr("$VARxfergroups", 0, -1); + $VARxfergroupsnames = substr("$VARxfergroupsnames", 0, -1); + } + + if (ereg('Y',$agent_allow_group_alias)) + { + ##### grab the active group aliases + $stmt="SELECT group_alias_id,group_alias_name,caller_id_number FROM groups_alias WHERE active='Y' order by group_alias_id limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01054',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VD_group_aliases = mysql_num_rows($rslt); + $j=0; + while ($j < $VD_group_aliases) + { + $row=mysql_fetch_row($rslt); + $group_alias_id[$i] = $row[0]; + $group_alias_name[$i] = $row[1]; + $caller_id_number[$i] = $row[2]; + $VARgroup_alias_ids = "$VARgroup_alias_ids'$group_alias_id[$i]',"; + $VARgroup_alias_names = "$VARgroup_alias_names'$group_alias_name[$i]',"; + $VARcaller_id_numbers = "$VARcaller_id_numbers'$caller_id_number[$i]',"; + $i++; + $j++; + } + $VD_group_aliases_ct = ($VD_group_aliases_ct+$VD_group_aliases); + $VARgroup_alias_ids = substr("$VARgroup_alias_ids", 0, -1); + $VARgroup_alias_names = substr("$VARgroup_alias_names", 0, -1); + $VARcaller_id_numbers = substr("$VARcaller_id_numbers", 0, -1); + } + + ##### grab the number of leads in the hopper for this campaign + $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01017',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $campaign_leads_to_call = $row[0]; + echo "\n"; + + } + else + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Η εκστρατεία είναι μη ενεργή, παρακαλώ προσπαθήστε πάλι
"; } } - ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR - - - - if ($WeBRooTWritablE > 0) + else { - fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); - fclose($fp); + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Η σύνδεση δεν είναι σωστή, παρακαλώ προσπαθήστε πάλι
"; } - $user_abb = "$VD_login$VD_login$VD_login$VD_login"; - while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) - {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + } + if ($VDloginDISPLAY) + { + echo "Agent web client: Σύνδεση εκστρατείας\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Σύνδεση εκστρατείας
 
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη:
Εκστρατεία: $camp_form_code
  \n"; + echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } - $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { $row=mysql_fetch_row($rslt); - $LOGallowed_campaigns =$row[0]; + $alias_found = "$row[0]"; + } + if ($alias_found > 0) + { + $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_name = "$row[0]"; + $phone_login = "$row[1]"; + } + } - if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) + $pa=0; + if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) + { + $phoneSQL = "("; + $phones_auto = explode(',',$phone_login); + $phones_auto_ct = count($phones_auto); + while($pa < $phones_auto_ct) + { + if ($pa > 0) + {$phoneSQL .= " or ";} + $desc = ($phones_auto_ct - $pa); # traverse in reverse order + $phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')"; + $pa++; + } + $phoneSQL .= ")"; + } + else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";} + + $authphone=0; + #$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; + $stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01020',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Agent web client: Σύνδεση Τηλεφώνου Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Σύνδεση Error
 
Συγγνώμη, αλλά η τηλεφωνική σύνδεση και ο κωδικός πρόσβασής σας δεν είναι ενεργά σε αυτό το σύστημα, παρακαλώ προσπαθήστε πάλι:
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:

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

$VDdisplayMESSAGE

"; - echo ""; - echo ""; - echo ""; - echo "\n"; - echo "\n"; - echo ""; - echo "\n"; - echo ""; - echo "\n"; - echo ""; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
Σύνδεση εκστρατείας
 
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη:
Εκστρατεία: $camp_form_code
  \n"; - echo "

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; - echo "\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - -$original_phone_login = $phone_login; - -# code for parsing load-balanced agent phone allocation where agent interface -# will send multiple phones-table logins so that the script can determine the -# server that has the fewest agents logged into it. -# login: ca101,cb101,cc101 - $alias_found=0; -$stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; -$rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01018',$VD_login,$server_ip,$session_name,$one_mysql_log);} -$alias_ct = mysql_num_rows($rslt); -if ($alias_ct > 0) - { - $row=mysql_fetch_row($rslt); - $alias_found = "$row[0]"; - } -if ($alias_found > 0) - { - $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01019',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $alias_ct = mysql_num_rows($rslt); - if ($alias_ct > 0) - { - $row=mysql_fetch_row($rslt); - $alias_name = "$row[0]"; - $phone_login = "$row[1]"; - } - } - -$pa=0; -if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) - { - $phoneSQL = "("; - $phones_auto = explode(',',$phone_login); - $phones_auto_ct = count($phones_auto); - while($pa < $phones_auto_ct) - { - if ($pa > 0) - {$phoneSQL .= " or ";} - $desc = ($phones_auto_ct - $pa); # traverse in reverse order - $phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')"; - $pa++; - } - $phoneSQL .= ")"; - } -else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";} - -$authphone=0; -#$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; -$stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;"; -if ($DB) {echo "|$stmt|\n";} -$rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01020',$VD_login,$server_ip,$session_name,$one_mysql_log);} -$row=mysql_fetch_row($rslt); -$authphone=$row[0]; -if (!$authphone) - { - echo "Agent web client: Σύνδεση Τηλεφώνου Error\n"; - echo "\n"; - echo "\n"; - echo " Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "


"; - echo ""; - echo ""; - echo "\n"; - echo "\n"; - echo ""; - echo "\n"; - echo ""; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
Σύνδεση Error
 
Συγγνώμη, αλλά η τηλεφωνική σύνδεση και ο κωδικός πρόσβασής σας δεν είναι ενεργά σε αυτό το σύστημα, παρακαλώ προσπαθήστε πάλι:
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:

ΕΚΔΟΣΗ: $version       ΔΗΜΙΟΥΡΓΙΑ: $build
\n"; - echo "\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } -else - { -### go through the entered phones to figure out which server has fewest agents -### logged in and use that phone login account - if ($pa > 0) - { - $pb=0; - $pb_login=''; - $pb_server_ip=''; - $pb_count=0; - $pb_log=''; - while($pb < $phones_auto_ct) - { - ### find the server_ip of each phone_login - $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; - if ($DB) {echo "|$stmtx|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} - $rslt=mysql_query($stmtx, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01021',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $rowx=mysql_fetch_row($rslt); - - ### get number of agents logged in to each server - $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01022',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - - ### find out whether the server is set to active - $stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y' and active_agent_login_server='Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01023',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $rowy=mysql_fetch_row($rslt); - - ### find out whether the server_updater is running - $stmt="SELECT count(*) from server_updater where server_ip = '$rowx[0]' and last_update > '$past_minutes_date';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01024',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $rowz=mysql_fetch_row($rslt); - - $pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]| "; - - if ( ($rowy[0] > 0) && ($rowz[0] > 0) ) - { - if ( ($pb_count >= $row[0]) || (strlen($pb_server_ip) < 4) ) - { - $pb_count=$row[0]; - $pb_server_ip=$rowx[0]; - $phone_login=$phones_auto[$pb]; - } - } - $pb++; - } - echo "\n"; - } - echo "Agent web client\n"; - $stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01025',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $extension=$row[0]; - $dialplan_number=$row[1]; - $voicemail_id=$row[2]; - $phone_ip=$row[3]; - $computer_ip=$row[4]; - $server_ip=$row[5]; - $login=$row[6]; - $pass=$row[7]; - $status=$row[8]; - $active=$row[9]; - $phone_type=$row[10]; - $fullname=$row[11]; - $company=$row[12]; - $picture=$row[13]; - $messages=$row[14]; - $old_messages=$row[15]; - $protocol=$row[16]; - $local_gmt=$row[17]; - $ASTmgrUSERNAME=$row[18]; - $ASTmgrSECRET=$row[19]; - $login_user=$row[20]; - $login_pass=$row[21]; - $login_campaign=$row[22]; - $park_on_extension=$row[23]; - $conf_on_extension=$row[24]; - $VICIDiaL_park_on_extension=$row[25]; - $VICIDiaL_park_on_filename=$row[26]; - $monitor_prefix=$row[27]; - $recording_exten=$row[28]; - $voicemail_exten=$row[29]; - $voicemail_dump_exten=$row[30]; - $ext_context=$row[31]; - $dtmf_send_extension=$row[32]; - $call_out_number_group=$row[33]; - $client_browser=$row[34]; - $install_directory=$row[35]; - $local_web_callerID_URL=$row[36]; - $VICIDiaL_web_URL=$row[37]; - $AGI_call_logging_enabled=$row[38]; - $user_switching_enabled=$row[39]; - $conferencing_enabled=$row[40]; - $admin_hangup_enabled=$row[41]; - $admin_hijack_enabled=$row[42]; - $admin_monitor_enabled=$row[43]; - $call_parking_enabled=$row[44]; - $updater_check_enabled=$row[45]; - $AFLogging_enabled=$row[46]; - $QUEUE_ACTION_enabled=$row[47]; - $CallerID_popup_enabled=$row[48]; - $voicemail_button_enabled=$row[49]; - $enable_fast_refresh=$row[50]; - $fast_refresh_rate=$row[51]; - $enable_persistant_mysql=$row[52]; - $auto_dial_next_number=$row[53]; - $VDstop_rec_after_each_call=$row[54]; - $DBX_server=$row[55]; - $DBX_database=$row[56]; - $DBX_user=$row[57]; - $DBX_pass=$row[58]; - $DBX_port=$row[59]; - $outbound_cid=$row[65]; - $enable_sipsak_messages=$row[66]; - - $no_empty_session_warnings=0; - if ($phone_login == 'nophone') - { - $no_empty_session_warnings=1; - } - if ($PhonESComPIP == '1') - { - if (strlen($computer_ip) < 4) - { - $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01026',$VD_login,$server_ip,$session_name,$one_mysql_log);} - } - } - if ($PhonESComPIP == '2') - { - $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01027',$VD_login,$server_ip,$session_name,$one_mysql_log);} - } - if ($clientDST) - { - $local_gmt = ($local_gmt + $isdst); - } - if ($protocol == 'EXTERNAL') - { - $protocol = 'Local'; - $extension = "$dialplan_number$AT$ext_context"; - } - $SIP_user = "$protocol/$extension"; - $SIP_user_DiaL = "$protocol/$extension"; - if ( (ereg('8300',$dialplan_number)) and (strlen($dialplan_number)<5) and ($protocol == 'Local') ) - { - $SIP_user = "$protocol/$extension$VD_login"; - } - - $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01028',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $asterisk_version=$row[0]; - - # If a park extension is not set, use the default one - if ( (strlen($park_ext)>0) && (strlen($park_file_name)>0) ) - { - $VICIDiaL_park_on_extension = "$park_ext"; - $VICIDiaL_park_on_filename = "$park_file_name"; - echo "\n"; - } - echo "\n"; - - # If a web form address is not set, use the default one - if (strlen($web_form_address)>0) - { - $VICIDiaL_web_form_address = "$web_form_address"; - echo "\n"; - } - else - { - $VICIDiaL_web_form_address = "$VICIDiaL_web_URL"; - print "\n"; - $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); - } - $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); - - # If a web form address two is not set, use the first one - if (strlen($web_form_address_two)>0) - { - $VICIDiaL_web_form_address_two = "$web_form_address_two"; - echo "\n"; - } - else - { - $VICIDiaL_web_form_address_two = "$VICIDiaL_web_form_address"; - echo "\n"; - $VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two); - } - $VICIDiaL_web_form_address_two_enc = rawurlencode($VICIDiaL_web_form_address_two); - - # If closers are allowed στο this campaign - if ($allow_closers=="Y") - { - $VICIDiaL_allow_closers = 1; - echo "\n"; - } - else - { - $VICIDiaL_allow_closers = 0; - echo "\n"; - } - - - $session_ext = eregi_replace("[^a-z0-9]", "", $extension); - if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} - $session_rand = (rand(1,9999999) + 10000000); - $session_name = "$StarTtimE$US$session_ext$session_rand"; - - if ($webform_sessionname) - {$webform_sessionname = "&session_name=$session_name";} - else - {$webform_sessionname = '';} - - $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01029',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01030',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - if ( ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) - { - ### insert an entry into the user log for the login event - $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01031',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly - $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01032',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $prev_login_ct = mysql_num_rows($rslt); - $i=0; - while ($i < $prev_login_ct) - { - $row=mysql_fetch_row($rslt); - $session_id =$row[0]; - $i++; - } - if ($prev_login_ct > 0) - {echo "\n";} - else - { - ##### grab the next available vicidial_conference room and reserve it - $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null));"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01033',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - if ($row[0] > 0) - { - $stmt="UPDATE vicidial_conferences set extension='$SIP_user', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01034',$VD_login,$server_ip,$session_name,$one_mysql_log);} - - $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and ( (extension='$SIP_user') or (extension='$VD_login') );"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01035',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $session_id = $row[0]; - } - echo "\n"; + $useIE=0; + echo "\n"; } - ### mark leads that were not dispositioned during previous calls as ERI - $stmt="UPDATE vicidial_list set status='ERI', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01050',$VD_login,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); - echo "\n"; + $agent_log_id = mysql_insert_id($link); + echo "\n"; - $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + ##### update vicidial_campaigns to show agent has logged in + $stmt="UPDATE vicidial_campaigns set campaign_logindate='$NOW_TIME' where campaign_id='$VD_campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01037',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01064',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VCaffected_rows = mysql_affected_rows($link); + echo "\n"; - $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($enable_queuemetrics_logging > 0) + { + $StarTtimEpause = ($StarTtimE + 1); + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimEpause',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEREASON',data1='LOGIN',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01063',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + echo "\n"; + + mysql_close($linkB); + mysql_select_db("$VARDB_database", $link); + } + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id' where user='$VD_login';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01038',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01061',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); - $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + $stmt="UPDATE vicidial_users SET shift_override_flag='0' where user='$VD_login' and shift_override_flag='1';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01039',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01057',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VUaffected_rows = mysql_affected_rows($link); - # echo "You have logged in as user: $VD_login στο phone: $SIP_user στην εκστρατεία: $VD_campaign
\n"; - $VICIDiaL_is_logged_in=1; + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; - ### set the callerID for manager middleware-app to connect the phone to the user - $SIqueryCID = "S$CIDdate$session_id"; - - ############################################# - ##### START SYSTEM_SETTINGS LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; + ##### grab the datails of all active scripts in the system + $stmt="SELECT script_id,script_name FROM vicidial_scripts WHERE active='Y' order by script_id limit 1000;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01040',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01051',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - $qm_conf_ct = mysql_num_rows($rslt); - if ($qm_conf_ct > 0) + $MM_scripts = mysql_num_rows($rslt); + $e=0; + while ($e < $MM_scripts) { $row=mysql_fetch_row($rslt); - $enable_queuemetrics_logging = $row[0]; - $queuemetrics_server_ip = $row[1]; - $queuemetrics_dbname = $row[2]; - $queuemetrics_login = $row[3]; - $queuemetrics_pass = $row[4]; - $queuemetrics_log_id = $row[5]; - $vicidial_agent_disable = $row[6]; - $allow_sipsak_messages = $row[7]; - } - ##### END QUEUEMETRICS LOGGING LOOKUP ##### - ########################################### - - if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) - { - $SIPSAK_prefix = 'LIN-'; - echo "\n"; - passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$VD_campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); - $SIqueryCID = "$SIPSAK_prefix$VD_campaign$DS$CIDdate"; - } - - ### insert a ΝΕΟ record to the vicidial_manager table to be processed - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user_DiaL','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: \"$SIqueryCID\" <$campaign_cid>','','','','','');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01041',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - - ##### grab the campaign_weight and number of calls today στο that campaign for the agent - $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01042',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $vca_ct = mysql_num_rows($rslt); - if ($vca_ct > 0) - { - $row=mysql_fetch_row($rslt); - $campaign_weight = $row[0]; - $calls_today = $row[1]; - $i++; - } - else - { - $campaign_weight = '0'; - $calls_today = '0'; - $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01043',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - } - - if ($auto_dial_level > 0) - { - echo "\n"; - - - $closer_chooser_string=''; - $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y','N');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01044',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - - if ($enable_queuemetrics_logging > 0) - { - $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); - mysql_select_db("$queuemetrics_dbname", $linkB); - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01045',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01046',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - mysql_close($linkB); - mysql_select_db("$VARDB_database", $link); - } - - - if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) - { - print "\n"; - } - } - else - { - print "\n"; - - $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level', '$campaign_weight', '$calls_today','$NOW_TIME','N','N');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01047',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - echo "\n"; - - if ($enable_queuemetrics_logging > 0) - { - $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); - mysql_select_db("$queuemetrics_dbname", $linkB); - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01048',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01049',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - mysql_close($linkB); - mysql_select_db("$VARDB_database", $link); - } + $MMscriptid[$e] =$row[0]; + $MMscriptname[$e] = urlencode($row[1]); + $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; + $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; + $e++; } + $MMscriptids = substr("$MMscriptids", 0, -1); + $MMscriptnames = substr("$MMscriptnames", 0, -1); } - else - { - echo "Agent web client: Σύνδεση εκστρατείας\n"; - echo "\n"; - echo "\n"; - echo " Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; - echo "Συγγνώμη, δεν υπάρχουν οδηγοί στον hopper για αυτήν την εκστρατεία\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "Σύνδεση: \n
"; - echo "Κωδικός πρόσβασης:
\n"; - echo "Εκστρατεία: $camp_form_code
\n"; - echo "   \n"; - echo "\n"; - echo "
\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - if (strlen($session_id) < 1) - { - echo "Agent web client: Σύνδεση εκστρατείας\n"; - echo "\n"; - echo "\n"; - echo " Timeclock
\n"; - echo "\n"; - echo "\n"; -echo "\n";echo "\n"; echo "
English Ελληνικά
\n"; - echo "Sorry, there are no available sessions\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "Σύνδεση: \n
"; - echo "Κωδικός πρόσβασης:
\n"; - echo "Εκστρατεία: $camp_form_code
\n"; - echo "   \n"; - echo "\n"; - echo "
\n\n"; - echo "\n\n"; - echo "\n\n"; - exit; - } - - if (ereg('MSIE',$browser)) - { - $useIE=1; - echo "\n"; - } - else - { - $useIE=0; - echo "\n"; - } - - $StarTtimE = date("U"); - $NOW_TIME = date("Y-m-d H:i:s"); - ##### Agent is going to log in so insert the vicidial_agent_log entry now - $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01050',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - $agent_log_id = mysql_insert_id($link); - echo "\n"; - - ##### update vicidial_campaigns to show agent has logged in - $stmt="UPDATE vicidial_campaigns set campaign_logindate='$NOW_TIME' where campaign_id='$VD_campaign';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01064',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VCaffected_rows = mysql_affected_rows($link); - echo "\n"; - - if ($enable_queuemetrics_logging > 0) - { - $StarTtimEpause = ($StarTtimE + 1); - $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); - mysql_select_db("$queuemetrics_dbname", $linkB); - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimEpause',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEREASON',data1='LOGIN',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01063',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); - echo "\n"; - - mysql_close($linkB); - mysql_select_db("$VARDB_database", $link); - } - - $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id' where user='$VD_login';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01061',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VLAaffected_rows_update = mysql_affected_rows($link); - - $stmt="UPDATE vicidial_users SET shift_override_flag='0' where user='$VD_login' and shift_override_flag='1';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01057',$VD_login,$server_ip,$session_name,$one_mysql_log);} - $VUaffected_rows = mysql_affected_rows($link); - - $S='*'; - $D_s_ip = explode('.', $server_ip); - if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} - if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} - if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} - if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} - if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} - if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} - if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} - if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} - $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; - - ##### grab the datails of all active scripts in the system - $stmt="SELECT script_id,script_name FROM vicidial_scripts WHERE active='Y' order by script_id limit 1000;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01051',$VD_login,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $MM_scripts = mysql_num_rows($rslt); - $e=0; - while ($e < $MM_scripts) - { - $row=mysql_fetch_row($rslt); - $MMscriptid[$e] =$row[0]; - $MMscriptname[$e] = urlencode($row[1]); - $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; - $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; - $e++; - } - $MMscriptids = substr("$MMscriptids", 0, -1); - $MMscriptnames = substr("$MMscriptnames", 0, -1); } -} ### SCREEN WIDTH AND HEIGHT CALCULATIONS ### @@ -2225,6 +2524,11 @@ if ($stretch_dimensions > 0) if ($JS_browser_height >= 340) {$BROWSER_HEIGHT = ($JS_browser_height - 40);} } +if ($agent_fullscreen=='Y') + { + $BROWSER_WIDTH = ($JS_browser_width - 10); + $BROWSER_HEIGHT = $JS_browser_height; + } $MASTERwidth=($BROWSER_WIDTH - 340); $MASTERheight=($BROWSER_HEIGHT - 200); if ($MASTERwidth < 430) {$MASTERwidth = '430';} @@ -2243,6 +2547,7 @@ $SSwidth = ($MASTERwidth + 176); # 606 - scroll script $SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session $HKwidth = ($MASTERwidth + 20); # 450 - Hotkeys button $HSwidth = ($MASTERwidth + 1); # 431 - Header spacer +$PBwidth = ($MASTERwidth + 0); # 430 - Presets list $CLwidth = ($MASTERwidth - 160); # 270 - Calls in queue link $WRheight = ($MASTERheight + 160); # 460 - Warning boxes @@ -2255,6 +2560,8 @@ $CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume co $SSheight = ($MASTERheight + 31); # 331 - script content $HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey $BPheight = ($MASTERheight - 250); # 50 - bottom buffer, Agent Xfer Span +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} ################################################################ @@ -2387,7 +2694,8 @@ $CCAL_OUT .= "
"; ?> -