diff --git a/agc_2-X/trunk/LANG_www/agc_br/active_list_refresh.php b/agc_2-X/trunk/LANG_www/agc_br/active_list_refresh.php index 10bbbd28..85e5f338 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/active_list_refresh.php +++ b/agc_2-X/trunk/LANG_www/agc_br/active_list_refresh.php @@ -166,7 +166,7 @@ if ($ADD==1) {echo "Extensões Ativas";} if ($ADD==2) {echo "Extensões Ocupadas";} if ($ADD==3) {echo "Linhas externas";} if ($ADD==4) {echo "Extensões Locais";} -if ($ADD==5) {echo "Conferencias";} +if ($ADD==5) {echo "Conferências";} if ($ADD==99999) {echo "AJUDA";} echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/LANG_www/agc_br/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_br/astguiclient.php index f977e637..84c310f4 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_br/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -162,9 +163,9 @@ echo "\n"; echo "Senha do Usuário: "; echo "\n"; - echo "Login do Telefone: "; + echo "Login do Ramal: "; echo "\n"; - echo "Senha do Telefone: "; + echo "Senha do Ramal: "; echo "\n"; echo "\n"; echo "
VERSÃO: $version       CONFIGURAÇÃO: $build\n"; @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -210,7 +211,7 @@ echo "\n"; if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) { -echo "astGUIclient web client: Login do Telefone\n"; +echo "astGUIclient web client: Login do Ramal\n"; echo "\n"; echo "\n"; echo "\n"; @@ -222,12 +223,12 @@ echo "\n"; echo "\n"; echo "


"; echo ""; -echo ""; +echo ""; echo "\n"; echo "\n"; -echo ""; +echo ""; echo "\n"; -echo ""; +echo ""; echo "\n"; echo "\n"; echo "\n"; @@ -247,7 +248,7 @@ $row=mysql_fetch_row($rslt); $authphone=$row[0]; if (!$authphone) { - echo "astGUIclient web client: Login do Telefone\n"; + echo "astGUIclient web client: Login do Ramal\n"; echo "\n"; echo "\n"; echo "
Login do Telefone Login do Ramal
 
Login do Telefone:
Login do Ramal:
Senha do Telefone:
Senha do Ramal:

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; @@ -259,12 +260,12 @@ echo " +
\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo ""; + echo "\n"; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; echo "\n"; echo "\n"; @@ -887,7 +888,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} else { bsr_continue=0; - alert("Você so pode monitorar os canais ZAP:\n" + listenvalue); + alert("Você só pode monitorar os canais ZAP:\n" + listenvalue); } } if (bsr_continue == '1') @@ -1197,7 +1198,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} { recLIST = recLIST + "|" + monitorchannelvalue; filename = filedate + "_" + user_abb; - var rec_start_html = "Pare a Gravação"; + var rec_start_html = "Parar Gravação"; document.getElementById(taskspan).innerHTML = rec_start_html; } @@ -1259,7 +1260,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} recLIST = recLIST + "|" + taskconfrec; filename = filedate + "_" + user_abb; var channelrec = "Local/" + taskconfrec + "@" + ext_context; - var conf_rec_start_html = "Pare a Gravação"; + var conf_rec_start_html = "Parar Gravação"; document.getElementById(taskconfspan).innerHTML = conf_rec_start_html; } @@ -1386,7 +1387,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=3; if (live_calls > 0) { - var live_calls_HTML = "CHAMADAS ATIVAS NESTE TELEFONE:
Login do Telefone Login do Ramal
 
Desculpe seu login de telefone e senha não estão ativos nesta campanha, por favor tente novamente:
 
Login do Telefone:
 
Desculpe seu login de ramal e senha não estão ativos nesta campanha, por favor tente novamente:
 
Login do Ramal:
Senha do Telefone:
Senha do Ramal:

VERSÃO: $version       CONFIGURAÇÃO: $build
"; + var live_calls_HTML = "CHAMADAS ATIVAS NESTE RAMAL:
#CANAL DO CLIENTECANAL REMOTORECORDDESLIGARTRANFERENCIAESPERA
"; if ( (LCAcount > live_calls) || (LCAcount < live_calls) ) { LCAe[0]=''; LCAe[1]=''; LCAe[2]=''; LCAe[3]=''; LCAe[4]=''; LCAe[5]=''; @@ -1412,11 +1413,11 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var regx = new RegExp("\\|"+channelfieldBtrunk_array[1],"ig"); if (recLIST.match(regx)) - {live_calls_HTML = live_calls_HTML + "Pare a Gravação";} + {live_calls_HTML = live_calls_HTML + "Parar Gravação";} else {live_calls_HTML = live_calls_HTML + "Gravar";} - live_calls_HTML = live_calls_HTML + ""; + live_calls_HTML = live_calls_HTML + ""; if (LCAe[ARY_ct].length < 1) {LCAe[ARY_ct] = channelfieldA_array[1]; LCAcontent_change++; LCAalter++;} @@ -1533,7 +1534,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=0; if (out_calls > 0) { - var out_log_HTML = "
#CANAL DO CLIENTECANAL REMOTORECORDDESLIGARTRANFERÊNCIAESPERA
DESLIGARTRANFERENCIAESPERA
DESLIGARTRANFERÊNCIAESPERA
" + var out_log_HTML = "
# DATA/HORA DA CHAMADANUMEROLENGTH (M:SS)
" while (loop_ct < out_calls) { loop_ct++; @@ -1561,7 +1562,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=0; if (in_calls > 0) { - var in_log_HTML = "
# DATA/HORA DA CHAMADANÚMEROLENGTH (M:SS)
" + var in_log_HTML = "
# DATA/HORA DA CHAMADANUMERO ENTRANTECALLERIDLENGTH
" while (loop_ct < in_calls) { loop_ct++; @@ -1636,7 +1637,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=-1; if (parked_count > 0) { - var park_HTML = "
# DATA/HORA DA CHAMADANÚMERO ENTRANTECALLERIDLENGTH
" + var park_HTML = "
#CHANNEL
  CHAMADA ID
EM ESPERA POR
  TEMPO EM ESPERA
DESLIGARTRANFERENCIACAPTURAR
" while (loop_ct < parked_count) { loop_ct++; @@ -1652,7 +1653,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var park_call_id = park_array[1]; var parked_by = park_array[3]; var parked_time = park_array[4]; - park_HTML = park_HTML + ""; + park_HTML = park_HTML + ""; } park_HTML = park_HTML + "
#CHANNEL
  CHAMADA ID
EM ESPERA POR
  TEMPO EM ESPERA
DESLIGARTRANFERÊNCIACAPTURAR
" + loop_ct + "" + park_channel + "
  " + park_call_id + "
" + parked_by + "
  " + parked_time + "
DESLIGARTRANFERENCIACAPTURAR
" + loop_ct + "" + park_channel + "
  " + park_call_id + "
" + parked_by + "
  " + parked_time + "
DESLIGARTRANFERÊNCIACAPTURAR
"; @@ -1764,7 +1765,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} show_reglink=1; reglink = "Register"; } - var conf_head_HTML = "CONFERENCIA " + head_conf + "    Registrado para: " + head_reg + "   " + reglink + "         Entrar na conferência
Atualizar     Gravar         Enviar DTMF         Dial From Conf
"; + var conf_head_HTML = "CONFERÊNCIA " + head_conf + "    Registrado para: " + head_reg + "   " + reglink + "         Entrar na conferência
Atualizar     Gravar         Enviar DTMF         Discar da confêrencia
"; document.getElementById("ConfereNceHeaderContent").innerHTML = conf_head_HTML; check_for_conf_calls(head_conf,taskrefresh); @@ -1825,7 +1826,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var LMAcontent_change=0; var LMAcontent_match=0; var conv_start=-1; - var live_conf_HTML = "CHAMADAS ATIVAS NESTA CONFERÊNCIA:
"; + var live_conf_HTML = "CHAMADAS ATIVAS NESTA CONFERÊNCIA:
#CANAL REMOTODESLIGARTRANFERENCIA
"; if ( (LMAcount > live_conf_calls) || (LMAcount < live_conf_calls) || (LMAforce > 0)) { LMAe[0]=''; LMAe[1]=''; LMAe[2]=''; LMAe[3]=''; LMAe[4]=''; LMAe[5]=''; @@ -1841,7 +1842,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} {var row_color = '#CCCCFF';} var conv_ct = (loop_ct + conv_start); var channelfieldA = conf_chan_array[conv_ct]; - live_conf_HTML = live_conf_HTML + ""; + live_conf_HTML = live_conf_HTML + ""; if (!LMAe[ARY_ct]) {LMAe[ARY_ct] = channelfieldA; LMAcontent_change++; LMAalter++;} @@ -2290,7 +2291,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var VD_favlist_ct_half = parseInt(favlistCT / 2); if (VD_favlist_ct_half < 30) {VD_favlist_ct_half = 30;} var favlist_sec_col = 0; - var favedit_HTML = "
#CANAL REMOTODESLIGARTRANFERÊNCIA
" + loop_ct + "" + channelfieldA + "DESLIGARTRANFERENCIA
" + loop_ct + "" + channelfieldA + "DESLIGARTRANFERÊNCIA
EXTENSOES DISPONIVEISFAVORITOS
"; + var favedit_HTML = "
@@ -2759,7 +2760,7 @@ echo "\n";
EXTENSÕES DISPONÍVEISFAVORITOS
"; loop_ct = 0; while (loop_ct < favlistCT) { @@ -2718,7 +2719,7 @@ echo "\n";
-SAIR
\n"; ?> +SAIR
\n"; ?>
Painel Principal
- + -
TRANSFERIR CHAMADAS ATIVAS
Canal a ser transferido: Channel
Extensões:
Extensões do Menu
Extensões:
Menu de Extensões

Enviar para a extensão selecionada

@@ -2768,12 +2769,12 @@ echo "\n"; Atualizar


Voltar a página principal

Conferencias:
(Clique no número abaixo para enviar a conferência)
Enviar meu canal para
Menu das conferências
+
Conferências:
(clique no número abaixo para enviar a conferência)
Enviar meu canal para
Menu das conferências
- + + + +
Discar a extensão local
Telefone ligando de: Channel
Extensões:
Extensões do Menu
Extensões:
Menu de Extensões

Ligar para a extensão selecionada

@@ -2828,7 +2829,7 @@ echo "\n"; - +
FAVORITOS

 
PARA ENVIAR MODIFICACOES FAVORITAS E NECESSARIO FAZER O LOGOUT
ENVIAR ALTERAÇÕES FAVORITAS - requer logout
VOLTAR A TELA PRINCIPAL - as alterações serão ignoradas
@@ -2839,7 +2840,7 @@ echo "\n";
-STOP | START     Atualizar a taxa: 1000 ms Mais rápido | Mais devagar

+STOP | START     Taxa de Atualização: 1000 ms Mais rápido | Mais devagar

Inicializando..
Extensões Ativas
@@ -2858,11 +2859,11 @@ echo "\n";
- Data vai aqui

+ Os Dados vão aqui

- Data vai aqui

Atividade do Tronco + Os Dados vão aqui

Atividade do Tronco
- Data vai aqui

Atividade Local + Os Dados vão aqui

Atividade Local
diff --git a/agc_2-X/trunk/LANG_www/agc_br/calendar.css b/agc_2-X/trunk/LANG_www/agc_br/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_br/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/agc_2-X/trunk/LANG_www/agc_br/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_br/calendar_db.js new file mode 100644 index 00000000..26d83e55 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_br/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' : ['Janeiro', 'February', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], + '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 ("Inválido 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 ("Inválido 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("Inválido 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/agc_2-X/trunk/LANG_www/agc_br/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_br/conf_exten_check.php index 71b6fd1c..a2b6f2cb 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_br/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; - if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { echo "Inválido Usuário/Senha: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Verificação da Extensão de Conferência"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Verificação da Extensão de Conferência"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten não é válido\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN checkligadocalls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Chamadas na fila: $RingCalls";} + else {$RingCalls = "Chamadas na fila: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END checkligadocalls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Solicita, em fila: $RingCalls";} - else {$RingCalls = "Solicita, em fila: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $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 . '|Status: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten não é válido or Exten $exten não é válido\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Conferencia $conf_exten já foi registrado para $exten\n"; + echo "Conferência $conf_exten já foi registrado para $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_br/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_br/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_br/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_br/functions.php b/agc_2-X/trunk/LANG_www/agc_br/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_br/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_br/inbound_popup.php b/agc_2-X/trunk/LANG_www/agc_br/inbound_popup.php index 1032dd45..a2511ff1 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/inbound_popup.php +++ b/agc_2-X/trunk/LANG_www/agc_br/inbound_popup.php @@ -251,11 +251,11 @@ echo "";} + $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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten não é válido or queryCID $queryCID não é válido, Originate comando não inserido\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -795,10 +869,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='ESPERAED',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='ESPERA',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") @@ -822,9 +959,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='ESPERA',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 "Uma dessas variáveis não é válido:\n"; + echo "Channel $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "extenName $extenName Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "parkedby $parkedby Deve ser definido\n"; + echo "\nRedirectToPark Action não enviado\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='ESPERA_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='IVRESPERAED',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='IVRESPERA',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 "Uma dessas variáveis não é válido:\n"; + echo "Channel $channel Deve ser maior que 2 caracteres\n"; + echo "queryCID $queryCID Deve ser maior que 14 caracateres\n"; + echo "exten $exten Deve ser definido\n"; + echo "ext_context $ext_context Deve ser definido\n"; + echo "ext_priority $ext_priority Deve ser definido\n"; + echo "\nRedirectFromPark Action não enviado\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='IVRESPERA',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) ) @@ -1031,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está ativoligado$server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1138,7 +1547,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); } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1248,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está ativoligado$server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1624,7 +2033,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $i++; } } - echo "$ACTION comando enviado para Canal $channelligado$server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n AS GRAVAÇÕES VÃO DURAR 60 MINUTOS\n"; + echo "$ACTION comando enviado para Canal $channelligado$server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n AS GRAVAÇÕES VÃO DURAR ATÉ 60 MINUTOS\n"; } } @@ -1639,7 +2048,7 @@ if ($ACTION=="VolumeControl") { if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) { - echo "Conferencia $exten, Stage $stage não é válido or queryCID $queryCID não é válido, Originate comando não inserido\n"; + echo "Conferência $exten, Stage $stage não é válido or queryCID $queryCID não é válido, Originate comando não inserido\n"; } else { @@ -1656,7 +2065,7 @@ if ($ACTION=="VolumeControl") if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02082',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Volume comando enviado para Conferencia $exten, Stage $stage Canal $channelligado$server_ip\n"; + echo "Volume comando enviado para Conferência $exten, Stage $stage Canal $channelligado$server_ip\n"; } } @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_br/park_calls_display.php b/agc_2-X/trunk/LANG_www/agc_br/park_calls_display.php index e5bcc93a..5e07fb7e 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/park_calls_display.php +++ b/agc_2-X/trunk/LANG_www/agc_br/park_calls_display.php @@ -99,7 +99,7 @@ if ($format=='debug') echo "\n"; echo "\n"; echo "\n"; -echo "Mostra as ligações em espera"; +echo "<title>Mostrar ligações em espera"; echo "\n"; echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/LANG_www/agc_br/phone_only.php b/agc_2-X/trunk/LANG_www/agc_br/phone_only.php new file mode 100644 index 00000000..736908a3 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_br/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Você fez o logoff. Obrigado\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DSTligadoserver for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock linkligadothe agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the locationligadothe agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefone web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Relogio ponto
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\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 "\n"; + echo "
\"VICIdial\" Telefone-Only Login
 
Login do Ramal:
Senha do Ramal:
Login do Usuário:
Senha do Usuário:
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefone web client: Login do Ramal\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Relogio ponto
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefone-Only Login
 
Login do Ramal:
Senha do Ramal:
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Usuário incorreto, por favor tente novamente
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefone web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Relogio ponto
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefone-Only Login
 
Login do Usuário:
Senha do Usuário:
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefone web client: Login do Ramal Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Relogio ponto
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Brazil
\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 "
\"VICIdial\" Telefone-Only Login Error
 
Desculpe seu login de ramal e senha não estão ativos nesta campanha, por favor tente novamente:
 
Login do Ramal:
Senha do Ramal:

VERSÃO: $version       CONFIGURAÇÃO: $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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefone 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call segundos counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - segundosligadocall display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefone: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefone:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_br/timeclock.php b/agc_2-X/trunk/LANG_www/agc_br/timeclock.php index c62ae950..6db4a59e 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_br/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 ##### @@ -120,10 +122,10 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($valid_user < 1) { ### NOT A VALID USER/PASS - $VDdisplayMESSAGE = "O usuário ea senha que você digitou não são ativos no sistema
Por favor, tente novamente:"; + $VDdisplayMESSAGE = "O usuário e a senha que você digitou não estão ativos no sistema
Por favor, tente novamente:"; echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Relogio ponto\n"; echo"\n"; echo"\n"; echo "\n"; @@ -138,7 +140,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo ""; @@ -225,10 +227,10 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($last_action_sec < 30) and ($status != 'START') ) { ### You cannot log in or out within 30 segundos of your last login/logout - $VDdisplayMESSAGE = "Você não pode efetuar login ou para fora dentro de 30 segundos do seu último login ou logout"; + $VDdisplayMESSAGE = "Você não pode entrar ou sair dentro de 30 segundos do seu último login ou logout"; echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Relogio ponto\n"; echo"\n"; echo"\n"; echo "\n"; @@ -243,7 +245,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo "
Timeclock Relogio ponto
 
Login do Usuário:
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo ""; @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Você tem agora registrados em"; + $LOGtimeMESSAGE = "Você logou em $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -292,8 +294,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($status=='LOGIN') and ($stage=='logout') ) { - $VDdisplayMESSAGE = "Você tem agora autenticado-out"; - $LOGtimeMESSAGE = "Você saiu em$NOW_TIME
Quantidade de tempo que foram registradas em:$totTIME_HMS"; + $VDdisplayMESSAGE = "Você efetuou logout"; + $LOGtimeMESSAGE = "Você saiu em$NOW_TIME
Quantidade de tempo que ficou logado:$totTIME_HMS"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';"; @@ -333,24 +335,24 @@ if ( ($stage == 'login') or ($stage == 'logout') ) } if ( ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) ) - {echo "ERRO: timeclock entrada do log já realizados:$status|$stage"; exit;} + {echo "ERRO: relogio ponto já registrado:$status|$stage"; exit;} if ($referrer=='agent') - {$BACKlink = "BACK TO Agent Login Screen";} + {$BACKlink = "VOLTAR para tela de login do Agente";} if ($referrer=='admin') - {$BACKlink = "Retornar para Administração";} + {$BACKlink = "VOLTAR para Administração";} if ($referrer=='welcome') - {$BACKlink = "ANTERIOR a tela Bem-vindo";} + {$BACKlink = "VOLTAR para Tela Inicial";} echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Relogio ponto\n"; echo"\n"; echo"\n"; echo "\n"; echo "

$VDdisplayMESSAGE

"; echo "
Timeclock Relogio ponto
 
Login do Usuário:
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo "\n"; @@ -368,21 +370,21 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) { - $VDdisplayMESSAGE = "Vez desde que foi registrado em:$totTIME_HMS"; + $VDdisplayMESSAGE = "Tempo desde o último login:$totTIME_HMS"; $log_action = 'login'; $button_name = 'LOGIN'; - $LOGtimeMESSAGE = "Você última autenticado-out em:$last_action_date

LOGIN Clique abaixo para log-in"; + $LOGtimeMESSAGE = "Você saiu pela última vez em:$last_action_date

Clique LOGIN abaixo para entrar"; } if ($status=='LOGIN') { - $VDdisplayMESSAGE = "Quantidade de tempo que tem sido registrado em:$totTIME_HMS"; + $VDdisplayMESSAGE = "Tempo total desde que entrou no sistema:$totTIME_HMS"; $log_action = 'logout'; $button_name = 'LOGOUT'; - $LOGtimeMESSAGE = "Você autenticado-nos em: $last_action_date
Quantidade de tempo que tem sido registrado em:$totTIME_HMS

SAIR Clique abaixo para log-out"; + $LOGtimeMESSAGE = "Você entrou em: $last_action_date
Tempo total desde que entrou no sistema:$totTIME_HMS

Clique LOGOUT abaixo para sair"; } echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Relogio ponto\n"; echo"\n"; echo"\n"; echo "\n"; @@ -400,7 +402,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo "
Timeclock Relogio ponto
 
$LOGtimeMESSAGE
 
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo "\n"; @@ -421,7 +423,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) else { echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Relogio ponto\n"; echo"\n"; echo"\n"; echo "\n"; @@ -436,7 +438,7 @@ else echo "

$VDdisplayMESSAGE

"; echo "
Timeclock Relogio ponto
 
$LOGtimeMESSAGE
 
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo ""; diff --git a/agc_2-X/trunk/LANG_www/agc_br/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_br/vdc_db_query.php index 08f968a2..6290b5e8 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_br/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStatus"])) {$CallBackLeadStatus=$_GET["CallBackLeadStatus"];} + elseif (isset($_POST["CallBackLeadStatus"])) {$CallBackLeadStatus=$_POST["CallBackLeadStatus"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Usuário busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Inválido number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STATUS INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Entrante calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Inválido call reference value.", +88 => "Incompatible destination.", +95 => "Inválido message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Inválido information element contents.", +101 => "Message not compatible with call state.", +102 => "Recoveryligadotimer expiry.", +103 => "Parameter non-existent or not implemented - passedligado(national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -614,7 +819,7 @@ if ($ACTION == 'LogiNCamPaigns') $shift_ok=0; if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) { - $VDdisplayMESSAGE = "ERRO: Não existem Shifts activado para o Grupo de Usuários\n"; + $VDdisplayMESSAGE = "ERRO: Não existem turnos ativos para seu Grupo de Usuários\n"; $VDloginDISPLAY=1; } else @@ -667,14 +872,14 @@ if ($ACTION == 'LogiNCamPaigns') if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) ) { - $VDdisplayMESSAGE = "ERRO: Você não tem permissão para iniciar sessão no para fora do seu turno\n"; + $VDdisplayMESSAGE = "ERRO: Você não tem permissão para iniciar sessão fora do seu turno\n"; $VDloginDISPLAY=1; } } if ($VDloginDISPLAY > 0) { $loginDATE = date("Ymd"); - $VDdisplayMESSAGE.= "

GERENTE Override:
\n"; + $VDdisplayMESSAGE.= "

SOBREPOR GERENTE:
\n"; $VDdisplayMESSAGE.= "
\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; } exit; @@ -778,6 +983,36 @@ 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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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]; + $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; + $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); @@ -786,7 +1021,7 @@ if ($ACTION == 'regCLOSER') { if (strlen($in_groups[$k])>1) { - $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $stmt="SELECT group_weight,calls_today,group_grade FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00013',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -794,18 +1029,45 @@ if ($ACTION == 'regCLOSER') if ($viga_ct > 0) { $row=mysql_fetch_row($rslt); - $group_weight = $row[0]; + $group_weight = $row[0]; $calls_today = $row[1]; + $group_grade = $row[2]; } else { $group_weight = 0; $calls_today = 0; + $group_grade = 1; } - $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME',group_grade='$group_grade';"; 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) ) + { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00388',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $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' $data4SQL;"; + $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++; } @@ -998,7 +1260,9 @@ if ($ACTION == 'manDiaLnextCaLL') { $MT[0]=''; $row=''; $rowx=''; + $override_dial_number=''; $channel_live=1; + $lead_id = ereg_replace("[^0-9]","",$lead_id); if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) { $channel_live=0; @@ -1009,7 +1273,8 @@ if ($ACTION == 'manDiaLnextCaLL') else { ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $eac_phone=''; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00015',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1017,7 +1282,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';} @@ -1047,32 +1313,144 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00016',$user,$server_ip,$session_name,$one_mysql_log);} } + ### check if this is a specific lead call, if it is, skip the grabbing of a new lead + elseif (strlen($lead_id)>0) + { + $affected_rows=1; + $CBleadIDset=1; + + if (strlen($phone_number) > 5) + {$override_dial_number = $phone_number;} + } else { if (strlen($phone_number)>3) { + if (ereg("ENABLED",$manual_dial_call_time_check)) + { + $secX = date("U"); + $hour = date("H"); + $min = date("i"); + $sec = date("s"); + $mon = date("m"); + $mday = date("d"); + $year = date("Y"); + $isdst = date("I"); + $Shour = date("H"); + $Smin = date("i"); + $Ssec = date("s"); + $Smon = date("m"); + $Smday = date("d"); + $Syear = date("Y"); + $pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; + $inSD = $pulldate0; + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $postalgmt=''; + $postal_code=''; + $state=''; + if (strlen($phone_code)<1) + {$phone_code='1';} + + $local_call_time='24hours'; + ##### gather local call time setting from campaign + $stmt="SELECT local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00353',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_lct_ct = mysql_num_rows($rslt); + if ($camp_lct_ct > 0) + { + $row=mysql_fetch_row($rslt); + $local_call_time = $row[0]; + } + + ### get current gmt_offset of the phone_number + $USarea = substr($phone_number, 0, 3); + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + $dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state); + + if ($dialable < 1) + { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00354',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00355',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "OUTSIDE OF LOCAL CHAMADA TIME $VMDQaffected_rows|$VLAEDaffected_rows\n"; + exit; + } + } + if (ereg("DNC",$manual_dial_filter)) { - $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + if (ereg("AREACODE",$use_internal_dnc)) + { + $phone_number_areacode = substr($phone_number, 0, 3); + $phone_number_areacode .= "XXXXXXX"; + $stmt="SELECT count(*) from vicidial_dnc where phone_number IN('$phone_number','$phone_number_areacode');"; + } + else + {$stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00017',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); - if ($row[0] > 0) { - echo "DNC NUMERO\n"; + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00356',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00357',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "DNC NÚMERO\n"; exit; } - $stmt="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign';"; + if (ereg("AREACODE",$use_campaign_dnc)) + { + $phone_number_areacode = substr($phone_number, 0, 3); + $phone_number_areacode .= "XXXXXXX"; + $stmt="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$phone_number','$phone_number_areacode') and campaign_id='$campaign';"; + } + else + {$stmt="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign';";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00018',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); - if ($row[0] > 0) { - echo "DNC NUMERO\n"; + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00358',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00359',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "DNC NÚMERO\n"; exit; } } @@ -1088,7 +1466,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); @@ -1101,7 +1488,20 @@ if ($ACTION == 'manDiaLnextCaLL') if ($row[0] < 1) { - echo "NUMERO NOT IN CAMPLISTS\n"; + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00360',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00361',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "NÚMERO NOT IN CAMPLISTS\n"; exit; } } @@ -1121,7 +1521,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00021',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00362',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $man_leadID_ct = mysql_num_rows($rslt); } @@ -1159,7 +1559,7 @@ if ($ACTION == 'manDiaLnextCaLL') else { ##### gather no hopper dialing settings from campaign - $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary,call_count_limit FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00236',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1174,6 +1574,9 @@ if ($ACTION == 'manDiaLnextCaLL') $drop_lockout_time = $row[4]; $lead_filter_id = $row[5]; $lead_order = $row[6]; + $lead_order_randomize = $row[7]; + $lead_order_secondary = $row[8]; + $call_count_limit = $row[9]; } if (eregi("N",$no_hopper_dialing)) { @@ -1510,6 +1913,12 @@ if ($ACTION == 'manDiaLnextCaLL') $DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )"; } + $CCLsql=''; + if ($call_count_limit > 0) + { + $CCLsql = "and (called_count < $call_count_limit)"; + } + $stmt="SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00239',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1518,7 +1927,8 @@ if ($ACTION == 'manDiaLnextCaLL') if ($filtersql_ct > 0) { $row=mysql_fetch_row($rslt); - $fSQL = $row[0]; + $fSQL = "and $row[0]"; + $fSQL = preg_replace('/\\\\/','',$fSQL); } $stmt="SELECT list_id FROM vicidial_lists where campaign_id='$campaign' and active='Y';"; @@ -1549,57 +1959,102 @@ if ($ACTION == 'manDiaLnextCaLL') $territory = $row[1]; } - $agent_territories=''; - $stmt="SELECT agent_territories FROM vicidial_live_agents where user='$user';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00258',$user,$server_ip,$session_name,$one_mysql_log);} - $userterrVLA_ct = mysql_num_rows($rslt); - if ($DB) {echo "$userterrVLA_ct|$stmt\n";} - if ($userterrVLA_ct > 0) - { - $row=mysql_fetch_row($rslt); - $agent_territories = $row[0]; - } - if (strlen($agent_territories) > 3) - { - $agent_territoriesSQL = preg_replace('/-$/','',$agent_territories); - $agent_territoriesSQL = preg_replace('/ $|^ /','',$agent_territoriesSQL); - $territory = preg_replace('/ /',"','",$agent_territoriesSQL); - } - $adooSQL = ''; + if (eregi("TERRITORY",$agent_dial_owner_only)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00406',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00407',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00408',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + + $adooSQL = $searchownerSQL; + } if (eregi("USER",$agent_dial_owner_only)) {$adooSQL = "and owner='$user'";} - if (eregi("TERRITORY",$agent_dial_owner_only)) {$adooSQL = "and owner IN('$territory')";} if (eregi("USER_GROUP",$agent_dial_owner_only)) {$adooSQL = "and owner='$user_group'";} + if ($lead_order_randomize == 'Y') {$last_order = "RAND()";} + else + { + $last_order = "lead_id asc"; + if ($lead_order_secondary == 'LEAD_ASCEND') {$last_order = "lead_id asc";} + if ($lead_order_secondary == 'LEAD_DESCEND') {$last_order = "lead_id desc";} + if ($lead_order_secondary == 'CALLTIME_ASCEND') {$last_order = "last_local_call_time asc";} + if ($lead_order_secondary == 'CALLTIME_DESCEND') {$last_order = "last_local_call_time desc";} + } + $order_stmt = ''; if (eregi("DOWN",$lead_order)){$order_stmt = 'order by lead_id asc';} if (eregi("UP",$lead_order)){$order_stmt = 'order by lead_id desc';} - if (eregi("UP LAST NAME",$lead_order)){$order_stmt = 'order by last_name desc, lead_id asc';} - if (eregi("DOWN LAST NAME",$lead_order)){$order_stmt = 'order by last_name, lead_id asc';} - if (eregi("UP PHONE",$lead_order)){$order_stmt = 'order by phone_number desc, lead_id asc';} - if (eregi("DOWN PHONE",$lead_order)){$order_stmt = 'order by phone_number, lead_id asc';} - if (eregi("UP COUNT",$lead_order)){$order_stmt = 'order by called_count desc, lead_id asc';} - if (eregi("DOWN COUNT",$lead_order)){$order_stmt = 'order by called_count, lead_id asc';} - if (eregi("UP LAST CHAMADA TIME",$lead_order)){$order_stmt = 'order by last_local_call_time desc, lead_id asc';} - if (eregi("DOWN LAST CHAMADA TIME",$lead_order)){$order_stmt = 'order by last_local_call_time, lead_id asc';} - if (eregi("RANDOM",$lead_order)){$order_stmt = 'order by RAND()';} - if (eregi("UP RANK",$lead_order)){$order_stmt = 'order by rank desc, lead_id asc';} - if (eregi("DOWN RANK",$lead_order)){$order_stmt = 'order by rank, lead_id asc';} - if (eregi("UP OWNER",$lead_order)){$order_stmt = 'order by owner desc, lead_id asc';} - if (eregi("DOWN OWNER",$lead_order)){$order_stmt = 'order by owner, lead_id asc';} - if (eregi("UP TIMEZONE",$lead_order)){$order_stmt = 'order by gmt_offset_now desc, lead_id asc';} - if (eregi("DOWN TIMEZONE",$lead_order)){$order_stmt = 'order by gmt_offset_now, lead_id asc';} + if (eregi("UP LAST NAME",$lead_order)){$order_stmt = "order by last_name desc, $last_order";} + if (eregi("DOWN LAST NAME",$lead_order)){$order_stmt = "order by last_name, $last_order";} + if (eregi("UP PHONE",$lead_order)){$order_stmt = "order by phone_number desc, $last_order";} + if (eregi("DOWN PHONE",$lead_order)){$order_stmt = "order by phone_number, $last_order";} + if (eregi("UP COUNT",$lead_order)){$order_stmt = "order by called_count desc, $last_order";} + if (eregi("DOWN COUNT",$lead_order)){$order_stmt = "order by called_count, $last_order";} + if (eregi("UP LAST CHAMADA TIME",$lead_order)){$order_stmt = "order by last_local_call_time desc, $last_order";} + if (eregi("DOWN LAST CHAMADA TIME",$lead_order)){$order_stmt = "order by last_local_call_time, $last_order";} + if (eregi("RANDOM",$lead_order)){$order_stmt = "order by RAND()";} + if (eregi("UP RANK",$lead_order)){$order_stmt = "order by rank desc, $last_order";} + if (eregi("DOWN RANK",$lead_order)){$order_stmt = "order by rank, $last_order";} + if (eregi("UP OWNER",$lead_order)){$order_stmt = "order by owner desc, $last_order";} + if (eregi("DOWN OWNER",$lead_order)){$order_stmt = "order by owner, $last_order";} + if (eregi("UP TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now desc, $last_order";} + if (eregi("DOWN TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now, $last_order";} - $stmt="UPDATE vicidial_list SET status='QUEUE',user='$user' where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; + $stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and user NOT LIKE \"QUEUE%\" and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00242',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); + # $fp = fopen ("./DNNdebug_log.txt", "a"); + # fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province|$affected_rows|$stmt|\n"); + # fclose($fp); + 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,vendor_lead_code FROM vicidial_list where user='QUEUE$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";} @@ -1611,8 +2066,10 @@ if ($ACTION == 'manDiaLnextCaLL') $list_id = $row[1]; $gmt_offset_now = $row[2]; $state = $row[3]; + $entry_list_id = $row[4]; + $vendor_lead_code = $row[5]; - $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -1645,7 +2102,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";} @@ -1685,10 +2142,85 @@ 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++; + if ( (strlen($agent_dialed_type) < 3) or (strlen($agent_dialed_number) < 6) ) + { + $agent_dialed_number = $phone_number; + if (strlen($agent_dialed_type) < 3) + {$agent_dialed_type = 'MAIN';} + } + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + if ($agent_dialed_type=='ALT') + {$agent_dialed_number = $alt_phone;} + if ($agent_dialed_type=='ADDR3') + {$agent_dialed_number = $address3;} + } + + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00414',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $row=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $row[0]; + $local_call_time = $row[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($agent_dialed_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefone and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefone Código de Área fora da zona discável $PHONEgmt_offset ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Código Postal fora da zona discável $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefone Código de Área fora da zona discável $PHONEgmt_offset ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Código Postal fora da zona discável $POSTgmt_offset ";} + } + } + ##### END check for postal_code and phone time zones if alert enabled + + ##### check if system is set to generate logfile for transfers $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; $rslt=mysql_query($stmt, $link); @@ -1704,15 +2236,15 @@ 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);} - # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; # DATETIME|campaign|lead_id|phone_number|user|type # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M $fp = fopen ("./xfer_log.txt", "a"); - fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M|$MqueryCID||$province\n"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province\n"); fclose($fp); } @@ -1721,7 +2253,32 @@ if ($ACTION == 'manDiaLnextCaLL') $CBcallback_time = ''; $CBuser = ''; $CBcomments = ''; - if (ereg("CALLBK",$dispo)) + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00366',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00367',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or ($dispo == 'CBHOLD') ) { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); @@ -1747,6 +2304,8 @@ if ($ACTION == 'manDiaLnextCaLL') { $row=mysql_fetch_row($rslt); $local_gmt = $row[0]; + $isdst = date("I"); + if ($isdst) {$local_gmt++;} } $LLCT_DATE_offset = ($local_gmt - $gmt_offset_now); $LLCT_DATE = date("Y-m-d H:i:s", mktime(date("H")-$LLCT_DATE_offset,date("i"),date("s"),date("m"),date("d"),date("Y"))); @@ -1778,7 +2337,32 @@ if ($ACTION == 'manDiaLnextCaLL') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00032',$user,$server_ip,$session_name,$one_mysql_log);} - + + $stmt="UPDATE vicidial_lists set list_lastcalldate=NOW() where list_id='$list_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);} + + $campaign_cid_override=''; + $LISTweb_form_address=''; + $LISTweb_form_address_two=''; + ### check if there is a list_id override + if (strlen($list_id) > 1) + { + $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two FROM vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00245',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $lio_ct = mysql_num_rows($rslt); + if ($lio_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_cid_override = $row[0]; + $LISTweb_form_address = $row[1]; + $LISTweb_form_address_two = $row[2]; + } + } + ### if preview dialing, do not send the call if ( (strlen($preview)<1) || ($preview == 'NO') ) { @@ -1794,37 +2378,78 @@ if ($ACTION == 'manDiaLnextCaLL') $Local_dial_timeout = ($Local_dial_timeout * 1000); if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} - $campaign_cid_override=''; - ### check if there is a list_id override - if (strlen($list_id) > 1) - { - $stmt = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00245',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $campaign_cid_override = $row[0]; - } - } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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 == 'AREACODE') + { + $temp_ac = substr("$agent_dialed_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00426',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00427',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$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);} - # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + ### 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: MmddhhmmssLLLLLLLLLL $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)) - {$Ndialstring = "$Local_out_prefix$phone_number";} + {$Ndialstring = "$Local_out_prefix$agent_dialed_number";} else - {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + {$Ndialstring = "$Local_out_prefix$phone_code$agent_dialed_number";} if ( ($usegroupalias > 0) and (strlen($account)>1) ) { @@ -1842,7 +2467,7 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00033',$user,$server_ip,$session_name,$one_mysql_log);} - $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$agent_dialed_number','$NOW_TIME','OUT')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00034',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1859,31 +2484,52 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00036',$user,$server_ip,$session_name,$one_mysql_log);} - #### update vicidial_agent_log if not MANUAL dial_method - if ($dial_method != 'MANUAL') - { - $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00301',$user,$server_ip,$session_name,$one_mysql_log);} - $VDpr_ct = mysql_num_rows($rslt); - if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) - { - $row=mysql_fetch_row($rslt); - $agent_log_id = $row[5]; - $pause_sec = (($StarTtime - $row[0]) + $row[1]); + # #### update vicidial_agent_log if not MANUAL dial_method + # if ($dial_method != 'MANUAL') + # { + # $pause_sec=0; + # $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00302',$user,$server_ip,$session_name,$one_mysql_log);} + # $VDpr_ct = mysql_num_rows($rslt); + # if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + # { + # $row=mysql_fetch_row($rslt); + # $agent_log_id = $row[5]; + # $pause_sec = (($StarTtime - $row[0]) + $row[1]); + # + # $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + # if ($format=='debug') {echo "\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} + # } + # } - $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00302',$user,$server_ip,$session_name,$one_mysql_log);} - } + + $val_pause_epoch=0; + $val_pause_sec=0; + $stmt = "SELECT pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00323',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) + { + $row=mysql_fetch_row($rslt); + $val_pause_epoch = $row[0]; + $val_pause_sec = ($StarTtime - $val_pause_epoch); } + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00324',$user,$server_ip,$session_name,$one_mysql_log);} + + if ($agent_dialed_number > 0) { - $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$phone_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; + $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','$agent_dialed_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00191',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1891,7 +2537,7 @@ if ($ACTION == 'manDiaLnextCaLL') ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00037',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1905,30 +2551,46 @@ if ($ACTION == 'manDiaLnextCaLL') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### if ($enable_queuemetrics_logging > 0) { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00389',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); # UNPAUSEALL - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00038',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CHAMADAOUTBOUND (formerly ENTERQUEUE) - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$agent_dialed_number',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00039',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00040',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1971,7 +2633,7 @@ if ($ACTION == 'manDiaLnextCaLL') $VDCL_xferconf_c_number=''; $VDCL_xferconf_d_number=''; $VDCL_xferconf_e_number=''; - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00277',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1988,7 +2650,7 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2007,6 +2669,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); + } + } } @@ -2045,8 +2751,8 @@ if ($ACTION == 'manDiaLnextCaLL') $LeaD_InfO .= $CBcallback_time . "\n"; $LeaD_InfO .= $CBuser . "\n"; $LeaD_InfO .= $CBcomments . "\n"; - $LeaD_InfO .= $phone_number . "\n"; - $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $agent_dialed_number . "\n"; + $LeaD_InfO .= $agent_dialed_type . "\n"; $LeaD_InfO .= $source_id . "\n"; $LeaD_InfO .= $rank . "\n"; $LeaD_InfO .= $owner . "\n"; @@ -2057,6 +2763,13 @@ 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"; + $LeaD_InfO .= $LISTweb_form_address . "\n"; + $LeaD_InfO .= $LISTweb_form_address_two . "\n"; + $LeaD_InfO .= $post_phone_time_diff_alert_message . "\n"; echo $LeaD_InfO; } @@ -2080,7 +2793,7 @@ if ($ACTION == 'alt_phone_change') if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) || (strlen($phone_number)<1) ) { $channel_live=0; - echo "TELEFONE ALTERNATIVO NUMERO STATUS NOT CHANGED\n"; + echo "FONE ALT NÚMERO STATUS NOT CHANGED\n"; echo "$phone_number $stage $lead_id or $called_count não é válido\n"; exit; } @@ -2091,7 +2804,7 @@ if ($ACTION == 'alt_phone_change') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00041',$user,$server_ip,$session_name,$one_mysql_log);} - echo "TELEFONE ALTERNATIVO NUMERO STATUS CHANGED\n"; + echo "FONE ALT NÚMERO STATUS CHANGED\n"; } } @@ -2143,12 +2856,17 @@ if ($ACTION == 'manDiaLskip') else { $called_count = ($called_count - 1); - ### flag the lead as called and change it's status to INCALL + ### set the lead back to previous status and called_count $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00042',$user,$server_ip,$session_name,$one_mysql_log);} + ### log the skip event + $stmt = "INSERT INTO vicidial_agent_skip_log set campaign_id='$campaign', previous_status='$stage', previous_called_count='$called_count',user='$user', lead_id='$lead_id', event_date=NOW();"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00419',$user,$server_ip,$session_name,$one_mysql_log);} echo "LEAD REVERTED\n"; } @@ -2173,8 +2891,22 @@ if ($ACTION == 'manDiaLonly') } else { + ##### clear out last call to same lead if exists ##### + if (strlen($old_CID) > 16) + { + $old_lead_id = substr($old_CID, -10); + $old_lead_id = ($old_lead_id + 0); + if ($lead_id == "$old_lead_id") + { + $stmt="DELETE FROM vicidial_auto_calls where callerid='$old_CID' and lead_id='$old_lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00428',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00043',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2182,14 +2914,30 @@ 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=''; + $LISTweb_form_address=''; + $LISTweb_form_address_two=''; $local_DEF = 'Local/'; $local_AMP = '@'; $Local_out_prefix = '9'; @@ -2217,7 +2965,7 @@ if ($ACTION == 'manDiaLonly') if (strlen($list_id) > 1) { - $stmt = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two FROM vicidial_lists where list_id='$list_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00247',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2226,19 +2974,63 @@ if ($ACTION == 'manDiaLonly') { $row=mysql_fetch_row($rslt); $campaign_cid_override = $row[0]; + $LISTweb_form_address = $row[1]; + $LISTweb_form_address_two = $row[2]; } } } } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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 == 'AREACODE') + { + $temp_ac = substr("$phone_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00429',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; - $PADlead_id = sprintf("%09s", $lead_id); - while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00430',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$temp_CID = preg_replace("/\D/",'',$security);} + if (strlen($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} + } - # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} + + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; - if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} - else {$CIDstring = "$MqueryCID";} + $EAC=''; + if ($use_eac > 0) + { + $eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone); + $EAC=" $eac_extension"; + } + if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";} + else {$CIDstring = "$MqueryCID$EAC";} if ( ($usegroupalias > 0) and (strlen($account)>1) ) { @@ -2288,27 +3080,91 @@ if ($ACTION == 'manDiaLonly') echo "$MqueryCID\n"; - #### update vicidial_agent_log if not MANUAL dial_method - if ($dial_method != 'MANUAL') +# #### update vicidial_agent_log if not MANUAL dial_method +# if ($dial_method != 'MANUAL') +# { +# $pause_sec=0; +# $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00304',$user,$server_ip,$session_name,$one_mysql_log);} +# $VDpr_ct = mysql_num_rows($rslt); +# if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) +# { +# $row=mysql_fetch_row($rslt); +# $agent_log_id = $row[5]; +# $pause_sec = (($StarTtime - $row[0]) + $row[1]); +# +# $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} +# } +# } + + $val_pause_epoch=0; + $val_pause_sec=0; + $val_dispo_epoch=0; + $val_dispo_sec=0; + $val_wait_epoch=0; + $val_wait_sec=0; + $stmt = "SELECT dispo_epoch,wait_epoch,pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00326',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) { - $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; - if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $val_dispo_epoch = $row[0]; + $val_wait_epoch = $row[1]; + $val_pause_epoch = $row[2]; + $val_dispo_sec = ($StarTtime - $val_dispo_epoch); + $val_wait_sec = ($StarTtime - $val_wait_epoch); + $val_pause_sec = ($StarTtime - $val_pause_epoch); + } + if ($val_dispo_epoch > 1000) + { + $stmt="UPDATE vicidial_agent_log set status='ALTNUM',dispo_sec='$val_dispo_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} - $VDpr_ct = mysql_num_rows($rslt); - if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00327',$user,$server_ip,$session_name,$one_mysql_log);} + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00328',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) { $row=mysql_fetch_row($rslt); - $agent_log_id = $row[5]; - $pause_sec = (($StarTtime - $row[0]) + $row[1]); - - $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00304',$user,$server_ip,$session_name,$one_mysql_log);} + $user_group = trim("$row[0]"); } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','ANDIAL');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00329',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id',last_state_change='$NOW_TIME' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00330',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); } + else + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00331',$user,$server_ip,$session_name,$one_mysql_log);} + } + + echo "$agent_log_id\n"; + if ($agent_dialed_number > 0) { @@ -2321,13 +3177,12 @@ if ($ACTION == 'manDiaLonly') ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00048',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); - $i=0; - while ($i < $qm_conf_ct) + if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; @@ -2336,31 +3191,46 @@ if ($ACTION == 'manDiaLonly') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; - $i++; + $queuemetrics_pe_phone_append = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### if ($enable_queuemetrics_logging > 0) { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00390',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); # UNPAUSEALL - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00049',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CHAMADAOUTBOUND (formerly ENTERQUEUE) - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00050',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00051',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2433,9 +3303,10 @@ if ($ACTION == 'manDiaLlookCaLL') $dialstatus =$row[0]; $hangup_cause =$row[1]; - $channel = $dialstatus . "-" . $hangup_cause; + $channel = $dialstatus; + $hangup_cause_msg = "Cause: " . $hangup_cause . " - " . hangup_cause_description($hangup_cause); - $call_output = "$uniqueid\n$channel\nERROR"; + $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg; $call_good++; ### Delete call record @@ -2443,6 +3314,11 @@ if ($ACTION == 'manDiaLlookCaLL') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00293',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00399',$user,$server_ip,$session_name,$one_mysql_log);} } } } @@ -2452,7 +3328,7 @@ if ($ACTION == 'manDiaLlookCaLL') { $wait_sec=0; $dead_epochSQL = ''; - $stmt = "select wait_epoch,wait_sec,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec,dead_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,'00053',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2465,7 +3341,7 @@ if ($ACTION == 'manDiaLlookCaLL') if ( ($now_dead_epoch > 1000) and ($now_dead_epoch < $StarTtime) ) {$dead_epochSQL = ",dead_epoch='$StarTtime'";} } - $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' $dead_epochSQL where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' $dead_epochSQL where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00054',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2504,9 +3380,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 "REGISTRO NÃO DEFINIDO\n"; echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign não é válido\n"; @@ -2526,6 +3405,13 @@ if ($stage == "start") $user_group = trim("$row[0]"); } + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$uniqueid',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00400',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + $manualVLexists=0; $beginUNIQUEID = preg_replace("/\..*/","",$uniqueid); $stmt="SELECT count(*) from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; @@ -2635,13 +3521,13 @@ if ($stage == "end") $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); ##### look for the start epoch in the vicidial_closer_log table - $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id,status FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $VDIDselect = "VDCL_LID $lead_id $phone_number $user $four_hours_ago"; } else { ##### look for the start epoch in the vicidial_log table - $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } $rslt=mysql_query($stmt, $link); @@ -2655,6 +3541,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 @@ -2669,7 +3556,7 @@ if ($stage == "end") fclose($fp); ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log - $stmt="SELECT start_epoch,term_reason,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,campaign_id,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00061',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2680,6 +3567,7 @@ if ($stage == "end") $start_epoch = $row[0]; $VDterm_reason = $row[1]; $VDcampaign_id = $row[2]; + $VDstatus = $row[3]; $length_in_sec = ($StarTtime - $start_epoch); } else @@ -2696,7 +3584,9 @@ if ($stage == "end") if ($VLA_inOUT == 'INBOUND') { - $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec', status='$status_dispo' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $vcl_statusSQL=''; + if ($VDstatus == 'INCALL') {$vcl_statusSQL = ",status='$status_dispo'";} + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vcl_statusSQL where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00062',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2704,6 +3594,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 { @@ -2715,7 +3609,7 @@ if ($stage == "end") ############################################# ##### 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_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00063',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2730,6 +3624,8 @@ if ($stage == "end") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_dispo_pause = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; if ($enable_queuemetrics_logging > 0) { @@ -2781,7 +3677,7 @@ if ($stage == "end") if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)",$auto_alt_dial)) ) { $alt_dial_skip=0; - $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT alt_phone,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00065',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2793,6 +3689,7 @@ if ($stage == "end") $alt_phone = eregi_replace("[^0-9]","",$alt_phone); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$alt_phone = '';} if (strlen($alt_phone)>5) @@ -2841,7 +3738,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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -2858,7 +3755,7 @@ if ($stage == "end") if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) { $addr3_dial_skip=0; - $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT address3,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00069',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2870,6 +3767,7 @@ if ($stage == "end") $address3 = eregi_replace("[^0-9]","",$address3); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$address3 = '';} if (strlen($address3)>5) @@ -2918,7 +3816,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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -2945,7 +3843,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,vendor_lead_code 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";} @@ -2956,6 +3854,8 @@ if ($stage == "end") $EA_gmt_offset_now = $row[0]; $EA_state = $row[1]; $EA_list_id = $row[2]; + $EA_entry_list_id = $row[3]; + $EA_vendor_lead_code = $row[4]; } $alt_dial_phones_count=0; $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; @@ -3033,7 +3933,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',vendor_lead_code='$EA_vendor_lead_code';"; 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);} @@ -3101,7 +4001,10 @@ if ($stage == "end") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00081',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $licf_SQL = ''; + if ($VLA_inOUT == 'INBOUND') + {$licf_SQL = ",last_inbound_call_finish='$NOW_TIME'";} + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' $licf_SQL where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00082',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3120,7 +4023,22 @@ if ($stage == "end") { if ($enable_queuemetrics_logging > 0) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00391',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00083',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3158,7 +4076,22 @@ if ($stage == "end") $CLstage = preg_replace("/XFER|CLOSER|-/",'',$CLstage); if ($CLstage < 0.25) {$CLstage=0;} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00392',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00085',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3193,7 +4126,7 @@ if ($stage == "end") { if ($enable_queuemetrics_logging > 0) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00088',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3209,15 +4142,16 @@ if ($stage == "end") if ( (ereg("NONE",$term_reason)) or (ereg("NONE",$VDterm_reason)) or (strlen($VDterm_reason) < 1) ) { ### check to see if lead should be alt_dialed - $stmt="SELECT term_reason,uniqueid from vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT term_reason,uniqueid,status from vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00089',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { $row=mysql_fetch_row($rslt); - $VDterm_reason = $row[0]; - $VDvicidial_id = $row[1]; + $VDterm_reason = $row[0]; + $VDvicidial_id = $row[1]; + $VDstatus = $row[2]; $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } if (ereg("CALLER",$VDterm_reason)) @@ -3230,18 +4164,25 @@ if ($stage == "end") } } + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$uniqueid',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00401',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + ### check to see if the vicidial_log record exists, if not, insert it $manualVLexists=0; $beginUNIQUEID = preg_replace("/\..*/","",$uniqueid); - $stmt="SELECT count(*) from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; + $stmt="SELECT status from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00223',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - $VL_exists_ct = mysql_num_rows($rslt); - if ($VL_exists_ct > 0) + $manualVLexists = mysql_num_rows($rslt); + if ($manualVLexists > 0) { $row=mysql_fetch_row($rslt); - $manualVLexists = $row[0]; + $VDstatus = $row[0]; } if ($manualVLexists < 1) @@ -3273,7 +4214,8 @@ if ($stage == "end") } ##### update the duration and end time in the vicidial_log table - $stmt="UPDATE vicidial_log set $SQLterm end_epoch='$StarTtime', length_in_sec='$length_in_sec', status='$status_dispo' where uniqueid='$uniqueid' and lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; + if ($VDstatus == 'INCALL') {$vl_statusSQL = ",status='$status_dispo'";} + $stmt="UPDATE vicidial_log set $SQLterm end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vl_statusSQL where uniqueid='$uniqueid' and lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00090',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3322,7 +4264,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);} @@ -3361,7 +4303,22 @@ if ($stage == "end") if (strlen($VDqueue_position) < 1) {$VDqueue_position=1;} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$VDqueue_position',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00393',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$VDqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00094',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3454,7 +4411,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);} @@ -3491,7 +4450,7 @@ if ($stage == "end") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00098',$user,$server_ip,$session_name,$one_mysql_log);} echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; - if (strlen($filename)>2) + if (strlen($filename[$loop_count])>2) { $stmt="SELECT recording_id,start_epoch,vicidial_id,lead_id FROM recording_log where filename='$filename[$loop_count]'"; if ($format=='debug') {echo "\n";} @@ -3517,9 +4476,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); @@ -3552,7 +4514,7 @@ if ($stage == "end") $dead_secSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_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,'00101',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3584,7 +4546,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);} @@ -3595,6 +4557,16 @@ if ($stage == "end") if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00299',$user,$server_ip,$session_name,$one_mysql_log);} + + ### if queuemetrics_dispo_pause dispo tag is enabled, log it here + if (strlen($queuemetrics_dispo_pause) > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$queuemetrics_dispo_pause';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00364',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } } } @@ -3658,6 +4630,8 @@ if ($ACTION == 'VDADcheckINCOMING') $alt_phone_note=''; $alt_phone_active=''; $alt_phone_count=''; + $INclosecallid=''; + $INxfercallid=''; if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) { @@ -3724,7 +4698,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";} @@ -3762,6 +4736,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 @@ -3769,7 +4745,32 @@ if ($ACTION == 'VDADcheckINCOMING') $CBcallback_time = ''; $CBuser = ''; $CBcomments = ''; - if (ereg("CALLBK",$dispo)) + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00368',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00369',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or ($dispo == 'CBHOLD') ) { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); @@ -3792,9 +4793,22 @@ 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;"; + $stmt="SELECT user_group,full_name FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3803,9 +4817,9 @@ if ($ACTION == 'VDADcheckINCOMING') { $row=mysql_fetch_row($rslt); $user_group = trim("$row[0]"); + $fullname = $row[1]; } - $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); @@ -3830,7 +4844,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00248',$user,$server_ip,$session_name,$one_mysql_log);} $VDAP_cid_ct = mysql_num_rows($rslt); - if ($VDACP_cid_ct > 0) + if ($VDAP_cid_ct > 0) { $row=mysql_fetch_row($rslt); $Xalt_phone_count =$row[0]; @@ -3840,7 +4854,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00249',$user,$server_ip,$session_name,$one_mysql_log);} $VDAPct_cid_ct = mysql_num_rows($rslt); - if ($VDACPct_cid_ct > 0) + if ($VDAPct_cid_ct > 0) { $row=mysql_fetch_row($rslt); $COUNTalt_phone_count =$row[0]; @@ -3872,7 +4886,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);} @@ -3880,13 +4894,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); } } @@ -3911,7 +4927,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);} @@ -3919,25 +4935,29 @@ 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 if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00281',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3958,7 +4978,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)) { @@ -3995,7 +5015,22 @@ 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);} - $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + 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); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00118',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4019,7 +5054,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);} @@ -4050,8 +5085,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);} @@ -4085,6 +5123,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) ) { @@ -4104,7 +5144,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00188',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4117,7 +5157,7 @@ if ($ACTION == 'VDADcheckINCOMING') if (strlen($VDCL_group_web_vars) < 1) { - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00189',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4130,7 +5170,7 @@ if ($ACTION == 'VDADcheckINCOMING') } ### update the comments in vicidial_live_agents record - $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND',last_inbound_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00120',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4139,7 +5179,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);} @@ -4162,6 +5202,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; @@ -4177,7 +5218,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00190',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4192,7 +5233,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_caller_id_number=''; if (strlen($VDCL_default_group_alias)>1) { - $stmt = "select caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; + $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00187',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4207,7 +5248,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00282',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4225,12 +5266,45 @@ if ($ACTION == 'VDADcheckINCOMING') {$VDCL_xferconf_d_number = $row[3];} if (strlen($row[4]) > 0) {$VDCL_xferconf_e_number = $row[4];} + if (strlen($row[5]) > 5) + {$VDCL_group_web = $row[5];} + if (strlen($row[6]) > 5) + {$VDCL_group_web_two = $row[6];} + } + } + + $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 sendligadoto 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";} @@ -4272,6 +5346,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); @@ -4318,6 +5437,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; @@ -4325,7 +5448,7 @@ if ($ACTION == 'VDADcheckINCOMING') $wait_sec=0; $StarTtime = date("U"); - $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00123',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4340,8 +5463,33 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00124',$user,$server_ip,$session_name,$one_mysql_log);} - ### If CHAMADABK, change vicidial_callback record to INACTIVE - if (eregi("CALLBK|CBHOLD", $dispo)) + ### If a scheduled callback, change vicidial_callback record to INACTIVE + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00370',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00371',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or (eregi("CALLBK|CBHOLD", $dispo)) ) { $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; if ($format=='debug') {echo "\n";} @@ -4375,7 +5523,7 @@ if ($ACTION == 'VDADcheckINCOMING') { if (eregi('--A--user_custom_',$VDCL_start_call_url)) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five 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,'00283',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4424,8 +5572,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); @@ -4452,11 +5600,83 @@ 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); + $VDCL_start_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($callerid)),$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 = urlencode(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++; + } + } + } + + $stmt="UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00420',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$VDCL_start_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='start',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00421',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### grab the call_start_url ### if ($DB > 0) {echo "$VDCL_start_call_url
\n";} $SCUfile = file("$VDCL_start_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00422',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + ##### BEGIN special filtering and response for Vtiger account balance function ##### + # http://vtiger/vicidial/api.php?mode=callxfer&contactwsid=--A--vendor_lead_code--B--&minuteswarning=3 $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00294',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4466,27 +5686,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); } } @@ -4602,14 +5866,14 @@ if ($ACTION == 'userLOGout') $vla_delete = mysql_affected_rows($link); ##### Delete the vicidial_live_inbound_agents records for this session - $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + $stmt="DELETE from vicidial_live_inbound_agents where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00131',$user,$server_ip,$session_name,$one_mysql_log);} $vlia_delete = mysql_affected_rows($link); $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00136',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4630,7 +5894,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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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";} @@ -4638,13 +5902,17 @@ 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]; + $queuemetrics_dispo_pause = $row[9]; + $queuemetrics_pe_phone_append = $row[10]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -4656,6 +5924,10 @@ if ($ACTION == 'userLOGout') if ($enable_queuemetrics_logging > 0) { + $QM_LOGOFF = 'AGENTLOGOFF'; + if ($queuemetrics_loginout=='CALLBACK') + {$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); @@ -4665,29 +5937,100 @@ 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;"; + $logintime=0; + $stmt = "SELECT time_id,data1 FROM queue_log where agent='Agent/$user' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > $check_time order by time_id desc limit 1;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00139',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - echo "$stmt\n"; $li_conf_ct = mysql_num_rows($rslt); $i=0; while ($i < $li_conf_ct) { $row=mysql_fetch_row($rslt); $logintime = $row[0]; + $loginphone = $row[1]; $i++; } + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00394',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + $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';"; - 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_loginout != 'NONE') + { + $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' $data4SQL;"; + 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) + { + if ($queuemetrics_loginout == 'NONE') + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00396',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + if ( ($logintime < 1) or ($queuemetrics_loginout == 'NONE') ) + { + $stmtB = "SELECT time_id,data3 FROM queue_log where agent='Agent/$user' and verb='PAUSEREASON' and data1='LOGIN' order by time_id desc limit 1;"; + $rsltB=mysql_query($stmtB, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00365',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "
$stmtB\n";} + $qml_ct = mysql_num_rows($rsltB); + if ($qml_ct > 0) + { + $row=mysql_fetch_row($rsltB); + $logintime = $row[0]; + $loginphone = $row[1]; + } + } + $stmt = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$user' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$campaign' 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";} + $amq_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $amq_conf_ct) + { + $row=mysql_fetch_row($rslt); + $AMqueue[$i] = $row[0]; + $i++; + } + + ### add the logged-in campaign as well + $AMqueue[$i] = $campaign; + $i++; + $amq_conf_ct++; + + $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' $data4SQL;"; + $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); } } @@ -4713,7 +6056,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "SELECT dispo_call_url from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT dispo_call_url,queuemetrics_callstatus_override from vicidial_campaigns vc,vicidial_live_agents vla where vla.campaign_id=vc.campaign_id and vla.user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00284',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4721,11 +6064,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);} @@ -4752,6 +6096,12 @@ 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); + $log_dispo_choice = $dispo_choice; + if (strlen($CallBackLeadStatus) > 0) {$log_dispo_choice = $CallBackLeadStatus;} + $stmt = "SELECT count(*) from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -4759,10 +6109,21 @@ if ($ACTION == 'updateDISPO') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { - $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + $call_type='IN'; + $stmt = "UPDATE vicidial_closer_log set status='$log_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,'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";} @@ -4773,6 +6134,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)) ) @@ -4784,7 +6146,7 @@ if ($ACTION == 'updateDISPO') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { - $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; + $stmt="UPDATE vicidial_log set status='$log_dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00145',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4836,7 +6198,7 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00250',$user,$server_ip,$session_name,$one_mysql_log);} $VDAP_cid_ct = mysql_num_rows($rslt); - if ($VDACP_cid_ct > 0) + if ($VDAP_cid_ct > 0) { $row=mysql_fetch_row($rslt); $Xalt_phone_count =$row[0]; @@ -4846,7 +6208,7 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00251',$user,$server_ip,$session_name,$one_mysql_log);} $VDAPct_cid_ct = mysql_num_rows($rslt); - if ($VDACPct_cid_ct > 0) + if ($VDAPct_cid_ct > 0) { $row=mysql_fetch_row($rslt); $COUNTalt_phone_count =$row[0]; @@ -4872,14 +6234,21 @@ 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) > 9) {$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';"; + $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='$log_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";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00215',$user,$server_ip,$session_name,$one_mysql_log);} + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$FAKEcall_id',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00402',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + $MAN_vl_insert++; } @@ -4887,10 +6256,15 @@ if ($ACTION == 'updateDISPO') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00219',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00403',$user,$server_ip,$session_name,$one_mysql_log);} } else { - $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; + $stmt="UPDATE vicidial_log set status='$log_dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00145',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4931,27 +6305,27 @@ if ($ACTION == 'updateDISPO') } $insert_into_dnc=0; - if ( ($use_internal_dnc=='Y') and (eregi("\|$dispo_choice\|", $DNC_string_check) ) ) + if ( ($use_internal_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $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";} $insert_into_dnc++; } - if ( ($use_campaign_dnc=='Y') and (eregi("\|$dispo_choice\|", $DNC_string_check) ) ) + if ( ($use_campaign_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - $stmt="INSERT INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');"; + $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";} @@ -4963,7 +6337,7 @@ if ($ACTION == 'updateDISPO') $dispo_epochSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; + $stmt = "SELECT dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00150',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4996,7 +6370,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='$log_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);} @@ -5045,23 +6419,52 @@ if ($ACTION == 'updateDISPO') $comments = eregi_replace("'",'',$comments); $comments = eregi_replace(';','',$comments); $comments = eregi_replace("\\\\",' ',$comments); - $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group,lead_status) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group','$CallBackLeadStatus');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00154',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc from vicidial_campaigns where campaign_id='$campaign';"; + ### BEGIN Call Notas Logging ### + if (strlen($call_notes) > 1) + { + $VDADchannel_group=$campaign; + $stmt = "SELECT campaign_id,closecallid 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,'00372',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_cn_ct = mysql_num_rows($rslt); + if ($VDCL_cn_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group = $row[0]; + $vicidial_id = $row[1]; + } + else + {$vicidial_id = $uniqueid;} + + # Insert into vicidial_call_notes + $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$NOW_TIME',call_notes='" . mysql_real_escape_string($call_notes) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00373',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $notesid = mysql_insert_id($link); + } + ### END Call Notas Logging ### + + $stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,api_manual_dial from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $VC_auto_alt_dial_statuses = $row[0]; $use_internal_dnc = $row[1]; $use_campaign_dnc = $row[2]; + $api_manual_dial = $row[3]; if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) ) { - $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + $stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00156',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5152,6 +6555,13 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00158',$user,$server_ip,$session_name,$one_mysql_log);} } + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="DELETE from vicidial_manual_dial_queue where user='$user' and status='QUEUE';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00363',$user,$server_ip,$session_name,$one_mysql_log);} + } ####### START Vtiger Call Logging ####### $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; @@ -5187,7 +6597,7 @@ if ($ACTION == 'updateDISPO') if ( (ereg('ACCTID',$vtiger_search_category)) or (ereg('ACCOUNT',$vtiger_search_category)) ) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5199,7 +6609,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5375,7 +6785,7 @@ if ($ACTION == 'updateDISPO') ### check and see if the custom date fields exist, if they do then update them if necessary - # Date of Ultimo Attempt, Date of Ultimo Non-Contact, Date of Ultimo Contact, Date of Ultimo Sale + # Date of Sobrenome Attempt, Date of Sobrenome Non-Contact, Date of Sobrenome Contact, Date of Sobrenome Sale # first find the sale statuses that are in the system $SALE_string_check = '|'; @@ -5543,7 +6953,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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00159',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5557,35 +6967,116 @@ if ($ACTION == 'updateDISPO') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_callstatus = $row[6]; + $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; } ##### 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); if (strlen($stage) < 2) {$stage = $campaign;} - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + $qm_dispo_codeSQL=''; + if (strlen($qm_dispo_code) > 0) + {$qm_dispo_codeSQL = ",data3='$qm_dispo_code'";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id' $qm_dispo_codeSQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00160',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); + ### check to make sure a COMPLETE record is present for this call + $QLcomplete_records=0; + $stmt = "SELECT count(*) FROM queue_log where verb IN('COMPLETEAGENT','COMPLETECALLER') and call_id='$MDnextCID' and agent='Agent/$user' and queue='$stage';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00409',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $comp_ct = mysql_num_rows($rslt); + if ($comp_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_records = $row[0]; + } + + ### if there are no complete records, look up information to insert one for this call + if ($QLcomplete_records < 1) + { + $QLconnect_time=$StarTtime; + $QLcomplete_time=$StarTtime; + $QLconnect_one=''; + $QLconnect_four=''; + $QLcomplete_position=1; + + $stmt = "SELECT time_id,data1,data4 FROM queue_log where verb='CONNECT' and call_id='$MDnextCID' and agent='Agent/$user' and queue='$stage' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00410',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $connect_ct = mysql_num_rows($rslt); + if ($connect_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLconnect_time = $row[0]; + $QLconnect_one = $row[1]; + $QLconnect_four = $row[2]; + } + + $stmt = "SELECT time_id FROM queue_log where verb='PAUSEREASON' and call_id='$MDnextCID' and agent='Agent/$user' and data1='$queuemetrics_dispo_pause' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00411',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $pausereason_ct = mysql_num_rows($rslt); + if ($pausereason_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_time = $row[0]; + } + + $QLcomplete_length = ($QLcomplete_time - $QLconnect_time); + if ($QLcomplete_length < 0) {$QLcomplete_length=0;} + if ($QLcomplete_length > 86400) {$QLcomplete_length=1;} + + ## if inbound, check for initial queue position + if (preg_match("/^Y/",$MDnextCID)) + { + $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); + + $stmt = "SELECT queue_position FROM vicidial_closer_log where lead_id='$lead_id' and campaign_id='$stage' and call_date > \"$four_hours_ago\" 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,'00412',$user,$server_ip,$session_name,$one_mysql_log);} + $vcl_ct = mysql_num_rows($rslt); + if ($vcl_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_position = $row[0]; + } + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$QLcomplete_time',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='COMPLETEAGENT',data1='$QLconnect_one',data2='$QLcomplete_length',data3='$QLcomplete_position',serverid='$queuemetrics_log_id',data4='$QLconnect_four';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00413',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + 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; $talk_time_ms=0; $talk_time_min=0; - if (eregi('--A--user_custom_',$dispo_call_url)) + if ( (eregi('--A--user_custom_',$dispo_call_url)) or (eregi('--A--fullname',$dispo_call_url)) ) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $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,'00288',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5593,17 +7084,18 @@ if ($ACTION == 'updateDISPO') if ($VUC_ct > 0) { $row=mysql_fetch_row($rslt); - $user_custom_one = urlencode(trim($row[0])); - $user_custom_two = urlencode(trim($row[1])); - $user_custom_three = urlencode(trim($row[2])); - $user_custom_four = urlencode(trim($row[3])); - $user_custom_five = urlencode(trim($row[4])); + $user_custom_one = urlencode(trim($row[0])); + $user_custom_two = urlencode(trim($row[1])); + $user_custom_three = urlencode(trim($row[2])); + $user_custom_four = urlencode(trim($row[3])); + $user_custom_five = urlencode(trim($row[4])); + $fullname = urlencode(trim($row[5])); } } if (eregi('--A--talk_time',$dispo_call_url)) { - $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + $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,'00289',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5630,7 +7122,7 @@ if ($ACTION == 'updateDISPO') if (eregi('--A--dispo_name--B--',$dispo_call_url)) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00297',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5638,11 +7130,11 @@ if ($ACTION == 'updateDISPO') if ($vs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00298',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5650,17 +7142,89 @@ if ($ACTION == 'updateDISPO') if ($vcs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } } 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 = urlencode(trim($row[0])); + $DID_description = urlencode(trim($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";} @@ -5698,6 +7262,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); @@ -5733,9 +7298,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); @@ -5765,10 +7330,81 @@ 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); + $dispo_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($MDnextCID)),$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 = urlencode(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++; + } + } + } + + $stmt="UPDATE vicidial_log_extended set dispo_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00423',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$dispo_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='dispo',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00424',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### send dispo_call_url ### if ($DB > 0) {echo "$dispo_call_url
\n";} $SCUfile = file("$dispo_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00425',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00296',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5787,7 +7423,94 @@ 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); + } + + # debug testing sleep + # sleep(5); + echo 'Lead ' . $lead_id . ' foi modificado para ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; } @@ -5929,7 +7652,12 @@ 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";} + if ($ACTION == 'VDADpause') + {$vla_ring_resetSQL = ",ring_callerid=''";} + $stmt="UPDATE vicidial_live_agents set status='$stage' $vla_lead_wipeSQL $vla_ring_resetSQL 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);} @@ -5948,7 +7676,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00167',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5963,6 +7691,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -5986,7 +7715,22 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $user_group = trim("$row[0]"); } - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00395',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00168',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5997,7 +7741,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) } $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6085,7 +7829,17 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $VLAaffected_rows_update = mysql_affected_rows($link); } } - echo 'Agent ' . $user . ' está agora com o status ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n"; + if (strlen($sub_status) > 0) + { + ### if a pause code(sub_status) is sent with this pause request, continueligadoto that action without printing output + $stage = 0; + $status = $sub_status; + $ACTION = 'PauseCodeSubmit'; + } + else + { + echo 'Agent ' . $user . ' está agora com o status ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n"; + } } @@ -6103,7 +7857,7 @@ if ($ACTION == 'UpdatEFavoritEs') } else { - $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + $stmt = "SELECT count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00172',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6144,7 +7898,7 @@ if ($ACTION == 'PauseCodeSubmit') ### if this is the first pause code entry in a pause session, simply update and log to queue_log if ($stage < 1) { - $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id >= '$agent_log_id' and user='$user' and ( (sub_status is NULL) or (sub_status='') )order by agent_log_id limit 2;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00175',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6154,10 +7908,10 @@ if ($ACTION == 'PauseCodeSubmit') else { $pause_sec=0; - $stmt = "select pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -6167,12 +7921,12 @@ if ($ACTION == 'PauseCodeSubmit') $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00307',$user,$server_ip,$session_name,$one_mysql_log);} $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00309',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00308',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -6184,14 +7938,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); } @@ -6200,7 +7954,7 @@ if ($ACTION == 'PauseCodeSubmit') { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00176',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -6216,6 +7970,7 @@ if ($ACTION == 'PauseCodeSubmit') $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $allow_sipsak_messages = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -6227,10 +7982,12 @@ if ($ACTION == 'PauseCodeSubmit') } if ($enable_queuemetrics_logging > 0) { + $pause_call_id='NONE'; + if (strlen($campaign_cid) > 12) {$pause_call_id = $campaign_cid;} $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/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$pause_call_id',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00177',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6289,6 +8046,8 @@ if ($ACTION == 'AGENTSview') echo "
Timeclock Relogio ponto
 
Login do Usuário:
"; ### Gather agents data and statuses + $agentviewlistSQL=''; + $j=0; $stmt="SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user $AGENTviewSQL order by vu.full_name;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -6302,6 +8061,7 @@ if ($ACTION == 'AGENTSview') $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; if ( ($status=='READY') or ($status=='CLOSER') ) { @@ -6337,10 +8097,12 @@ if ($ACTION == 'AGENTSview') if ($comments=='AgentXferViewSelect') { - echo ""; - if ($agent_status_view_time > 0) - {echo "";} - echo ""; + $AXVSuserORDEM[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = $call_time; + $AXVSstatuscolor[$j] = $statuscolor; + $j++; } else { @@ -6353,8 +8115,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') + { + $AXVSuserORDEM[$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($AXVSuserORDEM); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserORDEM[$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"; + echo "    -PRONTO      -Chamadas      -PAUSA  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} echo "\n"; } @@ -6552,6 +8395,1358 @@ 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     STATUS     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     DISCAR  
Nenhuma chamada neste dia
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Feche Registro de chamadas"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Voltar"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Resultados Encontrado: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set segundos='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STATUS     LAST CHAMADA     CITY     STATE     ZIP     INFO     DISCAR  
Não foram encontrados resultados
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Não foram encontrados resultados
"; + echo "
"; + echo "Voltar"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Voltar"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campanha not found\n"; + echo "

"; + echo "Voltar"; + echo "
"; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Voltar"; + echo ""; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Resultados Encontrado: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set segundos='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Não foram encontrados resultados
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Não foram encontrados resultados
"; + echo "
"; + echo "Voltar"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Voltar"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campanha not found\n"; + echo "

"; + echo "Voltar"; + echo ""; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Estado de retorno de chamada:   $row[0]
Callback Estado de chumbo:   $row[7]
Tempo de entrada de retorno de chamada:   $row[1]
Callback tempo de disparo:   $row[2]
Comentários de retorno de chamada:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Título'; + $label_first_name = 'Nome'; + $label_middle_initial = 'MI'; + $label_last_name = 'Sobrenome'; + $label_address1 = 'Endereço1'; + $label_address2 = 'Endereço2'; + $label_address3 = 'Endereço3'; + $label_city = 'Cidade'; + $label_state = 'Estado'; + $label_province = 'Bairro'; + $label_postal_code = 'CEP'; + $label_vendor_lead_code = 'Vendedor'; + $label_gender = 'Gender'; + $label_phone_number = 'Telefone'; + $label_phone_code = 'Codigo de Área'; + $label_alt_phone = 'Telefone Alternativo'; + $label_security_phrase = 'Mostrar'; + $label_email = 'Email'; + $label_comments = 'Comentários'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefone and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefone Código de Área fora da zona discável $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Código Postal fora da zona discável $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefone Código de Área fora da zona discável $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Código Postal fora da zona discável $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Status:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Ligado Since Sobrenome Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Ligado Count:   $row[24]
Sobrenome Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
CONVITE PARA ESTE LOG LEAD:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STATUS     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Nenhuma chamada encontrado
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +9767,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_br/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_br/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_br/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_br/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_br/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_br/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_br/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_br/vdc_script_notes.php new file mode 100644 index 00000000..72c925b9 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_br/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 = 'Título'; +$label_first_name = 'Nome'; +$label_middle_initial = 'MI'; +$label_last_name = 'Sobrenome'; +$label_address1 = 'Endereço1'; +$label_address2 = 'Endereço2'; +$label_address3 = 'Endereço3'; +$label_city = 'Cidade'; +$label_state = 'Estado'; +$label_province = 'Bairro'; +$label_postal_code = 'CEP'; +$label_vendor_lead_code = 'Vendedor'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefone'; +$label_phone_code = 'Codigo de Área'; +$label_alt_phone = 'Telefone Alternativo'; +$label_security_phrase = 'Mostrar'; +$label_email = 'Email'; +$label_comments = 'Comentários'; + +$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 "Inválido Usuário/Senha: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Notas"; +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 Notas:

+
Please click ENVIAR to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + +
+
+ + + + diff --git a/agc_2-X/trunk/LANG_www/agc_br/vicidial.php b/agc_2-X/trunk/LANG_www/agc_br/vicidial.php index e3329e61..3f9d7d9d 100644 --- a/agc_2-X/trunk/LANG_www/agc_br/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_br/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -414,22 +523,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT DISCAR 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 linkligadothe agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of segundos to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the locationligadothe agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### BEGIN find any custom field labels ### +$label_title = 'Título'; +$label_first_name = 'Nome'; +$label_middle_initial = 'MI'; +$label_last_name = 'Sobrenome'; +$label_address1 = 'Endereço1'; +$label_address2 = 'Endereço2'; +$label_address3 = 'Endereço3'; +$label_city = 'Cidade'; +$label_state = 'Estado'; +$label_province = 'Bairro'; +$label_postal_code = 'CEP'; +$label_vendor_lead_code = 'Vendedor'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefone'; +$label_phone_code = 'Codigo de Área'; +$label_alt_phone = 'Telefone Alternativo'; +$label_security_phrase = 'Mostrar'; +$label_email = 'Email'; +$label_comments = 'Comentários'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -511,7 +686,7 @@ if ($campaign_login_list > 0) $SQL_log = "$stmt|"; $SQL_log = ereg_replace(';','',$SQL_log); $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='GERENTE Override OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';"; + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='SOBREPOR GERENTE OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01060',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,249 +12720,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -SAIR\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Chamadas Ativas
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Logado como usuário + ring)";} + echo " para a campanha: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + SAIR\n"; ?> +
- -DISCAGEM MANUAL       SELETOR RÁPIDO
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Chamadas Ativas
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STATUS:
+
+ Discar proximo número
+ + + VISUALIZAR REGISTRO
+ DISCAR FONE ALT
+ + ARQUIVO DE GRAVAÇÃO:
+
+
+ ID da gravação:
+
+ + Iniciar Gravação
+
+ Web Form
+ 0) + {echo "\"Web
\n";} + ?> +  
+ Colocar em espera
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Transferir a conferência
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Transferência
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Desligar Cliente
+
+
Enviar DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  Hora do cliente:                         Canal:
Informações do cliente:         + LEAD PESQUISA";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Chame Notas: "; + if ($agent_call_log_view == '1') + {echo "
ver as notas ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+
+ + + + + + +
DISCAGEM MANUAL       DISCAGEM RÁPIDA
- -X AGENDAMENTOS ATIVOS
+ +
- -
+ +VEJA Registro de chamadas
- segundos: -     + +     + + + +
VERSÃO:   CONFIGURAÇÃO:     Servidor:              
+ + Mostrar informações de discagem do canal +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +ATALHOS DE STATUS INATIVOS + + + segundos: +    
- +
+
+ + +Your Status:
Calls Dialing: +
+ + D1 - DISCAR\n"; - echo "
\n"; + echo "   \n"; echo "D2 - DISCAR\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
AGENDAMENTOS POR AGENTE :
Clique em um dos contatos abaixo para ligar. Se você clicar em um contatos abaixo o mesmo será removido da lista de Agendamentos. -
-
-
  - Atualizar -                 - Voltar -
-
+
 Solicita, em fila:  
 
- - height=>
NOVA DISCAGEM MANUAL PARA :

Digite abaixo a informação do novo contato que você deseja ligar. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Codigo de Área:   (Normalmente é 1 nos EUA-Canada)
Telefone Number: -   (12 digits max - digits only) -
Ligações Existentes Da Busca:   (Esta opção se verificado tentará encontrar o número de telefone no sistema antes de introduzi-lo como uma ligação nova)
-

-     -
-

Se você deseja ligar para um número que não está na lista de contatos, digite o número que voc6e deseja discar no campo Discagem Sobreposta abaixo. Para desligar essa ligação você deve abrir o link Ligações em sua sessão link no rodapé da página e desligar clicando no link do canal.
 
Discagem Sobreposta:   (digitos apenas por favor) -
-
- Discar Agora -                 - Preview Call -                 - Voltar -
-
- - - -
-
- - - - -Your Status:
Calls Dialing: -
- - - - - > - - -
-
- - Transferir a conferência            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - CLOSER LOCAL     - - Desligar linha Xfer -
- seconds -   - channel - - CONSULTIVO   - - Desligar ambas as linhas -
- Número a ser discado -   -   - AGENTES - - - DISCAGEM SOBREPOSTA - - ABANDONAR CHAMADA A TRES -
- Transferência sem acompanhamento -   - Discar com o cliente -   - Colocar chamada do cliente em espera -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Solicita, em fila:  
 
- - + 0) { @@ -10817,189 +13161,349 @@ if ($view_calls_in_queue > 0) ?> + +X AGENDAMENTOS ATIVOS
+
-
  -Outros agentes Status:  
 
+
  +Outros agentes Status:  
 
-
-Agentes de transferência disponíveis:
+$webphone_content
\n"; + } +else + { + echo "
  + Web Telefone:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
Agentes Ver +
+ + + +
  WebTelefone View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "Leads discáveis:
 \n"; } ?>
- + - - - height=70> - -
Status da ligação definida como:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
Atalhos para os status: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Transferir a conferência            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + CLOSER LOCAL     + + Desligar linha Xfer +
+ seconds +   + channel + + CONSULTIVO   + + Desligar ambas as linhas +
+ Número a ser discado +   + +                     + +   + + AGENTES + + + + + DISCAGEM SOBREPOSTA + + ABANDONAR CHAMADA A TRÊS +
+ Transferência sem consulta +   + Discar com o cliente +   + Colocar chamada do cliente em espera +   + + Botão Presets + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Agentes de transferência disponíveis:
+ + + + + +
Status da ligação definida como:

+ -
+
+
+ + + + - - + - + -
Atalhos para os status: Quanto ativo apenas pressione a tecla do teclado referente ao status desejado. A ligação será desligada e salva com o status definido automaticamemente:
+ - + - + -
+
- - height=70> - - - + +
Informação Precedente Da Rechamada: close
+ + + - - + -
Informação de Agendamento Anterior: close
-
-
-
-
+ +
+
+
+
-
+
+
- - height=70> - - - + +
Extensão Alt Telefone Informação: minimizar
+ + + - - + -
Informações Complementares do Fone Alt.: minimizar
-
-
-
-
+
+
+
+
+
-
+
+ - - - - -
maximizar
Alt Telefone Info
+ + + + +
maximizar
Alt Telefone Info
- - height=>
Não existe ninguem na sua sessão:
+ +
No one is in your session:
Voltar -

- Ligar novamente para o agente -
+

+ Ligar novamente para o agente +
- - height=>
O cliente desligou:
+ +
O cliente desligou:
Voltar -

+

Finalize e coloque o status da ligação -
+
- - height=>
Chamada Wrapup: segundos restantes no wrapup

+ +
Chamada pós-atd: segundos restantes de pós-atendimento

-

- Revestimento Wrapup e movimento sobre -
+

+ Finalizar pós-atendimento e seguir +
- -
-


+ +
+


Fechar Mensagem -
+
- - height=>
Sua sessão foi incapacitada
SAIR

Voltar -
+ +
Sua sessão foi finalizada
SAIR

Voltar +
- - height=>
Há um tempo sincronização problema com o seu sistema, por favor informe o seu administrador de sistema


Voltar -
+ +
Há um problema de sincronização no seu sistema, por favor informe o seu administrador de sistemas


Voltar +
- - height=>

SAIR
+ +

SAIR
- -
+ +
- -
 
+ +
 
- - height=47>
Qualquer alteração feita nesta página não será salva. Você deve mudar as informações do cliente antes de desligar a ligação.
+ +
Qualquer alteração feita nesta página não será salva. Você deve mudar as informações do cliente antes de desligar a ligação.
- - height=>
SELEÇÃO DE STATUS :       Desligue novamente       minimizar
- Fim da seleção de status -
- PAUSAR DISCAGEM DO AGENTE
- LIMPAR FORMULARIO | + +
SELEÇÃO DE STATUS :       Desligue novamente       minimizar
+
\n";} + ?> + + + + Seleção do Motivo de Finalização +
+ PAUSAR DISCAGEM DO AGENTE
+ LIMPAR FORMULÁRIO | ENVIAR -

+

WEB FORM ENVIAR -

  -
+

  +
- - height=>
SELECIONE Um CÓDIGO Da PAUSA :
- Pausa Code Selection - -

  -
-
- - - height=>
Selecionar um grupo ALIÁS :
- Grupo Alias Selecção - -

  -
-
- - - - - - height=>
Selecione uma data para o retorno :
- - + +
Selecione uma data para o retorno :
+
\n";} + ?> + + Selecione uma data abaixo       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
ESTE AGENDAMENTO SO APARECE PARA MIM
";} + {echo " SOMENTE MEUS AGENDAMENTOS
";} ?> - Comentarios do CB:

+ Comentarios do CB:

- ENVIAR

+ ENVIAR

-

  -
+

  +
- - height=>
SELECAO DO GRUPO DE ENTRADA DO CLOSER
- Seleção do grupo de entrada do closer -
+ +
AGENDAMENTOS POR AGENTE :
Para ver informações sobre um dos callbacks abaixo, clique no link INFO. Para chamar o cliente de volta agora, clique no link DISCAR. Se você clicar em um registro abaixo para marcá-lo, ele será removido da lista. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Atualizar +                 + Voltar +
+
+ + +
NOVA DISCAGEM MANUAL PARA :

Digite abaixo a informação do novo contato que você deseja ligar. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Codigo de Área:   (Normalmente é 1 nos EUA-Canada)
Telefone Number: +   (digits only) + + + +
Pesquisar Registros Existentes:   (Esta opção caso esteja marcada irá tentar encontrar o número do fone no sistema antes de inserir um novo registro)
+

+     +
+

Se você deseja ligar para um número que não está na lista de contatos, digite o número que voc6e deseja discar no campo Discagem Sobreposta abaixo. Para desligar essa ligação você deve abrir o link Ligações em sua sessão link no rodapé da página e desligar clicando no link do canal.
 
Discagem Sobreposta:   (digitos apenas por favor) +
+
+ Discar Agora +                 + Chamada Preview +                 + Voltar +
+
+ + +
SELECAO DO GRUPO DE ENTRADA DO CLOSER
+
\n";} + ?> + Seleção do grupo de entrada do closer +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - LIGACAO MISTURADA(ligações externas ativadas)
+ LIGAÇÃO MESCLADA(ligações saintes ativadas)
REINICIAR | ENVIAR -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
SELEÇÃO DE TERRITÓRIO
+
\n";} + ?> Territory Selection -
+
REINICIAR | ENVIAR -



  -
+



  +
- - + Canal Canal ESTE AGENDAMENTO SO APARECE PARA MIM
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " LIGACAO MISTURADA
";} + {echo " SOMENTE MEUS AGENDAMENTOS
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " LIGAÇÃO MESCLADA
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT CHAMADA LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Procurar um Contato:             close [X]
+
\n";} + ?> +

+ Notas: ao fazer uma busca de um contato, termos de pesquisa curinga ou parcial não são permitidos.
Pedidos de busca de contato são todos registrados no sistema. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Nome Name:
Sobrenome Name:
BU Name:
Department:
Group Name:
Job Título:
Location:

ENVIAR SEARCH             repor forma
+

  +
+
+ + +
      CONTACTOS PESQUISA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      BUSCA POR UMA LEAD:             close [X]
+
\n";} + ?> +

+ Notas: ao fazer uma busca por um chumbo, o número de telefone, levar identidade ou são as melhores campos para usar.
Usando os outros campos pode ser mais lento. Busca de chumbo não permite termos de pesquisa curinga ou parcial.
Solicitações de pesquisa de chumbo são todos registrados no sistema. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefone Number:
Telefone Number Fields: + Número de telefone principal + Número de telefone alternativo + Endereço3 número de telefone +
Lead ID:
:
:
:
:
:
:

ENVIAR SEARCH             repor forma
+

  +
+
+ + +
      RESULTADOS DA PROCURA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Registro de chamadas NOTAS:             close [X]
+
\n";} + ?> +
Call List Notas
+

  + Info Box Fechar +
+
+ + +
      Informações do cliente:             close [X] +
+
\n";} + ?> + Lead Info +

  + Info Box Fechar +
+
+ + +
SELECIONE UM CÓDIGO DE PAUSA :
+
\n";} + ?> + Pausa Code Selection + +

  +
+
+ + +
Selecione um Preset :
+
\n";} + ?> + Presets Selection + +
+
+ + +
SELEC. UM APELIDO DE GRUPO :
+
\n";} + ?> + Seleção de Apelido de Grupo + +

  +
+
+ + +
ALERT :
+     +

Voltar +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -ATALHOS DE STATUS INATIVOS - + + + - -> +
Agent web-client version:     CONFIGURAÇÃO:               Servidor:              
- -Mostrar informações de discagem do canal -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
STATUS:
-
-Discar proximo número
- VISUALIZAR CONTATO
- DISCAR TELEFONE ALT
- - -GRAVANDO ARQUIVO:
-
-
-ID da gravação:
-
- -Inicia Gravação
-
-Web Form
- 0) - {echo "\"Web
\n";} -?> -
-Colocar em espera
-Transferir a conferência
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Desligar Cliente
-
-
Enviar DTMF

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Canal:
Informações do cliente:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Título:   Primeiro:   MI:  Ultimo:
Endereço1:
Endereço2: Endereço3:
Cidade: Estado: CEP:
Bairro: Vendedor: Sexo:
Telefone: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -Codigo de Area: Telefone Alternativo:
Mostrar: Email:
Comentários: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_de/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_de/astguiclient.php index f14d0e33..6cb55d70 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_de/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_de/calendar.css b/agc_2-X/trunk/LANG_www/agc_de/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_de/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/agc_2-X/trunk/LANG_www/agc_de/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_de/calendar_db.js new file mode 100644 index 00000000..a1f87649 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_de/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' : ['Januar', 'February', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], + '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 ("Unzulässig 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 ("Unzulässig 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("Unzulässig 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/agc_2-X/trunk/LANG_www/agc_de/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_de/conf_exten_check.php index 2d1c0e07..bb1470e0 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_de/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $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 "Unzulässig Username/Passwort: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Conf Extension Check"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conf Extension Check"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten ist unzulässig\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check an calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Wartende Anrufe: $RingCalls";} + else {$RingCalls = "Wartende Anrufe: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check an calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Wartende Anrufe: $RingCalls";} - else {$RingCalls = "Wartende Anrufe: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $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 . '|Status: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten ist unzulässig or Exten $exten ist unzulässig\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Konferenz $conf_exten wurde registriert bei $exten\n"; + echo "Konferenz $conf_exten wurde registriert bei $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_de/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_de/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_de/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_de/functions.php b/agc_2-X/trunk/LANG_www/agc_de/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_de/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_de/manager_send.php b/agc_2-X/trunk/LANG_www/agc_de/manager_send.php index 95fe0851..c17cc654 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_de/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -94,12 +99,21 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -289,6 +314,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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten ist unzulässig or queryCID $queryCID ist unzulässig, Originate Befehl nicht abgesetzt\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -795,10 +869,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='PARKED',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='PARK',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") @@ -822,9 +959,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='PARK',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 "Eine dieser Variablen ist unzulässig:\n"; + echo "Channel $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "extenName $extenName muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "parkedby $parkedby muß eingestellt werden\n"; + echo "\nRedirectToPark Action nicht gesendet\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='PARK_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='IVRPARKED',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='IVRPARK',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 "Eine dieser Variablen ist unzulässig:\n"; + echo "Channel $channel muss länger als 2 Buchstaben sein\n"; + echo "queryCID $queryCID muss länger als 14 Buchstaben sein\n"; + echo "exten $exten muß eingestellt werden\n"; + echo "ext_context $ext_context muß eingestellt werden\n"; + echo "ext_priority $ext_priority muß eingestellt werden\n"; + echo "\nRedirectFromPark Action nicht gesendet\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='IVRPARK',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) ) @@ -1031,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ist nicht Live an $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1138,7 +1547,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); } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1248,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ist nicht Live an $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_de/phone_only.php b/agc_2-X/trunk/LANG_www/agc_de/phone_only.php new file mode 100644 index 00000000..1512ff6a --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_de/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Sie haben sich abgemeldet. Danke\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST an server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link an the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location an the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefon web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Stechuhr
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\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 "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Telefon Login:
Telefon Passwort:
Benutzer Login:
Benutzer Passwort:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefon web client: Telefon Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Stechuhr
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Telefon Login:
Telefon Passwort:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Falsches Passwort, versuchen sie es bitte noch einmal
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefon web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Stechuhr
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Benutzer Login:
Benutzer Passwort:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefon web client: Telefon Login Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Stechuhr
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Deutsch
\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 "
\"VICIdial\" Telefon-Only Login Error
 
Ihr Telefon Login ist nicht aktiv, bitte versuchen sie es noch einmal:
 
Telefon Login:
Telefon Passwort:

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ### go through the entered phones to figure out which server has fewest agents + ### logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + while($pb < $phones_auto_ct) + { + ### find the server_ip of each phone_login + $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; + if ($DB) {echo "|$stmtx|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmtx, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefon 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call Sekunden counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - Sekunden an call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefon: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefon:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_de/timeclock.php b/agc_2-X/trunk/LANG_www/agc_de/timeclock.php index b8d9e58d..f6c79593 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_de/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 ##### @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Sie haben jetzt Angemeldete"; + $LOGtimeMESSAGE = "Sie sind angemeldet an $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -338,7 +340,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($referrer=='agent') {$BACKlink = "ZURÜCK zur Benutzeranmeldung";} if ($referrer=='admin') - {$BACKlink = "ZURÜCK zur Administration";} + {$BACKlink = "ZURÜCK zur Administration";} if ($referrer=='welcome') {$BACKlink = "ZURÜCK zur Einstiegsseite";} diff --git a/agc_2-X/trunk/LANG_www/agc_de/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_de/vdc_db_query.php index fda1b428..d8cbc2a3 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_de/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStatus"])) {$CallBackLeadStatus=$_GET["CallBackLeadStatus"];} + elseif (isset($_POST["CallBackLeadStatus"])) {$CallBackLeadStatus=$_POST["CallBackLeadStatus"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Benutzer busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Unzulässig number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STATUS INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Eingehend calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Unzulässig call reference value.", +88 => "Incompatible destination.", +95 => "Unzulässig message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Unzulässig information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery an timer expiry.", +103 => "Parameter non-existent or not implemented - passed an (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     STATUS     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     WÄHLEN  
Keine Anrufe an diesem Tag
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $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 "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Zurück"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Ergebnisse gefunden: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set Sekunden='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STATUS     LAST ANRUF     CITY     STATE     ZIP     INFO     WÄHLEN  
Keine Ergebnisse gefunden
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Keine Ergebnisse gefunden
"; + echo "
"; + echo "Zurück"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Zurück"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampagne not found\n"; + echo "

"; + echo "Zurück"; + echo ""; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Zurück"; + echo ""; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Ergebnisse gefunden: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set Sekunden='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Keine Ergebnisse gefunden
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Keine Ergebnisse gefunden
"; + echo "
"; + echo "Zurück"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Zurück"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampagne not found\n"; + echo "

"; + echo "Zurück"; + echo ""; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Callback-Status:   $row[0]
Rückruf Blei-Status:   $row[7]
Callback Eintrag Zeit:   $row[1]
Rückruf auszulösen Zeit:   $row[2]
Rückruf Kommentare:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Titel'; + $label_first_name = 'Vorname'; + $label_middle_initial = 'MI'; + $label_last_name = 'Nachname'; + $label_address1 = 'Adresse1'; + $label_address2 = 'Adresse2'; + $label_address3 = 'Adresse3'; + $label_city = 'Stadt'; + $label_state = 'Bundesland'; + $label_province = 'Region'; + $label_postal_code = 'Postleitzahl'; + $label_vendor_lead_code = 'Anbieter ID'; + $label_gender = 'Gender'; + $label_phone_number = 'Telefon'; + $label_phone_code = 'LandesCode'; + $label_alt_phone = 'Alternative Telefonnummer'; + $label_security_phrase = 'Zeigen'; + $label_email = 'Email'; + $label_comments = 'Anmerkungen'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefon and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon Code Außerhalb wählbare Zone $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " PLZ Außerhalb wählbare Zone $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon Code Außerhalb wählbare Zone $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " PLZ Außerhalb wählbare Zone $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Status:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Angerufen Since Nachname Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Angerufen Count:   $row[24]
Nachname Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
CALL-Protokoll für diesen LEAD:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STATUS     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Keine Anrufe gefunden
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +9767,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_de/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_de/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_de/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_de/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_de/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_de/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_de/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_de/vdc_script_notes.php new file mode 100644 index 00000000..265d6156 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_de/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 = 'Titel'; +$label_first_name = 'Vorname'; +$label_middle_initial = 'MI'; +$label_last_name = 'Nachname'; +$label_address1 = 'Adresse1'; +$label_address2 = 'Adresse2'; +$label_address3 = 'Adresse3'; +$label_city = 'Stadt'; +$label_state = 'Bundesland'; +$label_province = 'Region'; +$label_postal_code = 'Postleitzahl'; +$label_vendor_lead_code = 'Anbieter ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'LandesCode'; +$label_alt_phone = 'Alternative Telefonnummer'; +$label_security_phrase = 'Zeigen'; +$label_email = 'Email'; +$label_comments = 'Anmerkungen'; + +$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 "Unzulässig Username/Passwort: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Anmerkungen"; +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 Anmerkungen:

+
Please click ÜBERNEHMEN to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + + + + + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_de/vicidial.php b/agc_2-X/trunk/LANG_www/agc_de/vicidial.php index c8742bb3..3455e5d1 100644 --- a/agc_2-X/trunk/LANG_www/agc_de/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_de/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -414,22 +523,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT WÄHLEN 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 an the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of Sekunden to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location an the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### BEGIN find any custom field labels ### +$label_title = 'Titel'; +$label_first_name = 'Vorname'; +$label_middle_initial = 'MI'; +$label_last_name = 'Nachname'; +$label_address1 = 'Adresse1'; +$label_address2 = 'Adresse2'; +$label_address3 = 'Adresse3'; +$label_city = 'Stadt'; +$label_state = 'Bundesland'; +$label_province = 'Region'; +$label_postal_code = 'Postleitzahl'; +$label_vendor_lead_code = 'Anbieter ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'LandesCode'; +$label_alt_phone = 'Alternative Telefonnummer'; +$label_security_phrase = 'Zeigen'; +$label_email = 'Email'; +$label_comments = 'Anmerkungen'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,249 +12720,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -LOGOUT\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Live Anruf
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Angemeldet als Benutzer + ring)";} + echo "  zur Kampagne: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + LOGOUT\n"; ?> +
- -MANUELLER ANRUF       SCHNELL WAHL
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Live Anruf
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STATUS:
+
+ Nächste Nummer wählen
+ + + ADRESSEN VORSCHAU
+ ALT. NUMMER WÄHLEN
+ + Aufzeichnungsdatei:
+
+
+ Aufzeichnungs ID:
+
+ + Starte Aufnahme
+
+ Web Formular
+ 0) + {echo "\"Web
\n";} + ?> +  
+ Parke Anruf
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Transfer - Konferenz
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Kundenspezifische
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Kunden auflegen
+
+
DTMF Senden

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  Kunden Zeit:                         Kanal:
Kunden Information:         + LEAD SUCHE";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Rufen Hinweise: "; + if ($agent_call_log_view == '1') + {echo "
Notizen anzeigen ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+ + +
+ + + + + +MANUELLER ANRUF       SCHNELL WAHL
- -X AKTIVE WIEDERVORLAGEN
+ +
- -
+ +VIEW ANRUF LOG
- Sekunden: -     + +     + + + +
VERSION:   BUILD:     Server:              
+ + Konferenz Informationen anzeigen +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +TASTATURKÜRZEL DEAKTIVIERT + + + Sekunden: +    
- +
+
+ + +Ihr Status:
Calls Dialing: +
+ + D1 - WÄHLEN\n"; - echo "
\n"; + echo "   \n"; echo "D2 - WÄHLEN\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
WIEDERVORLAGEN FÜR AGENT :
Klicken Sie jetzt unten auf eine Wiedervorlage, um den Kunden zurückzurufen. Danach wird die Wiedervorlage aus der Liste gelöscht.. -
-
-
  - Aktualisieren -                 - Zurück -
-
+
 Anrufe in der Warteschlange:  
 
- - height=>
NEUE MANUELLE ADRESSE FÜR :

Tragen Sie unten die Informationen zu der neuen Adresse ein, die SIE wählen möchten. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Wahl Code:   (Dieses ist normalerweise 49 in Deutschland)
Telefon Number: -   (12 digits max - digits only) -
Suche existierende Adresse:   (Wenn diese Option ausgewählt ist, wird versucht, die Telefonnummer im System zu finden, bevor eine neue Adresse eingefügt wird)
-

-     -
-

Wenn Sie eine Nummer wählen möchten, die nicht in der Adressliste aufgenommen werden soll, müssen die genaue Nummer in das WÄHL OVERRIDE Feld eintragen. Um diesen Anruf dann aufzulegen, müssen Sie auf den VERBINDUNGEN IN DIESER SITZUNG Link klicken, und dann über die Auswahl der Leitung den entsprechenden Anruf zu beenden..
 
Wahl Override:   (Bitte nur Zahlen) -
-
- Jetzt wählen -                 - Vorschau Call -                 - Zurück -
-
- - - -
-
- - - - -Ihr Status:
Calls Dialing: -
- - - - - > - - -
-
- - Transfer - Konferenz            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - LOKALE SUPERVISOR NACHFRAGE     - - Nachfrage auflegen -
- seconds -   - channel - - BERATENDE   - - Beide Leitungen auflegen -
- Anzurufende Telefonnummer -   -   - Agenten - - - WÄHL OVERRIDE - - NACHFRAGE VERLASSEN -
- Verbinden ohne Nachfrage -   - mit Kunde wählen -   - Kundenanruf parken -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Anrufe in der Warteschlange:  
 
- - + 0) { @@ -10817,189 +13161,349 @@ if ($view_calls_in_queue > 0) ?> + +X AKTIVE WIEDERVORLAGEN
+
-
  -Andere Bevollmächtigte Status:  
 
+
  +Andere Bevollmächtigte Status:  
 
-
-Verfügbare Transfer Agents:
+$webphone_content
\n"; + } +else + { + echo "
  + Web Telefon:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
Agents anzeigen +
+ + + +
  WebTelefon View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "dialable Leads:
 \n"; } ?>
- + - - - height=70> - -
Adresse hat das Gesprächsergebnis:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
Gesprächsergebniss Tastaturkürzel: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Transfer - Konferenz            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LOKALE SUPERVISOR NACHFRAGE     + + Nachfrage auflegen +
+ seconds +   + channel + + BERATENDE   + + Beide Leitungen auflegen +
+ Anzurufende Telefonnummer +   + +                     + +   + + Agenten + + + + + WÄHL OVERRIDE + + NACHFRAGE VERLASSEN +
+ Verbinden ohne Nachfrage +   + mit Kunde wählen +   + Kundenanruf parken +   + + Presets-Taste + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Verfügbare Transfer Agents:
+ + + + + +
Adresse hat das Gesprächsergebnis:

+ -
+
+
+ + + + - - + - + -
Gesprächsergebniss Tastaturkürzel: Wenn aktiviert, drücken sie einfach die entsprechende Taste, um das Gesprächsgebnis zu speichern. Der Anruf wird dann automatisch aufgelegt.:
+ - + - + -
+
- - height=70> - - - + +
Informationen zur letzten Wiedervorlage: close
+ + + - - + -
Informationen zur letzten Wiedervorlage: close
-
-
-
-
+ +
+
+
+
-
+
+
- - height=70> - - - + +
Weitere alternative Telefonnummern: minimieren
+ + + - - + -
Weitere alternative Telefonnummern: minimieren
-
-
-
-
+
+
+
+
+
-
+
+
- - - - -
maximieren
Alt Telefon Info
+ + + + +
maximieren
Alt Telefon Info
- - height=>
Niemand ist in ihrer Konferenz.:
+ +
Niemand ist in ihrer Konferenz.:
Zurück -

- Agent wieder anrufen -
+

+ Agent wieder anrufen +
- - height=>
Kunde hat aufgelegt:
+ +
Kunde hat aufgelegt:
Zurück -

+

Ende und Gesprächsergebniss -
+
- - height=>
Anruf Nachbereitung: Verbleibende Sekunden der Nachbereitung

+ +
Anruf Nachbereitung: Verbleibende Sekunden der Nachbereitung

-

+

Beende Nachbereitung und mache weiter -
+
- -
-


+ +
+


Close Message -
+
- - height=>
Ihre Sitzung ist gesperrt worden
LOGOUT

Zurück -
+ +
Ihre Sitzung ist gesperrt worden
LOGOUT

Zurück +
- - height=>
Es ist eine Zeit-Synchronisation Problem mit Ihrem System haben, wenden Sie sich bitte sagen Sie sich an Ihren Systemadministrator


Zurück -
+ +
Es ist eine Zeit-Synchronisation Problem mit Ihrem System haben, wenden Sie sich bitte sagen Sie sich an Ihren Systemadministrator


Zurück +
- - height=>

LOGOUT
+ +

LOGOUT
- -
+ +
- -
 
+ +
 
- - height=47>
Die Änderungen an den Kundendaten werden nicht übernommen. Sie müssen die Kundendaten ändern bevor Sie aufgelegt haben..
+ +
Die Änderungen an den Kundendaten werden nicht übernommen. Sie müssen die Kundendaten ändern bevor Sie aufgelegt haben..
- - height=>
ANRUF ABSCHLIESSEN :       Wieder Auflegen       minimieren
+ +
ANRUF ABSCHLIESSEN :       Wieder Auflegen       minimieren
+
\n";} + ?> + + + Gesprächsergebnis Auswahl -
- WÄHLPAUSE
+
+ WÄHLPAUSE
FORMULAR ZURÜCKSETZEN | ÜBERNEHMEN -

+

WEB FORM ÜBERNEHMEN -

  -
+

  +
- - height=>
WÄHLEN Sie Einen PAUSE CODE :
- Pause Code Selection - -

  -
-
- - - height=>
Wählen Sie eine Gruppe ALIAS :
- Gruppe Alias Auswahl - -

  -
-
- - - - - - height=>
Wählen Sie ein Rückrufdatum :
- - + +
Wählen Sie ein Rückrufdatum :
+
\n";} + ?> + + Wählen Sie unten ein Datum       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
NUR MEINE WIEDERVORLAGE
";} + {echo " NUR MEINE WIEDERVORLAGE
";} ?> - WV Anmerkungen:

+ WV Anmerkungen:

- ÜBERNEHMEN

+ ÜBERNEHMEN

-

  -
+

  +
- - height=>
SUPERVISOR INBOUND GRUPPENWAHL
- Supervisor Inbound Gruppenwahl -
+ +
WIEDERVORLAGEN FÜR AGENT :
Um Informationen über eine der Rückrufe siehe unten, auf der INFO-Link klicken. Um den Kunden einen Rückruf jetzt, auf der WÄHLEN-Link klicken. Wenn Sie unten auf einen Datensatz klicken, um ihn zu wählen, wird es aus der Liste entfernt werden. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Aktualisieren +                 + Zurück +
+
+ + +
NEUE MANUELLE ADRESSE FÜR :

Tragen Sie unten die Informationen zu der neuen Adresse ein, die SIE wählen möchten. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Wahl Code:   (Dieses ist normalerweise 49 in Deutschland)
Telefon Number: +   (digits only) + + + +
Suche existierende Adresse:   (Wenn diese Option ausgewählt ist, wird versucht, die Telefonnummer im System zu finden, bevor eine neue Adresse eingefügt wird)
+

+     +
+

Wenn Sie eine Nummer wählen möchten, die nicht in der Adressliste aufgenommen werden soll, müssen die genaue Nummer in das WÄHL OVERRIDE Feld eintragen. Um diesen Anruf dann aufzulegen, müssen Sie auf den VERBINDUNGEN IN DIESER SITZUNG Link klicken, und dann über die Auswahl der Leitung den entsprechenden Anruf zu beenden..
 
Wahl Override:   (Bitte nur Zahlen) +
+
+ Jetzt wählen +                 + Vorschau Call +                 + Zurück +
+
+ + +
SUPERVISOR INBOUND GRUPPENWAHL
+
\n";} + ?> + Supervisor Inbound Gruppenwahl +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - INBOUND und OUTBOUND(Outbound aktiviert)
+ INBOUND und OUTBOUND(Outbound aktiviert)
ZURÜCKSETZEN | ÜBERNEHMEN -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
GEBIET AUSWAHL
+
\n";} + ?> Territory Selection -
+
ZURÜCKSETZEN | ÜBERNEHMEN -



  -
+



  +
- - + Kanal Kanal NUR MEINE WIEDERVORLAGE
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " INBOUND und OUTBOUND
";} + {echo " NUR MEINE WIEDERVORLAGE
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " INBOUND und OUTBOUND
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT ANRUF LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Suchen nach Namen:             close [X]
+
\n";} + ?> +

+ Hinweise: Wenn Sie eine Suche nach einem Kontakt, sind Platzhalter oder teilweise Suchbegriffen nicht erlaubt.
Kontakt Suchanfragen werden alle im System angemeldet. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Vorname Name:
Nachname Name:
BU Name:
Department:
Group Name:
Job Titel:
Location:

ÜBERNEHMEN SEARCH             Reset Form
+

  +
+
+ + +
      KONTAKTE SUCHERGEBNISSE:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      SUCHE NACH EINEM KABEL:             close [X]
+
\n";} + ?> +

+ Hinweise: Bei einer Suche nach einem Blei, die Telefonnummer, ID oder führen sind die besten Felder zu verwenden.
Mit den anderen Bereichen kann langsamer sein. Lead-Durchsuchung nicht für Wildcard oder teilweise Suchbegriffe erlauben.
Lead-Suchanfragen sind alle im System angemeldet. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefon Number:
Telefon Number Fields: + Haupt-Telefonnummer + Alternative Telefonnummer + Adresse3 Telefonnummer +
Lead ID:
:
:
:
:
:
:

ÜBERNEHMEN SEARCH             Reset Form
+

  +
+
+ + +
      SUCHERGEBNISSE:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Call Anmerkungen LOG:             close [X]
+
\n";} + ?> +
Call Anmerkungen-Liste
+

  + Close Info Box +
+
+ + +
      Kunden Information:             close [X] +
+
\n";} + ?> + Lead Info +

  + Close Info Box +
+
+ + +
WÄHLEN Sie Einen PAUSE CODE :
+
\n";} + ?> + Pause Code Selection + +

  +
+
+ + +
Wählen Sie ein Preset :
+
\n";} + ?> + Presets Selection + +
+
+ + +
Wählen Sie eine Gruppe ALIAS :
+
\n";} + ?> + Gruppe Alias Auswahl + +

  +
+
+ + +
ALERT :
+     +

Zurück +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -TASTATURKÜRZEL DEAKTIVIERT - + + + - -> +
Agent web-client version:     BUILD:               Server:              
- -Konferenz Informationen anzeigen -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
STATUS:
-
-Nächste Nummer wählen
- ADRESSEN VORSCHAU
- ALT. NUMMER WÄHLEN
- - -Aufzeichnungsdatei:
-
-
-Aufzeichnungs ID:
-
- -Starte Aufnahme
-
-Web Formular
- 0) - {echo "\"Web
\n";} -?> -
-Parke Anruf
-Transfer - Konferenz
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Kunden auflegen
-
-
DTMF Senden

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Kanal:
Kunden Information:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Titel:   Vorname:   MI:  Nachname:
Adresse1:
Adresse2: Adresse3:
Stadt: Bundesland: Postleitzahl:
Region: Anbieter ID: Geschlecht:
Telefon: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -LandesCode: Alternative Telefonnummer:
Zeigen: Email:
Anmerkungen: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_dk/active_list_refresh.php b/agc_2-X/trunk/LANG_www/agc_dk/active_list_refresh.php new file mode 100644 index 00000000..12a63600 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/active_list_refresh.php @@ -0,0 +1,483 @@ + LICENSE: AGPLv2 +# +# This script is designed purely to serve updates of the live data to the display scripts +# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $pass +# optional variables: +# - $ADD - ('1','2','3','4','5') +# - $order - ('asc','desc') +# - $format - ('text','table','menu','selectlist','textarea') +# - $bgcolor - ('#123456','white','black','etc...') +# - $txtcolor - ('#654321','black','white','etc...') +# - $txtsize - ('1','2','3','etc...') +# - $selectsize - ('2','3','4','etc...') +# - $selectfontsize - ('8','10','12','etc...') +# - $selectedext - ('cc100') +# - $selectedtrunk - ('Zap/25-1') +# - $selectedlocal - ('SIP/cc100') +# - $textareaheight - ('8','10','12','etc...') +# - $textareawidth - ('8','10','12','etc...') +# - $field_name - ('extension','busyext','extension_xfer','etc...') +# +# +# changes +# 50323-1147 - First build of script +# 50401-1132 - small formatting changes +# 50502-1402 - added field_name as modifiable variable +# 50503-1213 - added session_name checking for extra security +# 50503-1311 - added conferences list +# 50610-1155 - Added NULL check on MySQL results to reduced errors +# 50711-1209 - removed HTTP authentication in favor of user/pass vars +# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1118 - Added variable filters to close security holes for login form +# 90508-0727 - Changed to PHP long tags +# + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];} + elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];} +if (isset($_GET["order"])) {$order=$_GET["order"];} + elseif (isset($_POST["order"])) {$order=$_POST["order"];} +if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];} + elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];} +if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];} + elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];} +if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];} + elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];} +if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];} + elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];} +if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];} + elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];} +if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];} + elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];} +if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];} + elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];} +if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];} + elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];} +if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];} + elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];} +if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];} + elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];} +if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];} + elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];} + +### security strip all non-alphanumeric characters out of the variables ### + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + $ADD=ereg_replace("[^0-9]","",$ADD); + $order=ereg_replace("[^0-9a-zA-Z]","",$order); + $format=ereg_replace("[^0-9a-zA-Z]","",$format); + $bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor); + $txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor); + $txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize); + $selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize); + $selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize); + $selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext); + $selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk); + $selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal); + $textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight); + $textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth); + $field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name); + +# default optional vars if not set +if (!isset($ADD)) {$ADD="1";} +if (!isset($order)) {$order='desc';} +if (!isset($format)) {$format="text";} +if (!isset($bgcolor)) {$bgcolor='white';} +if (!isset($txtcolor)) {$txtcolor='black';} +if (!isset($txtsize)) {$txtsize='2';} +if (!isset($selectsize)) {$selectsize='4';} +if (!isset($selectfontsize)) {$selectfontsize='10';} +if (!isset($textareaheight)) {$textareaheight='10';} +if (!isset($textareawidth)) {$textareawidth='20';} + +$version = '0.0.8'; +$build = '60619-1118'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +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";} + $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 "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='table') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Display liste: "; +if ($ADD==1) {echo "Aktive forbindelser";} +if ($ADD==2) {echo "Forbindelser der er optagat";} +if ($ADD==3) {echo "Externe linjer";} +if ($ADD==4) {echo "Lokalforbindelser";} +if ($ADD==5) {echo "konferencer";} +if ($ADD==99999) {echo "HJÆLP";} +echo "\n"; +echo "\n"; +echo "\n"; +} + + + + + +###################### +# ADD=1 display all live extensions on a server +###################### +if ($ADD==1) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'extension';} + if ($format=='table') {echo "\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + +###################### +# ADD=2 display all busy extensions on a server +###################### +if ($ADD==2) +{ + if (!$field_name) {$field_name = 'busyext';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=3 display all busy outside lines(trunks) on a server +###################### +if ($ADD==3) +{ + if (!$field_name) {$field_name = 'trunk';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=4 display all busy Local lines on a server +###################### +if ($ADD==4) +{ + if (!$field_name) {$field_name = 'local';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + +###################### +# ADD=5 display all agc-usable conferences on a server +###################### +if ($ADD==5) +{ + $pt='pt'; + if (!$field_name) {$field_name = 'conferences';} + if ($format=='table') {echo "
\n";} + if ($format=='menu') {echo "\n"; + } + if ($format=='textarea') + { + echo "\n";} +} + + + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n\n\n";} + +exit; + +?> + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_dk/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_dk/astguiclient.php new file mode 100644 index 00000000..b7c89cec --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/astguiclient.php @@ -0,0 +1,2908 @@ + LICENSE: AGPLv2 +# +# make sure you have added a user to the vicidial_users MySQL table with at least +# user_level 1 or greater to access this page. Also you need to have the login +# and pass of a phone listed in the asterisk.phones table. The page grabs the +# server info and other details from this login and pass +# +# Other scripts that this application depends on: +# - active_list_refresh.php: displays active/live channels and phones +# - manager_send.php: sends Actions to be executed on Asterisk servers +# - live_exten_check.php: checks to see if user's phone is on a live call +# - call_log_display.php: retrieves log of inbound and outbound calls +# - voicemail_check.php: retrieves counts of new and old messages +# - inbound_popup.php: opens upon live_inbound call coming in +# - conf_exten_check.php: checks to see if and calls are in a specific conf +# - park_calls_display.php: retrieves list of parked calls +# - vdc_db_query.php: Changes values in the DB for non-calling records +# +# CHANGES +# 50215-1356 - Proof-of-concept test of XMLHttpRequest for astGUIclient web +# 50323-1411 - First build version display-only +# 50331-1040 - Second-build, added phone login and hangup/hijack display +# 50401-1006 - Trunk/Local Hangup functions enabled +# 50404-1056 - Trunk/Local Hijack functions enabled +# 50404-1459 - Simple live calls display and grabs updated time from server +# 50405-1221 - Reorganized the display and layers, added some images +# 50406-1005 - Added In/Out call log display to MAIN panel +# 50407-1254 - Start/Stop Recording on live calls enabled +# 50422-1101 - Activated Check Voicemail button and new/old messages count +# 50428-1449 - Added dial from log and basic live_inbound call popup +# 50429-1455 - Modified inbound popup code for IE and to add more functions +# 50502-1442 - Added basic method to transfer live calls somewhere else +# 50503-1205 - Added web_client_sessions entry for more security of subscripts +# 50503-1537 - Added basic conferences display +# 50509-1132 - Added conference connected list and hangup/xfer for them +# 50511-1129 - Added registration of conference rooms and added manual dial +# 50523-1342 - Added Conference recording and send DTMF +# 50523-1622 - Added Local Dial window frame for calling local extensions +# 50524-1456 - Added ability to park call and display number of parked calls +# 50524-1600 - Added ability to display and pickup/hangup/xfer parked calls +# 50525-1224 - Added ability to place outbound call from within conferene +# 50531-1225 - Added ability to do dual transfers to meetme rooms from Main +# 50711-1229 - removed HTTP authentication in favor of user/pass vars +# 50711-1610 - Added Zap monitoring to Trunk/Local Action screens +# 50804-1604 - Minor bug fix in inbound_popup functions +# 50818-1715 - Added pretty login section +# 50913-1137 - Added custom outbound_cid from phones table +# 51110-1430 - Fixed non-standard http port issue +# 60103-1421 - Added code for favorite extensions chooser +# 60104-1347 - Added basic layout for favorites editing frame +# 60105-1124 - Finished Favorites frame and added DB submission +# 60112-1622 - Several formatting changes +# 60421-1357 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1103 - Added variable filters to close security holes for login form +# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 90508-0727 - Changed to PHP long tags +# 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +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["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} + if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } + if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } + +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +$version = '2.2.4-1'; +$build = '120223-2124'; + +### security strip all non-alphanumeric characters out of the variables ### + $DB=ereg_replace("[^0-9a-z]","",$DB); + $phone_login=ereg_replace("[^0-9a-zA-Z]","",$phone_login); + $phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + + +if ($force_logout) + { + if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + } + echo "Du er nu logget ud. Tak\n"; + exit; + } + +$StarTtime = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd-His"); + $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); + $past_month_date = date("Y-m-d H:i:s",$month_old); + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + +$US='_'; +$CL=':'; +if ($WeBRooTWritablE > 0) + {$fp = fopen ("./astguiclient_auth_entries.txt", "a");} +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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 = $agcPAGE; +$agcDIR = eregi_replace('astguiclient.php','',$agcDIR); + +if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) + { + header ("Content-type: text/html; charset=utf-8"); + + echo "web client astGUIclient: Login\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "\n"; + echo "\n"; + echo "
Login
 
Bruger login:
Bruger password:
Telefon login:
Telefon password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + + if($auth>0) + { + $office_no=strtoupper($user); + $password=strtoupper($pass); + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } + } + } + +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 +echo "\n"; +echo "\n"; +echo "\n"; + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) +{ +echo "web client astGUIclient: Telefon login\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n";echo "\n";echo "
English Dansk
\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 "
Telefon login
 
Telefon login:
Telefon password:

VERSION: $version       BUILD: $build
\n"; +echo "\n\n"; +echo "\n\n"; +echo "\n\n"; +exit; +} +else +{ +$authphone=0; +$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$authphone=$row[0]; +if (!$authphone) + { + echo "web client astGUIclient: Telefon login\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "
Telefon login
 
Beklager din telefonlogin/password er ikke aktive på dette system, prøv igen:
 
Telefon login:
Telefon password:

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "web client astGUIclient\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); + $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]; + $phone_login=$row[6]; + $phone_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]; + + $local_web_callerID_URL_enc = rawurlencode($local_web_callerID_URL); + + $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"; + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_present=$row[0]; + if ($favorites_present > 0) + { + $stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favorites_list=$row[0]; + $h=0; + $favorites_listX = eregi_replace("'",'',$favorites_list); + $favorites = explode(',',$favorites_listX); + $favorites_count = count($favorites); + $favorites_listX=''; + + $o=0; + while ($favorites_count > $o) + { + $stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $favorites_names[$o] = $rowx[0]; + $favorites_listX .= "$rowx[1]/$favorites[$o],"; + $o++; + } + + echo "\n"; + echo "\n"; + } + else + { + echo "\n"; + } + +### gather phone extensions and fullnames for favorites editor ### + $stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $exten_ct = mysql_num_rows($rslt); + $favlistCT=0; + $nofavlistCT=0; + while ($favlistCT < $exten_ct) + { + $row=mysql_fetch_row($rslt); + $favlist[$favlistCT]= "$row[0] - $row[1]"; + $favlistCT++; + } + + } +} + + +?> + + + + + + +\n"; + + +?> + +
+ + + + + + + + + +
+ + +LOGUD
\n"; ?> +
Hoved PanelAktive linjerkonference panelCheck voicemailAktive samtaler
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ Læg på trunk   |   + Overtage trunk   |   + Lytte trunk   |   + Genopfrisk   |   + Tilbage til hovedvinduet +
+
+ + +
LÆG PÅ LOKALT

+ Aktive lokal menu
+ Læg på lokal   |   + Overtage lokal   |   + lytte lokal   |   + Genopfrisk   |   + Tilbage til hovedvinduet +
+
+ + + + + + + +
VIDERESTILLING AF PÅGÅENDE SAMTALE
Kanal at viderestille: Channel
Linjer:
Lokalnummer menu
+
+ Send til valgt lokalnummer

+ Send til valgt voicemail

+ Send til dette nummer:


+ Genopfrisk


+ Tilbage til hovedvinduet

+
konferencer:
(klik på et nummer forneden for at sende til en konference)
Send min kanal også
konference Menu
+
+ + + + + +
Lokal numre opkald
Telefon ringer fra: Channel
Linjer:
Lokalnummer menu
+
+ Ring valgt forbindelse

+ Ring valgt voicemail

+ Genopfrisk


+ Tilbage til hovedvinduet

+
+
+ + +
SAMTALE SAT PÅ VENT:
+ Tilbage til hovedvinduet

+
+
+ + + + + + + + + + + + + + + +
  +
VOICEMAIL     NY:     GAMMEL:             MANUELT OPKALD       DIAL
SAMTALE SAT PÅ VENT: 0                LOKALNUMRE
UDGÅENDE OPKALD:
INDKOMMENDE OPKALD:
astGUIclient web-klient VERSION: BUILD:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
FAVORITER       edit
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
FAVORITER

 
ANGIV VALG AF FAVORITER - udlogning er påkrævet
TILBAGE TIL HOVEDVINDUE - gem ikke ændringer
+
+ +
+ + + + + + + + + + + + + +
+STOP | START     Genopfrisk hyppighed: 1000 ms hurtigt | langsomt

+
opstart..
+
Aktive forbindelser
+GENOPFRISK | +ORDER | +
Externe linjer
+GENOPFRISK | +ORDER | +
Lokalforbindelser
+GENOPFRISK | +ORDER | +
+ Data placeres her

+
+ Data placeres her

Trunk handling +
+ Data placeres her

Lokal handling +
+
+ + + + +
+ + +konference liste + + + +
+Klik på et konference nummer til venstre for info vdr den konference +
+ + + + + + + + + + + + + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_dk/calendar.css b/agc_2-X/trunk/LANG_www/agc_dk/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/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/agc_2-X/trunk/LANG_www/agc_dk/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_dk/calendar_db.js new file mode 100644 index 00000000..14c0c631 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/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' : ['Januar', 'February', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'], + '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 ("Ikke gyldigt 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 ("Ikke gyldigt 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("Ikke gyldigt 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/agc_2-X/trunk/LANG_www/agc_dk/call_log_display.php b/agc_2-X/trunk/LANG_www/agc_dk/call_log_display.php new file mode 100644 index 00000000..ef5fdc77 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/call_log_display.php @@ -0,0 +1,197 @@ + LICENSE: AGPLv2 +# +# This script is designed purely to send the inbound and outbound calls for a specific phone +# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $pass +# optional variables: +# - $format - ('text','debug') +# - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +# - $protocol - ('SIP','Zap','IAX2',...) +# - $in_limit - ('10','20','50','100',...) +# - $out_limit - ('10','20','50','100',...) +# +# +# changes +# 50406-1013 - First build of script +# 50407-1452 - Added definable limits +# 50503-1236 - added session_name checking for extra security +# 50610-1158 - Added NULL check on MySQL results to reduced errors +# 50711-1202 - removed HTTP authentication in favor of user/pass vars +# 60323-1550 - added option for showing different number dialed in log +# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1202 - Added variable filters to close security holes for login form +# 90508-0727 - Changed to PHP long tags +# + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + +# default optional vars if not set +if (!isset($format)) {$format="text";} +if (!isset($in_limit)) {$in_limit="100";} +if (!isset($out_limit)) {$out_limit="100";} +$number_dialed = 'number_dialed'; +#$number_dialed = 'extension'; + +$version = '0.0.8'; +$build = '60619-1202'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +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";} + $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 "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Visning af opkaldslog"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten er ikke valid eller protokol $protocol er ikke valid\n"; + exit; + } + else + { + ##### print outbound calls from the call_log table + $stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$out_calls_count = mysql_num_rows($rslt);} + echo "$out_calls_count|"; + $loop_count=0; + while ($out_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[3] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + + if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);} + echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|"; + } + echo "\n"; + + ##### print inbound calls from the live_inbound_log table + $stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$in_calls_count = mysql_num_rows($rslt);} + echo "$in_calls_count|"; + $loop_count=0; + while ($in_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + + $call_time_M = ($row[4] / 60); + $call_time_M = round($call_time_M, 2); + $call_time_M_int = intval("$call_time_M"); + $call_time_SEC = ($call_time_M - $call_time_M_int); + $call_time_SEC = ($call_time_SEC * 60); + $call_time_SEC = round($call_time_SEC, 0); + if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";} + $call_time_MS = "$call_time_M_int:$call_time_SEC"; + $callerIDnum = $row[3]; $callerIDname = $row[3]; + $callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum); + $callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname); + + echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|"; + } + echo "\n"; + + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_dk/conf_exten_check.php new file mode 100644 index 00000000..d29ef5da --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/conf_exten_check.php @@ -0,0 +1,778 @@ + 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 +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $pass +# optional variables: +# - $format - ('text','debug') +# - $ACTION - ('refresh','register') +# - $client - ('agc','vdc') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $campagentstdisp - ('YES',...) +# + +# changes +# 50509-1054 - First build of script +# 50511-1112 - Added ability to register a conference room +# 50610-1159 - Added NULL check on MySQL results to reduced errors +# 50706-1429 - script changed to not use HTTP login vars, user/pass instead +# 50706-1525 - Added date-time display for vicidial client display +# 50816-1500 - Added random update to vicidial_live_agents table for vdc users +# 51121-1353 - Altered echo statements for several small PHP speed optimizations +# 60410-1424 - Added ability to grab calls-being-placed and agent status +# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1201 - Added variable filters to close security holes for login form +# 61128-2255 - Added update for manual dial vicidial_live_agents +# 70319-1542 - Added agent disabled display function +# 71122-0205 - Added vicidial_live_agent status output +# 80424-0442 - Added non_latin lookup from system_settings +# 80519-1425 - Added calls-in-queue tally +# 80703-1106 - Added API functionality for Hangup and Dispo +# 81104-0229 - Added mysql error logging capability +# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries +# 90102-1402 - Added check for system and database time synchronization +# 90120-1720 - Added compatibility for API pause/resume and dial a number +# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours +# 90408-0020 - Added API vtiger specific callback activity record ability +# 90508-0727 - Changed to PHP long tags +# 90706-1430 - Fixed AGENTDIRECT calls in queue display count +# 90908-1037 - Added DEAD call logging +# 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report +# + +$version = '2.4-30'; +$build = '110610-0059'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=38; +$one_mysql_log=0; +$DB=0; + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["client"])) {$client=$_GET["client"];} + elseif (isset($_POST["client"])) {$client=$_POST["client"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];} + elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];} +if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];} + elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];} + +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 + + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin FROM system_settings;"; +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);} +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + +# default optional vars if not set +if (!isset($format)) {$format="text";} +if (!isset($ACTION)) {$ACTION="refresh";} +if (!isset($client)) {$client="agc";} + +$Alogin='N'; +$RingCalls='N'; +$DiaLCalls='N'; + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$FILE_TIME = date("Ymd_His"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$random = (rand(1000000, 9999999) + 10000000); + + +$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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) + { + echo "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } +else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "check conf forbindelser"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) + { + $channel_live=0; + echo "Conf Exten $conf_exten er ikke valid\n"; + exit; + } + else + { + if ($client == 'vdc') + { + $Acount=0; + $AexternalDEAD=0; + $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';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Acount=$row[0]; + + if ($Acount > 0) + { + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Astatus = $row[0]; + $Acallerid = $row[1]; + $Aagent_log_id = $row[2]; + $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } + } + # ### find out if external table shows agent should be disabled + # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; + # if ($DB) {echo "|$stmt|\n";} + # $rslt=mysql_query($stmt, $link); + # $row=mysql_fetch_row($rslt); + # $AexternalDEAD=$row[0]; + + ##### BEGIN check på calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Samtaler i kø: $RingCalls";} + else {$RingCalls = "Samtaler i kø: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check på calls in queue, number of active calls in the campaign + + if ($auto_dial_level > 0) + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 5) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + ##### BEGIN DEAD logging section ##### + ### find whether the call the agent is på is hung up + $stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $AcalleridCOUNT=$row[0]; + + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) + { + $DEADcustomer++; + ### find whether the agent log record has already logged DEAD + $stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Aagent_log_idCOUNT=$row[0]; + + if ($Aagent_log_idCOUNT < 1) + { + $NEWdead_epoch = date("U"); + $deadNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + ##### END DEAD logging section ##### + } + else + { + ### update the vicidial_live_agents every second with a new random number so it is shown to be alive + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 5) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + ##### BEGIN DEAD logging section ##### + ### find whether the call the agent is på is hung up + $stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03029',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $AcalleridCOUNT=$row[0]; + + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) + { + $DEADcustomer++; + ### find whether the agent log record has already logged DEAD + $stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03030',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Aagent_log_idCOUNT=$row[0]; + + if ($Aagent_log_idCOUNT < 1) + { + $NEWdead_epoch = date("U"); + $deadNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03031',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03032',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + ##### END DEAD logging section ##### + } + + ### 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,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);} + $row=mysql_fetch_row($rslt); + $external_hangup = $row[0]; + $external_status = $row[1]; + $external_pause = $row[2]; + $external_dial = $row[3]; + $external_update_fields = $row[4]; + $external_update_fields_data = $row[5]; + $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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } + + if (strlen($external_status)<1) {$external_status = '::::::::::';} + + $web_epoch = date("U"); + $stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater 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,'03014',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $server_epoch = $row[0]; + $db_epoch = $row[1]; + $time_diff = ($server_epoch - $db_epoch); + $web_diff = ($db_epoch - $web_epoch); + + ##### check for in-group change details + $InGroupChangeDetails = '0|||'; + $manager_ingroup_set=0; + $stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mis_record_ct = mysql_num_rows($rslt); + if ($mis_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $manager_ingroup_set = $row[0]; + } + if ($manager_ingroup_set > 0) + { + $stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMISaffected_rows_update = mysql_affected_rows($link); + if ($VLAMISaffected_rows_update > 0) + { + $stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $migs_record_ct = mysql_num_rows($rslt); + if ($migs_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $external_ingroups = $row[0]; + $external_blended = $row[1]; + $external_igb_set_user = $row[2]; + $outbound_autodial = $row[3]; + $dial_method = $row[4]; + + $stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mign_record_ct = mysql_num_rows($rslt); + if ($mign_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $external_igb_set_name = $row[0]; + } + + $NEWoutbound_autodial='N'; + if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") ) + {$NEWoutbound_autodial='Y';} + + $stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMIBaffected_rows_update = mysql_affected_rows($link); + + $InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name"; + + $stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + } + + ##### grab the shift information the agent + $stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VU_user_group = $row[0]; + $VU_agent_shift_enforcement_override = $row[1]; + + ### Gather timeclock and shift enforcement restriction settings + $stmt="SELECT shift_enforcement,group_shifts 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,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $shift_enforcement = $row[0]; + $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]); + $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL); + $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')"; + + ### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR + $Ashift_logout=0; + if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|START",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) ) + { + $shift_ok=0; + if (strlen($LOGgroup_shiftsSQL) < 3) + {$Ashift_logout++;} + 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,'3017',$user,$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) + {$Ashift_logout++;} + } + } + + + if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) ) + {$Alogin='TIME_SYNC';} + if ($Acount < 1) + {$Alogin='DEAD_VLA';} + if ($AexternalDEAD > 0) + {$Alogin='DEAD_EXTERNAL';} + if ($Ashift_logout > 0) + {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; + + if (strlen($timer_action) > 3) + { + $stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAETAaffected_rows_update = mysql_affected_rows($link); + } + } + $total_conf=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$sip_list = mysql_num_rows($rslt);} + # echo "$sip_list|"; + $loop_count=0; + while ($sip_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + # echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; $total_conf++; + $row=mysql_fetch_row($rslt); + $ChannelA[$total_conf] = "$row[0]"; + if ($format=='debug') {echo "\n";} + } + } + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; + + $counter=0; + $countecho=''; + while($total_conf > $counter) + { + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; + } + + echo "$countecho\n"; + } + +if ($ACTION == 'register') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + { + $channel_live=0; + echo "Conf Exten $conf_exten er ikke valid or Exten $exten er ikke valid\n"; + exit; + } + else + { + $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} + } + echo "konference $conf_exten er registrerat til $exten\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) +{ +$NOW_TIME = date("Y-m-d H:i:s"); +# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); +$errno=''; $error=''; +if ( ($mel > 0) or ($one_mysql_log > 0) ) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +$one_mysql_log=0; +return $errno; +} + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_dk/dbconnect.php new file mode 100644 index 00000000..e02ca392 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/dbconnect.php @@ -0,0 +1,61 @@ + LICENSE: AGPLv2 +# +if ( file_exists("/etc/astguiclient.conf") ) + { + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; + } + +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { + die('MySQL connect ERROR: ' . mysql_error()); + } +mysql_select_db("$VARDB_database"); + +$local_DEF = 'Local/'; +$conf_silent_prefix = '7'; +$local_AMP = '@'; +$ext_context = 'demo'; +$recording_exten = '8309'; +$WeBRooTWritablE = '1'; +$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings +$flag_channels=0; +$flag_string = 'VICIast20'; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/functions.php b/agc_2-X/trunk/LANG_www/agc_dk/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_dk/inbound_popup.php b/agc_2-X/trunk/LANG_www/agc_dk/inbound_popup.php new file mode 100644 index 00000000..d19de7e4 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/inbound_popup.php @@ -0,0 +1,352 @@ + LICENSE: AGPLv2 +# +# This script is designed to open up when a live_inbound call comes in giving the user +# options of what to do with the call or options to lookup the callerID on various web sites +# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +# +# required variables: +# - $server_ip +# - $session_name +# - $uniqueid - ('1234567890.123456',...) +# - $user +# - $pass +# optional variables: +# - $format - ('text','debug') +# - $vmail_box - ('101','1234',...) +# - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $voicemail_dump_exten - ('85026666666666') +# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL) +# +# +# changes +# 50428-1500 - First build of script display only +# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links +# 50503-1244 - added session_name checking for extra security +# 50711-1203 - removed HTTP authentication in favor of user/pass vars +# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1205 - Added variable filters to close security holes for login form +# 90508-0727 - Changed to PHP long tags +# + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];} + elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];} + elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];} +if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];} + elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];} +if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];} + elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];} +if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);} + else {$local_web_callerID_URL = '';} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + +# default optional vars if not set +if (!isset($format)) {$format="text";} + +$version = '0.0.6'; +$build = '60619-1205'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +if (!isset($query_date)) {$query_date = $NOW_DATE;} +$DO = '-1'; +if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";} + + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $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 "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +$forever_stop=0; +$user_abb = "$user$user$user$user"; +while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) + {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} + +echo "\n"; +echo "\n"; +echo "\n"; +?> + + +PÅGÅENDE INKOMMEDE OPKALD"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

PÅGÅENDE INKOMMEDE OPKALD

\n"; +echo "$NOW_TIME

\n"; +} + + +$MT[0]=''; +$row=''; $rowx=''; +$channel_live=1; +if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid er ikke valid\n"; + exit; + } +else + { + $stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $channels_list = mysql_num_rows($rslt); + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); +# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; +# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt||||| + if ($format=='debug') {echo "\n";} + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Channel: $row[1]
CallerID: $row[3]
\n"; + + $phone = eregi_replace(".*\<","",$row[3]); + $phone = eregi_replace("\>.*","",$phone); + $NPA = substr($phone, 0, 3); + $NXX = substr($phone, 3, 3); + $XXXX = substr($phone, 6, 4); + $D='-'; + echo "GOOGLE - \n"; + echo "ANYWHO - \n"; + echo "SWITCHBOARD - \n"; + echo "VERIZON - \n"; + echo "WHITEPAGES - \n"; + echo "411.COM - \n"; + echo "411.COM - \n"; + + $local_web_callerID_QUERY_STRING =''; + $local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA"; + $local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX"; + $local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX"; + $local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]"; + $local_web_callerID_QUERY_STRING.="&callerID_Channel=$row[1]"; + $local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]"; + $local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]"; + $local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]"; + $local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]"; + $local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]"; + $local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]"; + echo "CUSTOM - \n"; + + echo "
Opkaldt nummer: $row[8]
Notat:$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "LÆGPÅ - \n"; + echo "SEND TIL MIN VOICEMAIL\n"; + echo "
\n"; + + + $stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + + } + + + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/live_exten_check.php b/agc_2-X/trunk/LANG_www/agc_dk/live_exten_check.php new file mode 100644 index 00000000..20074787 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/live_exten_check.php @@ -0,0 +1,279 @@ + LICENSE: AGPLv2 +# +# This script is designed purely to send whether the client channel is live and to what channel it is connected +# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $pass +# optional variables: +# - $format - ('text','debug') +# - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +# - $protocol - ('SIP','Zap','IAX2',...) +# +# +# changes +# 50404-1249 - First build of script +# 50406-1402 - added connected trunk lookup +# 50428-1452 - added live_inbound check for exten on 2nd line of output +# 50503-1233 - added session_name checking for extra security +# 50524-1429 - added parked calls count +# 50610-1204 - Added NULL check on MySQL results to reduced errors +# 50711-1204 - removed HTTP authentication in favor of user/pass vars +# 60103-1541 - added favorite extens status display +# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1203 - Added variable filters to close security holes for login form +# 60825-1029 - Fixed translation variable issue ChannelA +# 90508-0727 - Changed to PHP long tags +# + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];} + elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + +# default optional vars if not set +if (!isset($format)) {$format="text";} + +$version = '2.0.1'; +$build = '60825-1029'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +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";} + $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 "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Check aktive forbindelser"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + +echo "DateTime: $NOW_TIME|"; +echo "UnixTime: $StarTtime|"; + +$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +echo "$row[0]|"; + + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten er ikke valid eller protokol $protocol er ikke valid\n"; + exit; + } + else + { + $stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$channels_list = mysql_num_rows($rslt);} + echo "$channels_list|"; + $loop_count=0; + while ($channels_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + $ChanneLA[$loop_count] = "$row[0]"; + $ChanneLB[$loop_count] = "$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + $counter=0; + while($loop_count > $counter) + { + $counter++; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($rslt) {$trunk_count = mysql_num_rows($rslt);} + if ($trunk_count>0) + { + $row=mysql_fetch_row($rslt); + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $row[0]|"; + } + else + { + echo "Conversation: $counter ~"; + echo "ChannelA: $ChanneLA[$counter] ~"; + echo "ChannelB: $ChanneLB[$counter] ~"; + echo "ChannelBtrunk: $ChanneLA[$counter]|"; + } + } + } + } + } + +echo "\n"; + +### check for live_inbound entry +$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';"; + if ($format=='debug') {echo "\n";} +$rslt=mysql_query($stmt, $link); +if ($rslt) {$channels_list = mysql_num_rows($rslt);} + if ($channels_list>0) + { + $row=mysql_fetch_row($rslt); + $LIuniqueid = "$row[0]"; + $LIchannel = "$row[1]"; + $LIcallerid = "$row[3]"; + $LIdatetime = "$row[6]"; + echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|"; + if ($format=='debug') {echo "\n";} + } + +echo "\n"; + + +### if favorites are present do a lookup to see if any are active +if ($favorites_count > 0) + { + $favorites = explode(',',$favorites_list); + $h=0; + $favs_print=''; + while ($favorites_count > $h) + { + $fav_extension = explode('/',$favorites[$h]); + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $favs_print .= "$fav_extension[1]: $row[0] ~"; + $h++; + } + echo "$favs_print\n"; + } + +if ($format=='debug') {echo "\n";} + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/manager_send.php b/agc_2-X/trunk/LANG_www/agc_dk/manager_send.php new file mode 100644 index 00000000..368acf5b --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/manager_send.php @@ -0,0 +1,2112 @@ + LICENSE: AGPLv2 +# +# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server +# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $pass +# optional variables: +# - $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',...) +# - $exten - ('1234','913125551212',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $filename - ('20050406-125623_44444',...) +# - $extenName - ('phone100',...) +# - $parkedby - ('phone100',...) +# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) +# - $auto_dial_level - ('0','1','1.1',...) +# - $campaign - ('CLOSER','TESTCAMP',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('1234',...) +# - $seconds - ('32',...) +# - $outbound_cid - ('3125551212','0000000000',...) +# - $agent_log_id - ('123456',...) +# - $call_server_ip - ('10.10.10.15',...) +# - $CalLCID - ('VD01234567890123456',...) +# - $stage - ('UP','DOWN','2NDXfeR') +# - $session_id - ('8600051') +# - $FROMvdc - ('YES','NO') +# - $agentchannel - ('SIP/cc101-g7yr','Zap/1-1',...) +# - $usegroupalias - ('0','1') +# - $account - ('DEFAULT',...) +# - $agent_dialed_number - ('1','') +# - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) +# - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension +# +# CHANGELOG: +# 50401-1002 - First build of script, Hangup function only +# 50404-1045 - Redirect basic function enabled +# 50406-1522 - Monitor basic function enabled +# 50407-1647 - Monitor and StopMonitor full functions enabled +# 50422-1120 - basic Originate function enabled +# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail +# 50502-1539 - basic RedirectName and RedirectNameVmail added +# 50503-1227 - added session_name checking for extra security +# 50523-1341 - added Conference call start/stop recording +# 50523-1421 - added OriginateName and OriginateNameVmail for local calls +# 50524-1602 - added RedirectToPark and RedirectFromPark +# 50531-1203 - added RedirecXtra for dual channel redirection +# 50630-1100 - script changed to not use HTTP login vars, user/pass instead +# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging +# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function +# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf +# 50913-1057 - Added outbound_cid set if present to originate call +# 51020-1556 - Added agent_log_id framework for detailed agent activity logging +# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode +# 51129-1014 - Added ability to accept calls from other VICIDIAL servers +# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD +# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function +# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1158 - Added variable filters to close security holes for login form +# 60809-1544 - Added direct transfers to leave-3ways in consultative transfers +# 61004-1526 - Added parsing of volume control command and lookup or number +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61201-1115 - Added user to MonitorConf for recording_log +# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70226-1251 - Added Mute/UnMute to conference volume control +# 70320-1502 - Added option to allow retry of leave-3way-call and debug logging +# 70322-1636 - Added sipsak display ability +# 80331-1433 - Added second transfer try for VICIDIAL transfers on manual dial calls +# 80402-0121 - Fixes for manual dial transfers on some systems +# 80424-0442 - Added non_latin lookup from system_settings +# 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording +# 80915-1755 - Rewrote leave-3way functions for external calling +# 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call +# 81020-1459 - Fixed bugs in queue_log logging +# 81104-0203 - Added mysql error logging capability +# 90303-1144 - Fixed manual dial live hangup bug +# 90304-1334 - Added account and usegroupalias and user campaign/in-group specific variables +# 90305-1040 - Added agent_dialed_number and type for user_call_log feature +# 90508-0727 - Changed to PHP long tags +# 90511-1019 - Added restriction not allowing dialing into agent sessions from manual dial +# 90913-1410 - Fixed minor logging bug +# 90916-1830 - Added nodeletevdac +# 90924-1555 - Added am_message_exten_override for list_id option +# 91112-1110 - Added CALLOUTBOUND value to QM entry lookup +# 91205-2103 - Code cleanup +# 91213-1208 - Added queue_position to queue_log COMPLETE... records +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension + +$version = '2.4-56'; +$build = '110626-2320'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=116; +$one_mysql_log=0; + +require("dbconnect.php"); + +### These are variable assignments for PHP globals off +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];} + elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];} + elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];} +if (isset($_GET["filename"])) {$filename=$_GET["filename"];} + elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];} +if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];} + elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];} +if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];} + elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];} +if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];} + elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];} +if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];} + elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];} + elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];} +if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];} + elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];} +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["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];} + elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];} +if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];} + elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["allow_sipsak_messages"])) {$allow_sipsak_messages=$_GET["allow_sipsak_messages"];} + elseif (isset($_POST["allow_sipsak_messages"])) {$allow_sipsak_messages=$_POST["allow_sipsak_messages"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["FROMvdc"])) {$FROMvdc=$_GET["FROMvdc"];} + elseif (isset($_POST["FROMvdc"])) {$FROMvdc=$_POST["FROMvdc"];} +if (isset($_GET["agentchannel"])) {$agentchannel=$_GET["agentchannel"];} + elseif (isset($_POST["agentchannel"])) {$agentchannel=$_POST["agentchannel"];} +if (isset($_GET["usegroupalias"])) {$usegroupalias=$_GET["usegroupalias"];} + elseif (isset($_POST["usegroupalias"])) {$usegroupalias=$_POST["usegroupalias"];} +if (isset($_GET["account"])) {$account=$_GET["account"];} + elseif (isset($_POST["account"])) {$account=$_POST["account"];} +if (isset($_GET["agent_dialed_number"])) {$agent_dialed_number=$_GET["agent_dialed_number"];} + elseif (isset($_POST["agent_dialed_number"])) {$agent_dialed_number=$_POST["agent_dialed_number"];} +if (isset($_GET["agent_dialed_type"])) {$agent_dialed_type=$_GET["agent_dialed_type"];} + 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + + +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 + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin FROM system_settings;"; +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log);} +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + $secondS = ereg_replace("[^0-9]","",$secondS); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + + +# default optional vars if not set +if (!isset($ACTION)) {$ACTION="Originate";} +if (!isset($format)) {$format="alert";} +if (!isset($ext_priority)) {$ext_priority="1";} + +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$NOWnum = date("YmdHis"); +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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02002',$user,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) + { + echo "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } +else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02003',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "Leder send: "; + if ($ACTION=="Originate") {echo "Originate";} + if ($ACTION=="Redirect") {echo "Redirect";} + if ($ACTION=="RedirectName") {echo "RedirectName";} + if ($ACTION=="Hangup") {echo "Hangup";} + if ($ACTION=="Command") {echo "Command";} + if ($ACTION==99999) {echo "HJÆLP";} + echo "\n"; + echo "\n"; + echo "\n"; + } + + + + +###################### +# 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 +###################### +if ($ACTION=="SysCIDOriginate") + { + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) + { + echo "Exten $exten er ikke valid or queryCID $queryCID er ikke valid, Originate ordre ikke givet\n"; + } + else + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02004',$user,$server_ip,$session_name,$one_mysql_log);} + echo "Originate ordre sent for Exten $exten Kanal $channel på $server_ip\n"; + } + } + + + +###################### +# ACTION=Originate, OriginateName, OriginateNameVmail - insert Originate Manager statement +###################### +if ($ACTION=="OriginateName") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "extenName $extenName skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nOriginateName Action no enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02005',$user,$server_ip,$session_name,$one_mysql_log);} + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Originate"; + } + } + } + +if ($ACTION=="OriginateNameVmail") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "extenName $extenName skal stilles ind\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nOriginateNameVmail Action no enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02006',$user,$server_ip,$session_name,$one_mysql_log);} + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Originate"; + } + } + } + +if ($ACTION=="OriginateVDRelogin") + { + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $CIDdate = date("ymdHis"); + $DS='-'; + $SIPSAK_prefix = 'LIN-'; + print "\n"; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$campaign\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + $queryCID = "$SIPSAK_prefix$campaign$DS$CIDdate"; + + } + $ACTION="Originate"; + } + +if ($ACTION=="Originate") + { + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or ( (strlen($queryCID)<10) and ($alertCID < 1) ) ) + { + echo "ERROR Exten $exten er ikke valid or queryCID $queryCID er ikke valid, Originate ordre ikke givet\n"; + } + else + { + if ( (eregi('MANUAL',$agent_dialed_type)) and ( (preg_match("/^\d860\d\d\d\d$/i",$exten)) or (preg_match("/^860\d\d\d\d$/i",$exten)) ) ) + { + echo "ERROR Du har ikke tilladelse at ring til andre agenters sessioner $exten\n"; + exit; + } + + if (strlen($outbound_cid)>1) + {$outCID = "\"$queryCID\" <$outbound_cid>";} + else + {$outCID = "$queryCID";} + if ( ($usegroupalias > 0) and (strlen($account)>1) ) + { + $RAWaccount = $account; + $account = "Account: $account"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables + } + else + {$variable=''; $account="Variable: $call_variables";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02007',$user,$server_ip,$session_name,$one_mysql_log);} + echo "Originate ordre sent for Exten $exten Kanal $channel på $server_ip |$account|$variable|\n"; + + if ($agent_dialed_number > 0) + { + 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);} + } + } + } + } + + + +###################### +# ACTION=HangupConfDial - find the Local channel that is in the conference and needs to be hung up +###################### +if ($ACTION=="HangupConfDial") + { + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "conference $exten er ikke valid or ext_context $ext_context or queryCID $queryCID er ikke valid, Hangup ordre ikke givet\n"; + } + else + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$exten$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02009',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $ACTION="Hangup"; + $queryCID = eregi_replace("^.","G",$queryCID); # GTvdcW... + } + } + } + + + +###################### +# ACTION=Hangup - insert Hangup Manager statement +###################### +if ($ACTION=="Hangup") + { + $stmt="UPDATE vicidial_live_agents SET external_hangup='0' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02010',$user,$server_ip,$session_name,$one_mysql_log);} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) + { + $channel_live=0; + echo "Channel $channel er ikke valid or queryCID $queryCID er ikke valid, Hangup ordre ikke givet\n"; + } + else + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + +# $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $row=mysql_fetch_row($rslt); +# if ($row[0]==0) +# { +# $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# $rowx=mysql_fetch_row($rslt); +# if ($rowx[0]==0) +# { +# $channel_live=0; +# echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; +# } +# } + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 0)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02011',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + echo "Call $CalLCID $channel er ikke aktiv på $call_server_ip, Checking Live Kanal...\n"; + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02012',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $channel_live=0; + echo "Channel $channel er ikke aktiv på $call_server_ip, Hangup ordre ikke givet $rowx[0]\n$stmt\n"; + } + else + { + echo "$stmt\n"; + } + } + } + if ( ($auto_dial_level < 1) and (strlen($stage)>2) and (strlen($channel)>2) and (strlen($exten)>2) ) + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension NOT LIKE \"%$exten%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02083',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $channel_live=0; + echo "Channel $channel in use by another agent på $call_server_ip, Hangup ordre ikke givet $rowx[0]\n$stmt\n"; + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|MDCHU|$user|$channel|$call_server_ip|$exten|\n"); + fclose($fp); + } + } + else + { + echo "$stmt\n"; + } + } + + if ($channel_live==1) + { + if ( (strlen($CalLCID)>15) and ($secondS > 0)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where callerid='$CalLCID';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02013',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($format=='debug') {echo "\n";} + if ($rowx[0] > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + 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_pe_phone_append = $row[6]; + $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); + + $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='CONNECT';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02015',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_cn_ct = mysql_num_rows($rslt); + if ($VAC_cn_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_connect = $row[0]; + } + if ($format=='debug') {echo "\n";} + if ($caller_connect > 0) + { + $CLqueue_position='1'; + ### grab call lead information needed for QM logging + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid,queue_position from vicidial_auto_calls where callerid='$CalLCID' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02016',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + $CLqueue_position = $row[10]; + } + if ($format=='debug') {echo "\n";} + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='COMPLETECALLER' and queue='$CLcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02017',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + if ($format=='debug') {echo "\n";} + + if ($caller_complete < 1) + { + $time_id=0; + $stmt="SELECT time_id from queue_log where call_id='$CalLCID' and verb IN('ENTERQUEUE','CALLOUTBOUND') and queue='$CLcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02018',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + if ($format=='debug') {echo "\n";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + } + } + } + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02020',$user,$server_ip,$session_name,$one_mysql_log);} + echo "Hangup ordre sent for Kanal $channel på $call_server_ip\n"; + } + } + } + + + +###################### +# ACTION=Redirect, RedirectName, RedirectNameVmail, RedirectToPark, RedirectFromPark, RedirectVD, RedirectXtra, RedirectXtraCX +# - insert Redirect Manager statement using extensions name +###################### +if ($ACTION=="RedirectVD") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "auto_dial_level $auto_dial_level skal stilles ind\n"; + echo "campaign $campaign skal stilles ind\n"; + echo "uniqueid $uniqueid skal stilles ind\n"; + echo "lead_id $lead_id skal stilles ind\n"; + echo "\nRedirectVD Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02021',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec=(queue_seconds + $secondS),status='XFER' where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by start_epoch desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02022',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02023',$user,$server_ip,$session_name,$one_mysql_log);} + + if ($nodeletevdac < 1) + { + $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02024',$user,$server_ip,$session_name,$one_mysql_log);} + } + + 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"; + } + } + +if ($ACTION=="RedirectToPark") + { + 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 "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "extenName $extenName skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "parkedby $parkedby skal stilles ind\n"; + echo "\nRedirectToPark Action no enviado\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 = "INSERT INTO park_log SET uniqueid='$uniqueid',status='HOLDED',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='HOLD',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") + { + 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 "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nRedirectFromPark Action no enviado\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"; + + $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='HOLD',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 "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "extenName $extenName skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "parkedby $parkedby skal stilles ind\n"; + echo "\nRedirectToPark Action no enviado\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='HOLD_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='IVRHOLDED',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='IVRHOLD',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 "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nRedirectFromPark Action no enviado\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='IVRHOLD',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) ) + { + $channel_live=0; + echo "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "extenName $extenName skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nRedirectName Action no enviado\n"; + } + else + { + $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02027',$user,$server_ip,$session_name,$one_mysql_log);} + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + $ACTION="Redirect"; + } + } + } + +if ($ACTION=="RedirectNameVmail") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "extenName $extenName skal stilles ind\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nRedirectNameVmail Action no enviado\n"; + } + else + { + $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02028',$user,$server_ip,$session_name,$one_mysql_log);} + $name_count = mysql_num_rows($rslt); + if ($name_count>0) + { + $row=mysql_fetch_row($rslt); + $exten = "$exten$row[0]"; + $ACTION="Redirect"; + } + } + } + + + + + + +if ($ACTION=="RedirectXtraCXNeW") + { + $DBout=''; + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($session_id)<3) or ( ( (strlen($extrachannel)<3) or (strlen($exten)<1) ) and (!ereg("NEXTAVAILABLE",$exten)) ) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "ExtraChannel $extrachannel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nRedirect Action no enviado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|\n"); + fclose($fp); + } + } + } + else + { + if (ereg("NEXTAVAILABLE",$exten)) + { + $stmtA="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'02029',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 1) + { + $stmtB="UPDATE vicidial_conferences set extension='$protocol/$extension$NOWnum', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtB, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtB,'02030',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmtC="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and extension='$protocol/$extension$NOWnum' and conf_exten != '$session_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtC, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtC,'02031',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + + if ( (ereg("^8300",$extension)) and ($protocol == 'Local') ) + { + $extension = "$extension$user"; + } + + $stmtD="UPDATE vicidial_conferences set extension='$protocol/$extension' where server_ip='$server_ip' and conf_exten='$exten' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtD, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtD,'02032',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmtE="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime='$NOW_TIME', extension='3WAY_$user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtE, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtE,'02033',$user,$server_ip,$session_name,$one_mysql_log);} + + $queryCID = "CXAR24$NOWnum"; + $stmtF="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $agentchannel','Context: $ext_context','Exten: $exten','Priority: 1','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtF, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtF,'02034',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmtG="UPDATE vicidial_live_agents set conf_exten='$exten' where server_ip='$server_ip' and user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtG, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtG,'02035',$user,$server_ip,$session_name,$one_mysql_log);} + + if ($auto_dial_level < 1) + { + $stmtH = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and callerid LIKE \"M%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtH, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtH,'02036',$user,$server_ip,$session_name,$one_mysql_log);} + } + + // $fp = fopen ("./vicidial_debug_3way.txt", "a"); + // fwrite ($fp, "$NOW_TIME|$filename|\n|$stmtA|\n|$stmtB|\n|$stmtC|\n|$stmtD|\n|$stmtE|\n|$stmtF|\n|$stmtG|\n|$stmtH|\n\n"); + // fclose($fp); + + echo "NeWSessioN|$exten|\n"; + echo "|$stmtG|\n"; + + exit; + } + else + { + $channel_liveX=0; + echo "Cannot find empty vicidial_conference på $server_ip, Redirect ordre ikke givet\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Kan ikke finde en tom konference på $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02037',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02038',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel er ikke aktiv på $call_server_ip, Redirect ordre ikke givet\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel er ikke aktiv på $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02039',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02040',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel er ikke aktiv på $server_ip, Redirect ordre ikke givet\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel er ikke aktiv på $server_ip";} + } + } + if ( ($channel_liveX==1) and ($channel_liveY==1) ) + { + $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02041',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] < 1) + { + $channel_liveY=0; + echo "No Local agent to send call to, Redirect ordre ikke givet\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} + } + else + { + $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02042',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + $dest_server_ip = $rowx[0]; + $dest_session_id = $rowx[1]; + $dest_user = $rowx[2]; + $S='*'; + + $D_s_ip = explode('.', $dest_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]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$dest_session_id$S$lead_id$S$dest_user$S$phone_code$S$phone_number$S$campaign$S"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02043',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02044',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "RedirectXtraCX ordre sent for Kanal $channel på $call_server_ip and \nHungup $extrachannel på $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel på $call_server_ip, Hungup $extrachannel på $server_ip";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Changed to Redirect: $channel på $server_ip";} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDCXC|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + } + } + + + + + + + + + + +if ($ACTION=="RedirectXtraNeW") + { + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($session_id)<3) or ( ( (strlen($extrachannel)<3) or (strlen($exten)<1) ) and (!ereg("NEXTAVAILABLE",$exten)) ) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "ExtraChannel $extrachannel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "session_id $session_id skal stilles ind\n"; + echo "\nRedirect Action no enviado\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + 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"); + fclose($fp); + } + } + } + else + { + if (ereg("NEXTAVAILABLE",$exten)) + { + $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02045',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 1) + { + $stmt="UPDATE vicidial_conferences set extension='$protocol/$extension$NOWnum', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02046',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and extension='$protocol/$extension$NOWnum' and conf_exten != '$session_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02047',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $exten = $row[0]; + + $stmt="UPDATE vicidial_conferences set extension='$protocol/$extension' where server_ip='$server_ip' and conf_exten='$exten' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02048',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime='$NOW_TIME', extension='3WAY_$user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02049',$user,$server_ip,$session_name,$one_mysql_log);} + + $queryCID = "CXAR23$NOWnum"; + $stmtB="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $agentchannel','Context: $ext_context','Exten: $exten','Priority: 1','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmtB, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02050',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set conf_exten='$exten' where server_ip='$server_ip' and user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02051',$user,$server_ip,$session_name,$one_mysql_log);} + + if ($auto_dial_level < 1) + { + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and callerid LIKE \"M%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02052',$user,$server_ip,$session_name,$one_mysql_log);} + } + + echo "NeWSessioN|$exten|\n"; + echo "|$stmtB|\n"; + + exit; + } + else + { + $channel_liveX=0; + echo "Cannot find empty vicidial_conference på $server_ip, Redirect ordre ikke givet\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Kan ikke finde en tom konference på $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02054',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel er ikke aktiv på $call_server_ip, Redirect ordre ikke givet\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel er ikke aktiv på $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02056',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel er ikke aktiv på $server_ip, Redirect ordre ikke givet\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel er ikke aktiv på $server_ip";} + } + } + if ( ($channel_liveX==1) and ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02057',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "RedirectXtra ordre sent for Kanal $channel and \nExtraChannel $extrachannel\n to $exten på $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten på $server_ip";} + } + else + { + $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]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02058',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02059',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "RedirectXtra ordre sent for Kanal $channel på $call_server_ip and \nExtraChannel $extrachannel\n to $exten på $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + } + } + } + + + + + +if ($ACTION=="Redirect") + { + ### for manual dial VICIDIAL calls send the second attempt to transfer the call + if ($stage=="2NDXfeR") + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $hangup_channel_prefix = "$local_DEF$session_id$local_AMP$ext_context"; + + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02060',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row > 0) + { + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02061',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + $channel=$rowx[0]; + $channel = eregi_replace("1$","2",$channel); + $queryCID = eregi_replace("^.","Q",$queryCID); + } + } + + $row=''; $rowx=''; + $channel_live=1; + 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 "En af disse variabler er ikke valid:\n"; + echo "Channel $channel skal være større end 2 tegn\n"; + echo "queryCID $queryCID skal være større end 14 tegn\n"; + echo "exten $exten skal stilles ind\n"; + echo "ext_context $ext_context skal stilles ind\n"; + echo "ext_priority $ext_priority skal stilles ind\n"; + echo "\nRedirect Action no enviado\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02062',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02063',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel er ikke aktiv på $server_ip, Redirect ordre ikke givet\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02064',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "Redirect ordre sent for Kanal $channel på $server_ip\n"; + } + } + } + + + +###################### +# ACTION=Monitor or Stop Monitor - insert Monitor/StopMonitor Manager statement to start recording on a channel +###################### +if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) + { + if ($ACTION=="StopMonitor") + {$SQLfile = "";} + else + {$SQLfile = "File: $filename";} + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<8) ) + { + $channel_live=0; + echo "Channel $channel er ikke valid or queryCID $queryCID er ikke valid or filename: $filename er ikke valid, $ACTION ordre ikke givet\n"; + } + else + { + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02065',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0]==0) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02066',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_live=0; + echo "Channel $channel er ikke aktiv på $server_ip, $ACTION ordre ikke givet\n"; + } + } + if ($channel_live==1) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02067',$user,$server_ip,$session_name,$one_mysql_log);} + + if ($ACTION=="Monitor") + { + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02068',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02069',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + } + else + { + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02070',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02071',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + echo "$ACTION ordre sent for Kanal $channel på $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + } + } + } + + + + + + +###################### +# ACTION=MonitorConf or StopMonitorConf - insert Monitor/StopMonitor Manager statement to start recording on a conference +###################### +if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) + { + $row=''; $rowx=''; + $channel_live=1; + $uniqueidSQL=''; + + if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<8) ) + { + $channel_live=0; + echo "Channel $channel er ikke valid or exten $exten er ikke valid or filename: $filename er ikke valid, $ACTION ordre ikke givet\n"; + } + else + { + $VDvicidial_id=''; + + if ($ACTION=="MonitorConf") + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02072',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02073',$user,$server_ip,$session_name,$one_mysql_log);} + $RLaffected_rows = mysql_affected_rows($link); + if ($RLaffected_rows > 0) + { + $recording_id = mysql_insert_id($link); + } + + if ($FROMvdc=='YES') + { + ##### get call type from vicidial_live_agents table + $VLA_inOUT='NONE'; + $stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02074',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLA_inOUT_ct = mysql_num_rows($rslt); + if ($VLA_inOUT_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VLA_inOUT = $row[0]; + } + if ($VLA_inOUT == 'INBOUND') + { + $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 vicidial ID in the vicidial_closer_log table + $stmt="SELECT closecallid FROM vicidial_closer_log where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; + } + else + { + ##### look for the vicidial ID in the vicidial_log table + $stmt="SELECT uniqueid FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; + } + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02075',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDvicidial_id = $row[0]; + + $stmt = "UPDATE recording_log SET vicidial_id='$VDvicidial_id' where recording_id='$recording_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02076',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + } + + ##### StopMonitorConf steps ##### + else + { + if ($uniqueid=='IN') + { + $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); + + ### find the value to put in the vicidial_id field if this was an inbound call + $stmt="SELECT closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02077',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueidSQL = ",vicidial_id='$row[0]'"; + } + } + else + { + if (strlen($uniqueid) > 8) + {$uniqueidSQL = ",vicidial_id='$uniqueid'";} + } + + $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02078',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $rec_count = mysql_num_rows($rslt); + if ($rec_count>0) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $length_in_sec = ($StarTtime - $start_time); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' $uniqueidSQL where filename='$filename'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02079',$user,$server_ip,$session_name,$one_mysql_log);} + } + + # find and hang up all recordings going på in this conference # and extension = '$exten' + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02080',$user,$server_ip,$session_name,$one_mysql_log);} + # $rec_count = intval(mysql_num_rows($rslt) / 2); + $rec_count = mysql_num_rows($rslt); + $h=0; + while ($rec_count>$h) + { + $rowx=mysql_fetch_row($rslt); + $HUchannel[$h] = $rowx[0]; + $h++; + } + $i=0; + while ($h>$i) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02081',$user,$server_ip,$session_name,$one_mysql_log);} + $i++; + } + } + echo "$ACTION ordre sent for Kanal $channel på $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n INDSPILNING VARER OPTIL 60 MINUTER\n"; + } + } + + + + + +###################### +# ACTION=VolumeControl - raise or lower the volume of a meetme participant +###################### +if ($ACTION=="VolumeControl") + { + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) + { + echo "konference $exten, Stage $stage er ikke valid or queryCID $queryCID er ikke valid, Originate ordre ikke givet\n"; + } + else + { + $participant_number='XXYYXXYYXXYYXX'; + if (eregi('UP',$stage)) {$vol_prefix='4';} + if (eregi('DOWN',$stage)) {$vol_prefix='3';} + if (eregi('UNMUTE',$stage)) {$vol_prefix='2';} + if (eregi('MUTING',$stage)) {$vol_prefix='1';} + $local_DEF = 'Local/'; + $local_AMP = '@'; + $volume_local_channel = "$local_DEF$participant_number$vol_prefix$exten$local_AMP$ext_context"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02082',$user,$server_ip,$session_name,$one_mysql_log);} + echo "Volume ordre sent for konference $exten, Stage $stage Kanal $channel på $server_ip\n"; + } + } + + + + + + + + + + + + +$ENDtime = date("U"); +$RUNtime = ($ENDtime - $StarTtime); +if ($format=='debug') {echo "\n";} +if ($format=='debug') {echo "\n\n\n";} + +exit; + + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) + { + $NOW_TIME = date("Y-m-d H:i:s"); + # mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log); + $errno=''; $error=''; + if ( ($mel > 0) or ($one_mysql_log > 0) ) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|manager_send|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } + $one_mysql_log=0; + return $errno; + } + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/park_calls_display.php b/agc_2-X/trunk/LANG_www/agc_dk/park_calls_display.php new file mode 100644 index 00000000..88cc6418 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/park_calls_display.php @@ -0,0 +1,147 @@ + LICENSE: AGPLv2 +# +# This script is designed purely to send the details on the parked calls on the server +# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $pass +# optional variables: +# - $format - ('text','debug') +# - $exten - ('cc101','testphone','49-1','1234','913125551212',...) +# - $protocol - ('SIP','Zap','IAX2',...) +# +# +# changes +# 50524-1515 - First build of script +# 50711-1208 - removed HTTP authentication in favor of user/pass vars +# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1205 - Added variable filters to close security holes for login form +# 90508-0727 - Changed to PHP long tags +# + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + +# default optional vars if not set +if (!isset($format)) {$format="text";} +if (!isset($park_limit)) {$park_limit="1000";} + +$version = '0.0.4'; +$build = '60619-1205'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +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";} + $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 "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "OPKALD SAT PÅ VENT"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($exten)<1) or (strlen($protocol)<3) ) + { + $channel_live=0; + echo "Exten $exten er ikke valid eller protokol $protocol er ikke valid\n"; + exit; + } + else + { + ##### print parked calls from the parked_channels table + $stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $park_calls_count = mysql_num_rows($rslt); + echo "$park_calls_count\n"; + $loop_count=0; + while ($park_calls_count>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|"; + } + echo "\n"; + } + + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/phone_only.php b/agc_2-X/trunk/LANG_www/agc_dk/phone_only.php new file mode 100644 index 00000000..5d444d6c --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Du er nu logget ud. Tak\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST på server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link på the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location på the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefon web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Telefon login:
Telefon password:
Bruger login:
Bruger password:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefon web client: Telefon login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Telefon login:
Telefon password:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "login er inkorrekt, prøv igen
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefon web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Bruger login:
Bruger password:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefon web client: Telefon login Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "
\"VICIdial\" Telefon-Only Login Error
 
Beklager din telefonlogin/password er ikke aktive på dette system, prøv igen:
 
Telefon login:
Telefon password:

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ### go through the entered phones to figure out which server has fewest agents + ### logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + while($pb < $phones_auto_ct) + { + ### find the server_ip of each phone_login + $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; + if ($DB) {echo "|$stmtx|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmtx, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefon 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call sekunder counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - sekunder på call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefon: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefon:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_dk/timeclock.php b/agc_2-X/trunk/LANG_www/agc_dk/timeclock.php new file mode 100644 index 00000000..2c6d7844 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/timeclock.php @@ -0,0 +1,458 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 80523-0134 - First Build +# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field +# 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-6'; +$build = '100621-1023'; + +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); + $last_action_date = $NOW_TIME; + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('timeclock.php','',$agcPAGE); + + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];} + elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["commit"])) {$commit=$_GET["commit"];} + elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];} +if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];} + elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];} +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($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } + +### security strip all non-alphanumeric characters out of the variables ### + $DB=ereg_replace("[^0-9a-z]","",$DB); + $phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); + $phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); + $VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login); + $VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass); + $VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign); + $user=ereg_replace("[^0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + $stage=ereg_replace("[^0-9a-zA-Z]","",$stage); + $commit=ereg_replace("[^0-9a-zA-Z]","",$commit); + $referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer); + +require("dbconnect.php"); + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$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); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $welcomeURL = $row[1]; + $admin_web_directory = $row[2]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + + +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 == 'login') or ($stage == 'logout') ) + { + ### see if user/pass exist for this user in vicidial_users table + $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $valid_user=$row[0]; + print "\n"; + + if ($valid_user < 1) + { + ### NOT A VALID USER/PASS + $VDdisplayMESSAGE = "Brugernavnet og passwordet er ikke aktivt på dette system
Prøv venligst igen:"; + + echo"\n"; + echo"AgentStempelklokke\n"; + echo"\n"; + echo"\n"; + echo "\n"; + echo "
\n"; + echo "\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 "\n"; + echo "\n"; + echo "
Stempelklokke
 
Bruger login:
Bruger password:
 

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + + exit; + } + else + { + ### VALID USER/PASS, CONTINUE + + ### get name and group for this user + $stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + $user_group = $row[1]; + print "\n"; + + ### get vicidial_timeclock_status record count for this user + $stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $vts_count = $row[0]; + + $last_action_sec=99; + + if ($vts_count > 0) + { + ### vicidial_timeclock_status record found, grab status and date of last activity + $stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $status = $row[0]; + $event_epoch = $row[1]; + $last_action_date = date("Y-m-d H:i:s", $event_epoch); + $last_action_sec = ($StarTtimE - $event_epoch); + if ($last_action_sec > 0) + { + $totTIME_H = ($last_action_sec / 3600); + $totTIME_H_int = round($totTIME_H, 2); + $totTIME_H_int = intval("$totTIME_H"); + $totTIME_M = ($totTIME_H - $totTIME_H_int); + $totTIME_M = ($totTIME_M * 60); + $totTIME_M_int = round($totTIME_M, 2); + $totTIME_M_int = intval("$totTIME_M"); + $totTIME_S = ($totTIME_M - $totTIME_M_int); + $totTIME_S = ($totTIME_S * 60); + $totTIME_S = round($totTIME_S, 0); + if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";} + if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";} + if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";} + $totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S"; + } + else + { + $totTIME_HMS='0:00:00'; + } + + print "\n"; + } + else + { + ### No vicidial_timeclock_status record found, insert one + $stmt="INSERT INTO vicidial_timeclock_status set status='START', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $status='START'; + $totTIME_HMS='0:00:00'; + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + if ( ($last_action_sec < 30) and ($status != 'START') ) + { + ### You cannot log in or out within 30 sekunder of your last login/logout + $VDdisplayMESSAGE = "Du kan ikke logge ind eller ud inden 30 sekunder efter dit sidste indlog/udlog"; + + echo"\n"; + echo"AgentStempelklokke\n"; + echo"\n"; + echo"\n"; + echo "\n"; + echo "
\n"; + echo "\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 "\n"; + echo "\n"; + echo "
Stempelklokke
 
Bruger login:
Bruger password:
 

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + + exit; + } + + if ($commit == 'YES') + { + if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) + { + $VDdisplayMESSAGE = "Du har nu logget ind"; + $LOGtimeMESSAGE = "Du er logget ind på $NOW_TIME"; + + ### Add a record to the timeclock log + $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $timeclock_id = mysql_insert_id($link); + print "\n"; + + ### Update the user's timeclock status record + $stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + ### Add a record to the timeclock audit log + $stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + + if ( ($status=='LOGIN') and ($stage=='logout') ) + { + $VDdisplayMESSAGE = "Du har nu logget ud"; + $LOGtimeMESSAGE = "Du loggede ud:$NOW_TIME
Tid som du har været indlogget:$totTIME_HMS"; + + ### Add a record to the timeclock log + $stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $timeclock_id = mysql_insert_id($link); + print "\n"; + + ### Update last login record in the timeclock log + $stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + ### Update the user's timeclock status record + $stmt="UPDATE vicidial_timeclock_status set status='LOGOUT', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + ### Add a record to the timeclock audit log + $stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + + ### Update last login record in the timeclock audit log + $stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + print "\n"; + } + + if ( ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) ) + {echo "Fejl: stempelklokken er allerede aktiv :$status|$stage"; exit;} + + if ($referrer=='agent') + {$BACKlink = "TILBAGE til Agent påloggning";} + if ($referrer=='admin') + {$BACKlink = "TILBAGE til administration";} + if ($referrer=='welcome') + {$BACKlink = "TILBAGE til Velkomst skærm";} + + echo"\n"; + echo"AgentStempelklokke\n"; + echo"\n"; + echo"\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Stempelklokke
 
$LOGtimeMESSAGE
 
$BACKlink
 

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + + exit; + } + + + + + if ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) + { + $VDdisplayMESSAGE = "Tid siden sidste login:$totTIME_HMS"; + $log_action = 'login'; + $button_name = 'LOGIN'; + $LOGtimeMESSAGE = "Sist loggede du ud:$last_action_date

Klik LOGIN forneden for at logge på"; + } + if ($status=='LOGIN') + { + $VDdisplayMESSAGE = "Tid du har været indlogget:$totTIME_HMS"; + $log_action = 'logout'; + $button_name = 'LOGOUT'; + $LOGtimeMESSAGE = "Du loggede ind: $last_action_date
Tid du har været indlogget:$totTIME_HMS

Klik LOGOUT forneden for at logge ud"; + } + + echo"\n"; + echo"AgentStempelklokke\n"; + echo"\n"; + echo"\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Stempelklokke
 
$LOGtimeMESSAGE
 
 

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + + exit; + } + + + + } + +else + { + echo"\n"; + echo"AgentStempelklokke\n"; + echo"\n"; + echo"\n"; + echo "\n"; + echo "
\n"; + echo "\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 "\n"; + echo "\n"; + echo "
Stempelklokke
 
Bruger login:
Bruger password:
 

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_dk/vdc_db_query.php new file mode 100644 index 00000000..5c886f76 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/vdc_db_query.php @@ -0,0 +1,10008 @@ + LICENSE: AGPLv2 +# +# This script is designed to exchange information between vicidial.php and the database server for various actions +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $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','CALLLOGview','LEADINFOview','customer_3way_hangup_process') +# - $stage - ('start','finish','lookup','new') +# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') +# - $conf_exten - ('8600011',...) +# - $exten - ('123test',...) +# - $ext_context - ('default','demo',...) +# - $ext_priority - ('1','2',...) +# - $campaign - ('testcamp',...) +# - $dial_timeout - ('60','26',...) +# - $dial_prefix - ('9','8',...) +# - $campaign_cid - ('3125551212','0000000000',...) +# - $MDnextCID - ('M06301413000000002',...) +# - $uniqueid - ('1120232758.2406800',...) +# - $lead_id - ('36524',...) +# - $list_id - ('101','123456',...) +# - $length_in_sec - ('12',...) +# - $phone_code - ('1',...) +# - $phone_number - ('3125551212',...) +# - $channel - ('Zap/12-1',...) +# - $start_epoch - ('1120236911',...) +# - $vendor_lead_code - ('1234test',...) +# - $title - ('Mr.',...) +# - $first_name - ('Bob',...) +# - $middle_initial - ('L',...) +# - $last_name - ('Wilson',...) +# - $address1 - ('1324 Main St.',...) +# - $address2 - ('Apt. 12',...) +# - $address3 - ('co Robert Wilson',...) +# - $city - ('Chicago',...) +# - $state - ('IL',...) +# - $province - ('NA',...) +# - $postal_code - ('60054',...) +# - $country_code - ('USA',...) +# - $gender - ('M',...) +# - $date_of_birth - ('1970-01-01',...) +# - $alt_phone - ('3125551213',...) +# - $email - ('bob@bob.com',...) +# - $security_phrase - ('Hello',...) +# - $comments - ('Good Customer',...) +# - $auto_dial_level - ('0','1','1.2',...) +# - $VDstop_rec_after_each_call - ('0','1') +# - $conf_silent_prefix - ('7','8','5',...) +# - $extension - ('123','user123','25-1',...) +# - $protocol - ('Zap','SIP','IAX2',...) +# - $user_abb - ('1234','6666',...) +# - $preview - ('YES','NO',...) +# - $called_count - ('0','1','2',...) +# - $agent_log_id - ('123456',...) +# - $agent_log - ('NO',...) +# - $favorites_list - (",'cc160','cc100'",...) +# - $CallBackDatETimE - ('2006-04-21 14:30:00',...) +# - $recipient - ('ANYONE,'USERONLY') +# - $callback_id - ('12345','12346',...) +# - $use_internal_dnc - ('Y','N') +# - $use_campaign_dnc - ('Y','N') +# - $omit_phone_code - ('Y','N') +# - $no_delete_sessions - ('0','1') +# - $LogouTKicKAlL - ('0','1'); +# - $closer_blended = ('0','1'); +# - $inOUT = ('IN','OUT'); +# - $manual_dial_filter = ('NONE','CAMPLISTS','DNC','CAMPLISTS_DNC') +# - $agentchannel = ('Zap/1-1','SIP/testing-6ry4i3',...) +# - $conf_dialed = ('0','1') +# - $leaving_threeway = ('0','1') +# - $blind_transfer = ('0','1') +# - $usegroupalias - ('0','1') +# - $account - ('DEFAULT',...) +# - $agent_dialed_number - ('1','') +# - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) +# - $wrapup - ('WRAPUP','') +# - $vtiger_callback_id - ('16534'...) +# - $nodeletevdac - ('0','1') +# - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# +# +# CHANGELOG: +# 50629-1044 - First build of script +# 50630-1422 - Added manual dial action and MD channel lookup +# 50701-1451 - Added dial log for start and end of vicidial calls +# 50705-1239 - Added call disposition update +# 50804-1627 - Fixed updateDispo to update vicidial_log entry +# 50816-1605 - Added VDADpause/ready for auto dialing +# 50816-1811 - Added basic autodial call pickup functions +# 50817-1005 - Altered logging functions to accomodate auto_dialing +# 50818-1305 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1411 - Added hangup of agent phone after Logout +# 50901-1315 - Fixed CLOSER IN-GROUP Web Form bug +# 50902-1507 - Fixed CLOSER log length_in_sec bug +# 50902-1730 - Added functions for manual preview dialing and revert +# 50913-1214 - Added agent random update to leadupdate +# 51020-1421 - Added agent_log_id framework for detailed agent activity logging +# 51021-1717 - Allows for multi-line comments (changes \n to !N in database) +# 51111-1046 - Added vicidial_agent_log lead_id earlier for manual dial +# 51121-1445 - Altered echo statements for several small PHP speed optimizations +# 51122-1328 - Fixed UserLogout issue not removing conference reservation +# 51129-1012 - Added ability to accept calls from other VICIDIAL servers +# 51129-1729 - Changed manual dial to use the '/n' flag for calls +# 51221-1154 - Added SCRIPT id lookup and sending to vicidial.php for display +# 60105-1059 - Added Updating of astguiclient favorites in the DB +# 60208-1617 - Added dtmf buttons output per call +# 60213-1521 - Added closer_campaigns update to vicidial_users +# 60215-1036 - Added Callback date-time entry into vicidial_callbacks table +# 60413-1541 - Added USERONLY Callback listings output - CalLBacKLisT +# - Added USERONLY Callback count output - CalLBacKCounT +# 60414-1140 - Added Callback lead lookup for manual dialing +# 60419-1517 - After CALLBK is sent to agent, update callback record to INACTIVE +# 60421-1419 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60427-1236 - Fixed closer_choice error for CLOSER campaigns +# 60609-1148 - Added ability to check for manual dial numbers in DNC +# 60619-1117 - Added variable filters to close security holes for login form +# 60623-1414 - Fixed variable filter for phone_code and fixed manual dial logic +# 60821-1600 - Added ability to omit the phone code on vicidial lead dialing +# 60821-1647 - Added ability to not delete sessions at logout +# 60906-1124 - Added lookup and sending of callback data for CALLBK calls +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70115-1733 - Added alt_dial functionality in auto-dial modes +# 70118-1501 - Added user_group to vicidial_log,_agent_log,_closer_log,_callbacks +# 70123-1357 - Fixed bug that would not update vicidial_closer_log status to dispo +# 70202-1438 - Added pause code submit function +# 70203-0930 - Added dialed_number to lead info output +# 70203-1030 - Added dialed_label to lead info output +# 70206-1126 - Added INBOUND status for inbound/closer calls in vicidial_live_agents +# 70212-1253 - Fixed small issue with CXFER +# 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions +# 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging +# 70222-1616 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70309-1034 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70319-1544 - Added agent disable update customer data function +# 70322-1545 - Added sipsak display ability +# 70413-1253 - Fixed bug for outbound call time in CLOSER-type blended campaigns +# 70424-1100 - Fixed bug for fronter/closer calls that would delete vdac records +# 70802-1729 - Fixed bugs with pause_sec and wait_sec under certain call handling +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71029-1855 - removed campaign_id naming restrictions for CLOSER-type campaigns +# 71030-2047 - added hopper priority for auto alt dial entries +# 71116-1011 - added calls_today count updating of the vicidial_live_agents upon INCALL +# 71120-1520 - added LogiNCamPaigns to show only allowed campaigns for agents upon login +# 71125-1751 - Added inbound-group default inbound group sending to vicidial.php +# 71129-2025 - restricted callbacks count and list to campaign only +# 71223-0318 - changed logging of closer calls +# 71226-1117 - added option to kick all calls from conference upon logout +# 80116-1032 - added user_closer_log logging in regCLOSER +# 80125-1213 - fixed vicidial_log bug when call is from closer +# 80317-2051 - Added in-group recording settings +# 80402-0121 - Fixes for manual dial transfers on some systems, removed /n persist flag +# 80424-0442 - Added non_latin lookup from system_settings +# 80430-1006 - Added term_reason for vicidial_log and vicidial_closer_log +# 80430-1957 - Changed to leave lead_id in vicidial_live_agents record until after dispo +# 80630-2153 - Added queue_log logging for Manual dial calls +# 80703-0139 - Added alter customer phone permissions +# 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording +# 80713-0624 - Added vicidial_list.last_local_call_time field +# 80717-1604 - Modified logging function to use inOUT to determine call direction and place to log +# 80719-1147 - Changed recording conf prefix +# 80815-1019 - Added manual dial list restriction option +# 80831-0545 - Added extended alt dial number info display support +# 80909-1710 - Added support for campaign-specific DNC lists +# 81010-1048 - Added support for hangup of all channels except for agent channel after attempting a 3way call +# 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call +# 81020-1459 - Fixed bugs in queue_log logging +# 81104-0134 - Added mysql error logging capability +# 81104-1617 - Added multi-retry for some vicidial_live_agents table MySQL queries +# 81106-0410 - Added force_timeclock_login option to LoginCampaigns function +# 81107-0424 - Added carryover of script and presets for in-group calls from campaign settings +# 81110-0058 - Changed Pause time to start new vicidial_agent_log on every pause +# 81110-1512 - Added hangup_all_non_reserved to fix non-Hangup bug +# 81111-1630 - Added another hangup fix for non-hangup +# 81114-0126 - More vicidial_agent_log bug fixes +# 81119-1809 - webform backslash fix +# 81124-2212 - Fixes blind transfer bug +# 81126-1522 - Fixed callback comments bug +# 81211-0420 - Fixed Manual dial agent_log bug +# 90120-1718 - Added external pause and dial option +# 90126-1759 - Fixed QM section that wasn't qualified and added agent alert option +# 90128-0231 - Added vendor_lead_code to manual dial lead lookup +# 90304-1335 - Added support for group aliases and agent-specific variables for campaigns and in-groups +# 90305-1041 - Added agent_dialed_number and type for user_call_log feature +# 90307-1735 - Added Shift enforcement and manager override features +# 90320-0306 - Fixed agent log bug when using wrapup time +# 90323-2013 - Added function to put phone numbers in the DNC lists if they were set to status type dnc=Y +# 90324-1316 - Added functions to log calls to Vtiger accounts and update status to siccode +# 90327-1348 - Changed Vtiger status populate to use status name +# 90408-0021 - Added API vtiger specific callback activity record ability +# 90508-0726 - Changed to PHP long tags +# 90511-0923 - Added agentonly_callback_campaign_lock option +# 90519-0634 - Fixed manual dial status and logging bug +# 90611-1423 - Fixed agent log and vicidial log bugs +# 90705-2008 - Added AGENTSview function +# 90706-1431 - Added Agent view transfer selection +# 90712-2303 - Added view calls in queue, grab call from queue +# 90717-0638 - Fixed alt dial on overflow in-group calls +# 90722-1542 - Added no hopper dialing +# 90729-0637 - Added DiaLableLeaDsCounT +# 90808-0221 - Added last_state_change to vicidial_live_agents +# 90904-1622 - Added timezone sort options for no hopper dialing +# 90908-1037 - Added DEAD call logging +# 90916-1839 - Added nodeletevdac +# 90917-2246 - Fixed auto-alt-dial DNC check bug +# 90924-1544 - Added List callerid override option +# 90930-1638 - Added agent_territories feature +# 91012-0535 - Fixed User territory no-hopper dial bug +# 91019-1224 - Fixed auto-alt-dial DNC issues +# 91026-1101 - Added AREACODE DNC option +# 91108-2120 - Fixed QM log issue with PAUSEREASON entries +# 91112-1107 - Changed ENTERQUEUE to CALLOUTBOUND for QM logging +# 91123-1801 - Added outbound_autodial field +# 91204-1937 - Added logging of agent grab calls +# 91213-0946 - Added queue_position to queue_log COMPLETE... records +# 91228-1340 - Added API fields update functions +# 100103-1254 - Added 3 more conf-presets, list ID override presets and call start/dispo URLs +# 100104-1509 - Fixed vicidial_log duplicate check to allow update if dup and logging update +# 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 +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility +# 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes +# + +$version = '2.4-204'; +$build = '120221-2125'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=438; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +### If you have globals turned off uncomment these lines +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];} + elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["closer_choice"])) {$closer_choice=$_GET["closer_choice"];} + elseif (isset($_POST["closer_choice"])) {$closer_choice=$_POST["closer_choice"];} +if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];} + elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];} +if (isset($_GET["exten"])) {$exten=$_GET["exten"];} + elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];} +if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];} + elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];} +if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];} + elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_timeout"])) {$dial_timeout=$_GET["dial_timeout"];} + elseif (isset($_POST["dial_timeout"])) {$dial_timeout=$_POST["dial_timeout"];} +if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];} + elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];} +if (isset($_GET["campaign_cid"])) {$campaign_cid=$_GET["campaign_cid"];} + elseif (isset($_POST["campaign_cid"])) {$campaign_cid=$_POST["campaign_cid"];} +if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];} + elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +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["length_in_sec"])) {$length_in_sec=$_GET["length_in_sec"];} + elseif (isset($_POST["length_in_sec"])) {$length_in_sec=$_POST["length_in_sec"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["channel"])) {$channel=$_GET["channel"];} + elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} +if (isset($_GET["start_epoch"])) {$start_epoch=$_GET["start_epoch"];} + elseif (isset($_POST["start_epoch"])) {$start_epoch=$_POST["start_epoch"];} +if (isset($_GET["dispo_choice"])) {$dispo_choice=$_GET["dispo_choice"];} + elseif (isset($_POST["dispo_choice"])) {$dispo_choice=$_POST["dispo_choice"];} +if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];} + elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];} +if (isset($_GET["title"])) {$title=$_GET["title"];} + elseif (isset($_POST["title"])) {$title=$_POST["title"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];} + elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["address1"])) {$address1=$_GET["address1"];} + elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];} +if (isset($_GET["address2"])) {$address2=$_GET["address2"];} + elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];} +if (isset($_GET["address3"])) {$address3=$_GET["address3"];} + elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +if (isset($_GET["gender"])) {$gender=$_GET["gender"];} + elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];} +if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];} + elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];} +if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];} + elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];} + elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];} +if (isset($_GET["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_GET["VDstop_rec_after_each_call"];} + elseif (isset($_POST["VDstop_rec_after_each_call"])) {$VDstop_rec_after_each_call=$_POST["VDstop_rec_after_each_call"];} +if (isset($_GET["conf_silent_prefix"])) {$conf_silent_prefix=$_GET["conf_silent_prefix"];} + elseif (isset($_POST["conf_silent_prefix"])) {$conf_silent_prefix=$_POST["conf_silent_prefix"];} +if (isset($_GET["extension"])) {$extension=$_GET["extension"];} + elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} +if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];} + elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];} +if (isset($_GET["user_abb"])) {$user_abb=$_GET["user_abb"];} + elseif (isset($_POST["user_abb"])) {$user_abb=$_POST["user_abb"];} +if (isset($_GET["preview"])) {$preview=$_GET["preview"];} + elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];} +if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];} + elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];} +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["agent_log"])) {$agent_log=$_GET["agent_log"];} + elseif (isset($_POST["agent_log"])) {$agent_log=$_POST["agent_log"];} +if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];} + elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} +if (isset($_GET["CallBackDatETimE"])) {$CallBackDatETimE=$_GET["CallBackDatETimE"];} + elseif (isset($_POST["CallBackDatETimE"])) {$CallBackDatETimE=$_POST["CallBackDatETimE"];} +if (isset($_GET["recipient"])) {$recipient=$_GET["recipient"];} + elseif (isset($_POST["recipient"])) {$recipient=$_POST["recipient"];} +if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];} + elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];} +if (isset($_GET["use_internal_dnc"])) {$use_internal_dnc=$_GET["use_internal_dnc"];} + elseif (isset($_POST["use_internal_dnc"])) {$use_internal_dnc=$_POST["use_internal_dnc"];} +if (isset($_GET["use_campaign_dnc"])) {$use_campaign_dnc=$_GET["use_campaign_dnc"];} + elseif (isset($_POST["use_campaign_dnc"])) {$use_campaign_dnc=$_POST["use_campaign_dnc"];} +if (isset($_GET["omit_phone_code"])) {$omit_phone_code=$_GET["omit_phone_code"];} + elseif (isset($_POST["omit_phone_code"])) {$omit_phone_code=$_POST["omit_phone_code"];} +if (isset($_GET["phone_ip"])) {$phone_ip=$_GET["phone_ip"];} + elseif (isset($_POST["phone_ip"])) {$phone_ip=$_POST["phone_ip"];} +if (isset($_GET["enable_sipsak_messages"])) {$enable_sipsak_messages=$_GET["enable_sipsak_messages"];} + elseif (isset($_POST["enable_sipsak_messages"])) {$enable_sipsak_messages=$_POST["enable_sipsak_messages"];} +if (isset($_GET["status"])) {$status=$_GET["status"];} + elseif (isset($_POST["status"])) {$status=$_POST["status"];} +if (isset($_GET["LogouTKicKAlL"])) {$LogouTKicKAlL=$_GET["LogouTKicKAlL"];} + elseif (isset($_POST["LogouTKicKAlL"])) {$LogouTKicKAlL=$_POST["LogouTKicKAlL"];} +if (isset($_GET["closer_blended"])) {$closer_blended=$_GET["closer_blended"];} + elseif (isset($_POST["closer_blended"])) {$closer_blended=$_POST["closer_blended"];} +if (isset($_GET["inOUT"])) {$inOUT=$_GET["inOUT"];} + elseif (isset($_POST["inOUT"])) {$inOUT=$_POST["inOUT"];} +if (isset($_GET["manual_dial_filter"])) {$manual_dial_filter=$_GET["manual_dial_filter"];} + elseif (isset($_POST["manual_dial_filter"])) {$manual_dial_filter=$_POST["manual_dial_filter"];} +if (isset($_GET["alt_dial"])) {$alt_dial=$_GET["alt_dial"];} + elseif (isset($_POST["alt_dial"])) {$alt_dial=$_POST["alt_dial"];} +if (isset($_GET["agentchannel"])) {$agentchannel=$_GET["agentchannel"];} + elseif (isset($_POST["agentchannel"])) {$agentchannel=$_POST["agentchannel"];} +if (isset($_GET["conf_dialed"])) {$conf_dialed=$_GET["conf_dialed"];} + elseif (isset($_POST["conf_dialed"])) {$conf_dialed=$_POST["conf_dialed"];} +if (isset($_GET["leaving_threeway"])) {$leaving_threeway=$_GET["leaving_threeway"];} + elseif (isset($_POST["leaving_threeway"])) {$leaving_threeway=$_POST["leaving_threeway"];} +if (isset($_GET["hangup_all_non_reserved"])) {$hangup_all_non_reserved=$_GET["hangup_all_non_reserved"];} + elseif (isset($_POST["hangup_all_non_reserved"])) {$hangup_all_non_reserved=$_POST["hangup_all_non_reserved"];} +if (isset($_GET["blind_transfer"])) {$blind_transfer=$_GET["blind_transfer"];} + elseif (isset($_POST["blind_transfer"])) {$blind_transfer=$_POST["blind_transfer"];} +if (isset($_GET["usegroupalias"])) {$usegroupalias=$_GET["usegroupalias"];} + elseif (isset($_POST["usegroupalias"])) {$usegroupalias=$_POST["usegroupalias"];} +if (isset($_GET["account"])) {$account=$_GET["account"];} + elseif (isset($_POST["account"])) {$account=$_POST["account"];} +if (isset($_GET["agent_dialed_number"])) {$agent_dialed_number=$_GET["agent_dialed_number"];} + elseif (isset($_POST["agent_dialed_number"])) {$agent_dialed_number=$_POST["agent_dialed_number"];} +if (isset($_GET["agent_dialed_type"])) {$agent_dialed_type=$_GET["agent_dialed_type"];} + elseif (isset($_POST["agent_dialed_type"])) {$agent_dialed_type=$_POST["agent_dialed_type"];} +if (isset($_GET["wrapup"])) {$wrapup=$_GET["wrapup"];} + elseif (isset($_POST["wrapup"])) {$wrapup=$_POST["wrapup"];} +if (isset($_GET["vtiger_callback_id"])) {$vtiger_callback_id=$_GET["vtiger_callback_id"];} + elseif (isset($_POST["vtiger_callback_id"])) {$vtiger_callback_id=$_POST["vtiger_callback_id"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["no_delete_sessions"])) {$no_delete_sessions=$_GET["no_delete_sessions"];} + elseif (isset($_POST["no_delete_sessions"])) {$no_delete_sessions=$_POST["no_delete_sessions"];} +if (isset($_GET["nodeletevdac"])) {$nodeletevdac=$_GET["nodeletevdac"];} + elseif (isset($_POST["nodeletevdac"])) {$nodeletevdac=$_POST["nodeletevdac"];} +if (isset($_GET["agent_territories"])) {$agent_territories=$_GET["agent_territories"];} + elseif (isset($_POST["agent_territories"])) {$agent_territories=$_POST["agent_territories"];} +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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStatus"])) {$CallBackLeadStatus=$_GET["CallBackLeadStatus"];} + elseif (isset($_POST["CallBackLeadStatus"])) {$CallBackLeadStatus=$_POST["CallBackLeadStatus"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} + + +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'; +$US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Bruger busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Ikke gyldigt number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STATUS INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Inkommende calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Ikke gyldigt call reference value.", +88 => "Incompatible destination.", +95 => "Ikke gyldigt message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Ikke gyldigt information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery på timer expiry.", +103 => "Parameter non-existent or not implemented - passed på (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +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]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; + } +##### 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-9a-zA-Z]","",$phone_number); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); + +# 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;} + +if ($ACTION == 'LogiNCamPaigns') + { + $skip_user_validation=1; + } +else + { + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00002',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $auth=$row[0]; + + if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) + { + echo "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } + else + { + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00003',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + } + +if ($format=='debug') + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "VICIDiaL Database Query Script"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + + +################################################################################ +### LogiNCamPaigns - generates an HTML SELECT list of allowed campaigns for a +### specific agent on the login screen +################################################################################ +if ($ACTION == 'LogiNCamPaigns') + { + if ( (strlen($user)<1) ) + { + echo "\n"; + exit; + } + else + { + $stmt="SELECT user_group,user_level,agent_shift_enforcement_override,shift_override_flag from vicidial_users where user='$user' and pass='$pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00004',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VU_user_group = $row[0]; + $VU_user_level = $row[1]; + $VU_agent_shift_enforcement_override = $row[2]; + $VU_shift_override_flag = $row[3]; + + $LOGallowed_campaignsSQL=''; + + $stmt="SELECT allowed_campaigns,forced_timeclock_login,shift_enforcement,group_shifts 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,'00005',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $forced_timeclock_login = $row[1]; + $shift_enforcement = $row[2]; + $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[3]); + $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL); + $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')"; + if ( (!eregi("ALL-CAMPAIGNS",$row[0])) ) + { + $LOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]); + $LOGallowed_campaignsSQL = eregi_replace(' ',"','",$LOGallowed_campaignsSQL); + $LOGallowed_campaignsSQL = "and campaign_id IN('$LOGallowed_campaignsSQL')"; + } + + $show_campaign_list=1; + ### 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"); + $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='$user' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;"; + if ($DB>0) {echo "|$stmt|";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00184',$user,$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 ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) ) + {$show_campaign_list=0;} + } + } + + ### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, 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) ) + { + $VDdisplayMESSAGE = "FEJL: Ingen vagter er aktiveret for din bruger gruppe\n"; + $VDloginDISPLAY=1; + } + 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,'00193',$user,$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) ) + { + $VDdisplayMESSAGE = "FEJL: Du må ikke logge ind udenfor din vagttid\n"; + $VDloginDISPLAY=1; + } + } + if ($VDloginDISPLAY > 0) + { + $loginDATE = date("Ymd"); + $VDdisplayMESSAGE.= "

MANAGER OVERRIDE:
\n"; + $VDdisplayMESSAGE.= "
\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "Din leder Login:
\n"; + $VDdisplayMESSAGE.= "Din lederPassword:
\n"; + $VDdisplayMESSAGE.= "




\n"; + echo "$VDdisplayMESSAGE"; + exit; + } + } + + if ($show_campaign_list > 0) + { + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00006',$user,$server_ip,$session_name,$one_mysql_log);} + $camps_to_print = mysql_num_rows($rslt); + + echo "\n"; + } + else + { + echo "\n"; + } + exit; + } + + + +################################################################################ +### regCLOSER - update the vicidial_live_agents table to reflect the closer +### inbound choices made upon login +################################################################################ +if ($ACTION == 'regCLOSER') + { + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Gruppe valg $closer_choice er ikke valid\n"; + exit; + } + else + { + if ($closer_blended > 0) + {$vla_autodial = 'Y';} + else + {$vla_autodial = 'N';} + if (preg_match('/INBOUND_MAN|MANUAL/',$dial_method)) + {$vla_autodial = 'N';} + + if ($closer_choice == "MGRLOCK-") + { + $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00007',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $closer_choice =$row[0]; + + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice',last_state_change='$NOW_TIME',outbound_autodial='$vla_autodial' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00008',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + { + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice',last_state_change='$NOW_TIME',outbound_autodial='$vla_autodial' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00009',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00010',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$campaign',event_date='$NOW_TIME',blended='$closer_blended',closer_campaigns='$closer_choice';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00011',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="DELETE FROM vicidial_live_inbound_agents where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00012',$user,$server_ip,$session_name,$one_mysql_log);} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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]; + $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; + $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); + $k=1; + while ($k < $in_groups_ct) + { + if (strlen($in_groups[$k])>1) + { + $stmt="SELECT group_weight,calls_today,group_grade FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00013',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $viga_ct = mysql_num_rows($rslt); + if ($viga_ct > 0) + { + $row=mysql_fetch_row($rslt); + $group_weight = $row[0]; + $calls_today = $row[1]; + $group_grade = $row[2]; + } + else + { + $group_weight = 0; + $calls_today = 0; + $group_grade = 1; + } + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME',group_grade='$group_grade';"; + 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) ) + { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00388',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $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' $data4SQL;"; + $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++; + } + + } + echo "Closer In Gruppe valg $closer_choice er registreret til bruger $user\n"; + } + + + + + +################################################################################# +### regTERRITORY - update the vicidial_live_agents table to reflect the territory +### choices made upon login or while paused (agent_territories) +################################################################################# +if ($ACTION == 'regTERRITORY') + { + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($agent_territories)<1) || (strlen($user)<1) ) + { + $channel_live=0; + echo "Territory Choice $agent_territories er ikke valid\n"; + exit; + } + else + { + if (preg_match("/^MGRLOCK/",$agent_territories)) + { + $stmt="SELECT territory FROM vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00253',$user,$server_ip,$session_name,$one_mysql_log);} + $territories_ct = mysql_num_rows($rslt); + if ($DB) {echo "$territories_ct|$stmt\n";} + $k=0; + $agent_territories=''; + while ($territories_ct > $k) + { + $row=mysql_fetch_row($rslt); + $agent_territories .= " $row[0]"; + $k++; + } + $agent_territories .= " -"; + + $stmt="UPDATE vicidial_live_agents set agent_territories='$agent_territories',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00254',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + { + $stmt="UPDATE vicidial_live_agents set agent_territories='$agent_territories',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00255',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $stmt="INSERT INTO vicidial_user_territory_log set user='$user',campaign_id='$campaign',event_date='$NOW_TIME',agent_territories='$agent_territories';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00256',$user,$server_ip,$session_name,$one_mysql_log);} + } + echo "Territory Choice $agent_territories er registreret til bruger $user\n"; + } + + + + + +################################################################################ +### For every process below, lookup the current agent_log_id for the user +################################################################################ +$stmt="SELECT agent_log_id from vicidial_live_agents where user='$user';"; +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00222',$user,$server_ip,$session_name,$one_mysql_log);} +$users_to_parse = mysql_num_rows($rslt); +if ($users_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] > 0) {$agent_log_id = $rowx[0];} + } + + + +################################################################################ +### UpdateFields - sends current vicidial_list values for fields +################################################################################ +if ($ACTION == 'UpdateFields') + { + $stmt="UPDATE vicidial_live_agents set external_update_fields='0',external_update_fields_data='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00276',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="SELECT lead_id from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00274',$user,$server_ip,$session_name,$one_mysql_log);} + $vla_records = mysql_num_rows($rslt); + if ($vla_records > 0) + { + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] > 0) {$lead_id = $rowx[0];} + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT vendor_lead_code,source_id,gmt_offset_now,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,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,'00275',$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); + $vendor_id = trim("$row[0]"); + $source_id = trim("$row[1]"); + $gmt_offset_now = trim("$row[2]"); + $phone_code = trim("$row[3]"); + $phone_number = trim("$row[4]"); + $title = trim("$row[5]"); + $first_name = trim("$row[6]"); + $middle_initial = trim("$row[7]"); + $last_name = trim("$row[8]"); + $address1 = trim("$row[9]"); + $address2 = trim("$row[10]"); + $address3 = trim("$row[11]"); + $city = trim("$row[12]"); + $state = trim("$row[13]"); + $province = trim("$row[14]"); + $postal_code = trim("$row[15]"); + $country_code = trim("$row[16]"); + $gender = trim("$row[17]"); + $date_of_birth = trim("$row[18]"); + $alt_phone = trim("$row[19]"); + $email = trim("$row[20]"); + $security = trim("$row[21]"); + $comments = stripslashes(trim("$row[22]")); + $rank = trim("$row[23]"); + $owner = trim("$row[24]"); + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = "GOOD\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $source_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $rank . "\n"; + $LeaD_InfO .= $owner . "\n"; + $LeaD_InfO .= "\n"; + + echo $LeaD_InfO; + } + else + { + echo "ERROR: no lead info in system: $lead_id\n"; + } + } + else + { + echo "ERROR: no lead active for this agent\n"; + } + } + + +################################################################################ +### manDiaLnextCaLL - for manual VICIDiaL dialing this will grab the next lead +### in the campaign, reserve it, send data back to client and +### place the call by inserting into vicidial_manager +################################################################################ +if ($ACTION == 'manDiaLnextCaLL') + { + $MT[0]=''; + $row=''; $rowx=''; + $override_dial_number=''; + $channel_live=1; + $lead_id = ereg_replace("[^0-9]","",$lead_id); + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) + { + $channel_live=0; + echo "HOPPER TOM\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context er ikke valid\n"; + exit; + } + else + { + ##### grab number of calls today in this campaign and increment + $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";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today = $row[0]; + $eac_phone = $row[1]; + } + else + {$calls_today ='0';} + $calls_today++; + + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='$campaign' and vs.script_id=vc.campaign_script and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00257',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + + ### check if this is a callback, if it is, skip the grabbing of a new lead and mark the callback as INACTIVE + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + $affected_rows=1; + $CBleadIDset=1; + + $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00016',$user,$server_ip,$session_name,$one_mysql_log);} + } + ### check if this is a specific lead call, if it is, skip the grabbing of a new lead + elseif (strlen($lead_id)>0) + { + $affected_rows=1; + $CBleadIDset=1; + + if (strlen($phone_number) > 5) + {$override_dial_number = $phone_number;} + } + else + { + if (strlen($phone_number)>3) + { + if (ereg("ENABLED",$manual_dial_call_time_check)) + { + $secX = date("U"); + $hour = date("H"); + $min = date("i"); + $sec = date("s"); + $mon = date("m"); + $mday = date("d"); + $year = date("Y"); + $isdst = date("I"); + $Shour = date("H"); + $Smin = date("i"); + $Ssec = date("s"); + $Smon = date("m"); + $Smday = date("d"); + $Syear = date("Y"); + $pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; + $inSD = $pulldate0; + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $postalgmt=''; + $postal_code=''; + $state=''; + if (strlen($phone_code)<1) + {$phone_code='1';} + + $local_call_time='24hours'; + ##### gather local call time setting from campaign + $stmt="SELECT local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00353',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_lct_ct = mysql_num_rows($rslt); + if ($camp_lct_ct > 0) + { + $row=mysql_fetch_row($rslt); + $local_call_time = $row[0]; + } + + ### get current gmt_offset of the phone_number + $USarea = substr($phone_number, 0, 3); + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + $dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state); + + if ($dialable < 1) + { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00354',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00355',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "OUTSIDE OF LOCAL OPKALD TIME $VMDQaffected_rows|$VLAEDaffected_rows\n"; + exit; + } + } + + if (ereg("DNC",$manual_dial_filter)) + { + if (ereg("AREACODE",$use_internal_dnc)) + { + $phone_number_areacode = substr($phone_number, 0, 3); + $phone_number_areacode .= "XXXXXXX"; + $stmt="SELECT count(*) from vicidial_dnc where phone_number IN('$phone_number','$phone_number_areacode');"; + } + else + {$stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00017',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00356',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00357',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "DNC NUMMER\n"; + exit; + } + if (ereg("AREACODE",$use_campaign_dnc)) + { + $phone_number_areacode = substr($phone_number, 0, 3); + $phone_number_areacode .= "XXXXXXX"; + $stmt="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$phone_number','$phone_number_areacode') and campaign_id='$campaign';"; + } + else + {$stmt="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign';";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00018',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00358',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00359',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "DNC NUMMER\n"; + exit; + } + } + if (ereg("CAMPLISTS",$manual_dial_filter)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00019',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + if (ereg("Y", $rowx[1])) {$active_lists++; $camp_lists .= "'$rowx[0]',";} + 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); + + $stmt="SELECT count(*) FROM vicidial_list where phone_number='$phone_number' and list_id IN($camp_lists);"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00020',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + + if ($row[0] < 1) + { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00360',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00361',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "NUMMER NOT IN CAMPLISTS\n"; + exit; + } + } + if ($stage=='lookup') + { + if (strlen($vendor_lead_code)>0) + { + $stmt="SELECT lead_id FROM vicidial_list where vendor_lead_code='$vendor_lead_code' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00021',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + if ( ($man_leadID_ct > 0) and (strlen($phone_number) > 5) ) + {$override_phone++;} + } + else + { + $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00362',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $man_leadID_ct = mysql_num_rows($rslt); + } + if ($man_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $affected_rows=1; + $lead_id =$row[0]; + $CBleadIDset=1; + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',vendor_lead_code='$vendor_lead_code';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00022',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ### insert a new lead in the system with this phone number + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00023',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $lead_id = mysql_insert_id($link); + $CBleadIDset=1; + } + } + else + { + ##### gather no hopper dialing settings from campaign + $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary,call_count_limit FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00236',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_nohopper_ct = mysql_num_rows($rslt); + if ($camp_nohopper_ct > 0) + { + $row=mysql_fetch_row($rslt); + $no_hopper_dialing = $row[0]; + $agent_dial_owner_only = $row[1]; + $local_call_time = $row[2]; + $dial_statuses = $row[3]; + $drop_lockout_time = $row[4]; + $lead_filter_id = $row[5]; + $lead_order = $row[6]; + $lead_order_randomize = $row[7]; + $lead_order_secondary = $row[8]; + $call_count_limit = $row[9]; + } + if (eregi("N",$no_hopper_dialing)) + { + ### grab the next lead in the hopper for this campaign and reserve it for the user + $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by priority desc,hopper_id LIMIT 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00024',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + } + else + { + ### figure out what the next lead that should be dialed is + + ########################################################## + ### BEGIN find the next lead to dial without looking in the hopper + ########################################################## + # $DB=1; + if (strlen($dial_statuses)>2) + { + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) + { + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; + } + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00237',$user,$server_ip,$session_name,$one_mysql_log);} + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00238',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) - 0); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $Dsql .= "'$Dstatuses[$o]',"; + } + $Dsql = preg_replace("/,$/","",$Dsql); + if (strlen($Dsql) < 2) {$Dsql = "''";} + + $DLTsql=''; + if ($drop_lockout_time > 0) + { + $DLseconds = ($drop_lockout_time * 3600); + $DLseconds = floor($DLseconds); + $DLseconds = intval("$DLseconds"); + $DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )"; + } + + $CCLsql=''; + if ($call_count_limit > 0) + { + $CCLsql = "and (called_count < $call_count_limit)"; + } + + $stmt="SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00239',$user,$server_ip,$session_name,$one_mysql_log);} + $filtersql_ct = mysql_num_rows($rslt); + if ($DB) {echo "$filtersql_ct|$stmt\n";} + if ($filtersql_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fSQL = "and $row[0]"; + $fSQL = preg_replace('/\\\\/','',$fSQL); + } + + $stmt="SELECT list_id FROM vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00240',$user,$server_ip,$session_name,$one_mysql_log);} + $camplists_ct = mysql_num_rows($rslt); + if ($DB) {echo "$camplists_ct|$stmt\n";} + $k=0; + $camp_lists=''; + while ($camplists_ct > $k) + { + $row=mysql_fetch_row($rslt); + $camp_lists .= "'$row[0]',"; + $k++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + if (strlen($camp_lists) < 4) {$camp_lists="''";} + + $stmt="SELECT user_group,territory FROM vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00241',$user,$server_ip,$session_name,$one_mysql_log);} + $userterr_ct = mysql_num_rows($rslt); + if ($DB) {echo "$userterr_ct|$stmt\n";} + if ($userterr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = $row[0]; + $territory = $row[1]; + } + + $adooSQL = ''; + if (eregi("TERRITORY",$agent_dial_owner_only)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00406',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00407',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00408',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + + $adooSQL = $searchownerSQL; + } + if (eregi("USER",$agent_dial_owner_only)) {$adooSQL = "and owner='$user'";} + if (eregi("USER_GROUP",$agent_dial_owner_only)) {$adooSQL = "and owner='$user_group'";} + + if ($lead_order_randomize == 'Y') {$last_order = "RAND()";} + else + { + $last_order = "lead_id asc"; + if ($lead_order_secondary == 'LEAD_ASCEND') {$last_order = "lead_id asc";} + if ($lead_order_secondary == 'LEAD_DESCEND') {$last_order = "lead_id desc";} + if ($lead_order_secondary == 'CALLTIME_ASCEND') {$last_order = "last_local_call_time asc";} + if ($lead_order_secondary == 'CALLTIME_DESCEND') {$last_order = "last_local_call_time desc";} + } + + $order_stmt = ''; + if (eregi("DOWN",$lead_order)){$order_stmt = 'order by lead_id asc';} + if (eregi("UP",$lead_order)){$order_stmt = 'order by lead_id desc';} + if (eregi("UP LAST NAME",$lead_order)){$order_stmt = "order by last_name desc, $last_order";} + if (eregi("DOWN LAST NAME",$lead_order)){$order_stmt = "order by last_name, $last_order";} + if (eregi("UP PHONE",$lead_order)){$order_stmt = "order by phone_number desc, $last_order";} + if (eregi("DOWN PHONE",$lead_order)){$order_stmt = "order by phone_number, $last_order";} + if (eregi("UP COUNT",$lead_order)){$order_stmt = "order by called_count desc, $last_order";} + if (eregi("DOWN COUNT",$lead_order)){$order_stmt = "order by called_count, $last_order";} + if (eregi("UP LAST OPKALD TIME",$lead_order)){$order_stmt = "order by last_local_call_time desc, $last_order";} + if (eregi("DOWN LAST OPKALD TIME",$lead_order)){$order_stmt = "order by last_local_call_time, $last_order";} + if (eregi("RANDOM",$lead_order)){$order_stmt = "order by RAND()";} + if (eregi("UP RANK",$lead_order)){$order_stmt = "order by rank desc, $last_order";} + if (eregi("DOWN RANK",$lead_order)){$order_stmt = "order by rank, $last_order";} + if (eregi("UP OWNER",$lead_order)){$order_stmt = "order by owner desc, $last_order";} + if (eregi("DOWN OWNER",$lead_order)){$order_stmt = "order by owner, $last_order";} + if (eregi("UP TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now desc, $last_order";} + if (eregi("DOWN TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now, $last_order";} + + $stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and user NOT LIKE \"QUEUE%\" and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00242',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + # $fp = fopen ("./DNNdebug_log.txt", "a"); + # fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province|$affected_rows|$stmt|\n"); + # fclose($fp); + + if ($affected_rows > 0) + { + $stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id,vendor_lead_code FROM vicidial_list where user='QUEUE$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";} + $leadpick_ct = mysql_num_rows($rslt); + if ($leadpick_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id = $row[0]; + $list_id = $row[1]; + $gmt_offset_now = $row[2]; + $state = $row[3]; + $entry_list_id = $row[4]; + $vendor_lead_code = $row[5]; + + $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',vendor_lead_code='$vendor_lead_code';"; + 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);} + } + } + } + ########################################################## + ### END find the next lead to dial without looking in the hopper + ########################################################## + # $DB=0; + } + } + } + + if ($affected_rows > 0) + { + if (!$CBleadIDset) + { + ##### grab the lead_id of the reserved user in vicidial_hopper + $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00025',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $hopper_leadID_ct = mysql_num_rows($rslt); + if ($hopper_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + } + } + + ##### 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,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";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $called_since_last_reset = trim("$row[9]"); + $phone_code = trim("$row[10]"); + if ($override_phone < 1) + {$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 = stripslashes(trim("$row[29]")); + $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++; + + if ( (strlen($agent_dialed_type) < 3) or (strlen($agent_dialed_number) < 6) ) + { + $agent_dialed_number = $phone_number; + if (strlen($agent_dialed_type) < 3) + {$agent_dialed_type = 'MAIN';} + } + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + if ($agent_dialed_type=='ALT') + {$agent_dialed_number = $alt_phone;} + if ($agent_dialed_type=='ADDR3') + {$agent_dialed_number = $address3;} + } + + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00414',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $row=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $row[0]; + $local_call_time = $row[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($agent_dialed_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefon and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon Area Code Udenfor Dialable Zone $PHONEgmt_offset ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Postnummer Udenfor Dialable Zone $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon Area Code Udenfor Dialable Zone $PHONEgmt_offset ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Postnummer Udenfor Dialable Zone $POSTgmt_offset ";} + } + } + ##### END check for postal_code and phone time zones if alert enabled + + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00027',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # generate callerID for unique identifier in xfer_log file + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province\n"); + fclose($fp); + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00366',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00367',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or ($dispo == 'CBHOLD') ) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00028',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00029',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $server_ct = mysql_num_rows($rslt); + if ($server_ct > 0) + { + $row=mysql_fetch_row($rslt); + $local_gmt = $row[0]; + $isdst = date("I"); + if ($isdst) {$local_gmt++;} + } + $LLCT_DATE_offset = ($local_gmt - $gmt_offset_now); + $LLCT_DATE = date("Y-m-d H:i:s", mktime(date("H")-$LLCT_DATE_offset,date("i"),date("s"),date("m"),date("d"),date("Y"))); + + if (ereg('Y',$called_since_last_reset)) + { + $called_since_last_reset = ereg_replace('Y','',$called_since_last_reset); + if (strlen($called_since_last_reset) < 1) {$called_since_last_reset = 0;} + $called_since_last_reset++; + $called_since_last_reset = "Y$called_since_last_reset"; + } + else {$called_since_last_reset = 'Y';} + ### flag the lead as called and change it's status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='$called_since_last_reset', called_count='$called_count',user='$user',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00030',$user,$server_ip,$session_name,$one_mysql_log);} + + if (!$CBleadIDset) + { + ### delete the lead from the hopper + $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00031',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00032',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_lists set list_lastcalldate=NOW() where list_id='$list_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);} + + $campaign_cid_override=''; + $LISTweb_form_address=''; + $LISTweb_form_address_two=''; + ### check if there is a list_id override + if (strlen($list_id) > 1) + { + $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two FROM vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00245',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $lio_ct = mysql_num_rows($rslt); + if ($lio_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_cid_override = $row[0]; + $LISTweb_form_address = $row[1]; + $LISTweb_form_address_two = $row[2]; + } + } + + ### if preview dialing, do not send the call + if ( (strlen($preview)<1) || ($preview == 'NO') ) + { + ### prepare variables to place manual call from VICIDiaL + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + # $Local_persist = '/n'; + $Local_persist = ''; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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 == 'AREACODE') + { + $temp_ac = substr("$agent_dialed_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00426',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00427',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$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("%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: MmddhhmmssLLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + $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)) + {$Ndialstring = "$Local_out_prefix$agent_dialed_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$agent_dialed_number";} + + if ( ($usegroupalias > 0) and (strlen($account)>1) ) + { + $RAWaccount = $account; + $account = "Account: $account"; + $variable = "Variable: usegroupalias=1"; + } + else + {$account=''; $variable='';} + + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','$account','$variable','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00033',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$agent_dialed_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00034',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today',external_hangup=0,external_status='',external_pause='',external_dial='',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) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00035',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update calls_today count in vicidial_campaign_agents + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00036',$user,$server_ip,$session_name,$one_mysql_log);} + + # #### update vicidial_agent_log if not MANUAL dial_method + # if ($dial_method != 'MANUAL') + # { + # $pause_sec=0; + # $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00302',$user,$server_ip,$session_name,$one_mysql_log);} + # $VDpr_ct = mysql_num_rows($rslt); + # if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + # { + # $row=mysql_fetch_row($rslt); + # $agent_log_id = $row[5]; + # $pause_sec = (($StarTtime - $row[0]) + $row[1]); + # + # $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + # if ($format=='debug') {echo "\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} + # } + # } + + + $val_pause_epoch=0; + $val_pause_sec=0; + $stmt = "SELECT pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00323',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) + { + $row=mysql_fetch_row($rslt); + $val_pause_epoch = $row[0]; + $val_pause_sec = ($StarTtime - $val_pause_epoch); + } + + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00324',$user,$server_ip,$session_name,$one_mysql_log);} + + + if ($agent_dialed_number > 0) + { + $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$agent_dialed_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00191',$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_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00037',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + 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]; + $queuemetrics_pe_phone_append = $row[6]; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00389',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # UNPAUSEALL + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00038',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + # OPKALDOUTBOUND (formerly ENTERQUEUE) + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$agent_dialed_number',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00039',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + # CONNECT + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00040',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + } + + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_lists WHERE list_id='$list_id' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00259',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vls_vc_ct = mysql_num_rows($rslt); + if ($vls_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='$list_id' and vs.script_id=vls.agent_script_override and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00260',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + } + } + + ### Check for List ID override settings + $VDCL_xferconf_a_number=''; + $VDCL_xferconf_b_number=''; + $VDCL_xferconf_c_number=''; + $VDCL_xferconf_d_number=''; + $VDCL_xferconf_e_number=''; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00277',$user,$server_ip,$session_name,$one_mysql_log);} + $VC_preset_ct = mysql_num_rows($rslt); + if ($VC_preset_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_xferconf_a_number = $row[0]; + $VDCL_xferconf_b_number = $row[1]; + $VDCL_xferconf_c_number = $row[2]; + $VDCL_xferconf_d_number = $row[3]; + $VDCL_xferconf_e_number = $row[4]; + } + + if (strlen($list_id)>0) + { + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_preset_ct = mysql_num_rows($rslt); + if ($VDIG_preset_ct > 0) + { + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 0) + {$VDCL_xferconf_a_number = $row[0];} + if (strlen($row[1]) > 0) + {$VDCL_xferconf_b_number = $row[1];} + if (strlen($row[2]) > 0) + {$VDCL_xferconf_c_number = $row[2];} + if (strlen($row[3]) > 0) + {$VDCL_xferconf_d_number = $row[3];} + 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); + } + } + } + + + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $MqueryCID . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $agent_dialed_number . "\n"; + $LeaD_InfO .= $agent_dialed_type . "\n"; + $LeaD_InfO .= $source_id . "\n"; + $LeaD_InfO .= $rank . "\n"; + $LeaD_InfO .= $owner . "\n"; + $LeaD_InfO .= "\n"; + $LeaD_InfO .= $script_recording_delay . "\n"; + $LeaD_InfO .= $VDCL_xferconf_a_number . "\n"; + $LeaD_InfO .= $VDCL_xferconf_b_number . "\n"; + $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"; + $LeaD_InfO .= $LISTweb_form_address . "\n"; + $LeaD_InfO .= $LISTweb_form_address_two . "\n"; + $LeaD_InfO .= $post_phone_time_diff_alert_message . "\n"; + + echo $LeaD_InfO; + } + else + { + echo "HOPPER TOM\n"; + } + } + } + + +################################################################################ +### alt_phone_change - change alt phone numbers to active and inactive +### +################################################################################ +if ($ACTION == 'alt_phone_change') +{ + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) || (strlen($phone_number)<1) ) + { + $channel_live=0; + echo "ALT TELEFONNUMMER NUMMER STATUS NOT CHANGED\n"; + echo "$phone_number $stage $lead_id or $called_count er ikke valid\n"; + exit; + } + else + { + $stmt = "UPDATE vicidial_list_alt_phones set active='$stage' where lead_id='$lead_id' and phone_number='$phone_number' and alt_phone_count='$called_count';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00041',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "ALT TELEFONNUMMER NUMMER STATUS CHANGED\n"; + } +} + + +################################################################################ +### AlertControl - change the agent alert setting in vicidial_users +### +################################################################################ +if ($ACTION == 'AlertControl') +{ + if (strlen($stage)<1) + { + $channel_live=0; + echo "AGENT ALERT SETTING NOT CHANGED\n"; + echo "$stage er ikke valid\n"; + exit; + } + else + { + if (ereg('ON',$stage)) {$stage = '1';} + else {$stage = '0';} + + $stmt = "UPDATE vicidial_users set alert_enabled='$stage' where user='$user' and pass='$pass';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'000185',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "AGENT ALERT SETTING CHANGED $stage\n"; + } +} + + +################################################################################ +### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was +### previewed in the step above and puts it back in orig status +################################################################################ +if ($ACTION == 'manDiaLskip') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "LEAD NOT REVERTED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context er ikke valid\n"; + exit; + } + else + { + $called_count = ($called_count - 1); + ### set the lead back to previous status and called_count + $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00042',$user,$server_ip,$session_name,$one_mysql_log);} + + ### log the skip event + $stmt = "INSERT INTO vicidial_agent_skip_log set campaign_id='$campaign', previous_status='$stage', previous_called_count='$called_count',user='$user', lead_id='$lead_id', event_date=NOW();"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00419',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "LEAD REVERTED\n"; + } + } + + +################################################################################ +### manDiaLonly - for manual VICIDiaL dialing this sends the call that was +### previewed in the step above +################################################################################ +if ($ACTION == 'manDiaLonly') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) || (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo " OPKALD NOT PLACED\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context er ikke valid\n"; + exit; + } + else + { + ##### clear out last call to same lead if exists ##### + if (strlen($old_CID) > 16) + { + $old_lead_id = substr($old_CID, -10); + $old_lead_id = ($old_lead_id + 0); + if ($lead_id == "$old_lead_id") + { + $stmt="DELETE FROM vicidial_auto_calls where callerid='$old_CID' and lead_id='$old_lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00428',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + + ##### grab number of calls today in this campaign and increment + $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";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $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=''; + $LISTweb_form_address=''; + $LISTweb_form_address_two=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + $Local_persist = '/n'; + if ($dial_timeout > 4) {$Local_dial_timeout = $dial_timeout;} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} + if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} + if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';} + $campaign_cid_override=''; + ### check if there is a list_id override + if (strlen($lead_id) > 1) + { + $list_id=''; + $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00246',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $lio_ct = mysql_num_rows($rslt); + if ($lio_ct > 0) + { + $row=mysql_fetch_row($rslt); + $list_id = $row[0]; + + if (strlen($list_id) > 1) + { + $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two FROM vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00247',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $lio_ct = mysql_num_rows($rslt); + if ($lio_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_cid_override = $row[0]; + $LISTweb_form_address = $row[1]; + $LISTweb_form_address_two = $row[2]; + } + } + } + } + if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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 == 'AREACODE') + { + $temp_ac = substr("$phone_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00429',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00430',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$temp_CID = preg_replace("/\D/",'',$security);} + if (strlen($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} + } + + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} + + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL + $MqueryCID = "M$CIDdate$PADlead_id"; + $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) ) + { + $RAWaccount = $account; + $account = "Account: $account"; + $variable = "Variable: usegroupalias=1"; + } + else + {$account=''; $variable='';} + + ### whether to omit phone_code or not + if (eregi('Y',$omit_phone_code)) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + ### insert the call action into the vicidial_manager table to initiate the call + # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','$account','$variable','','');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00044',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00045',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today',external_hangup=0,external_status='',external_pause='',external_dial='',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,'00046',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9046$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00047',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "$MqueryCID\n"; + +# #### update vicidial_agent_log if not MANUAL dial_method +# if ($dial_method != 'MANUAL') +# { +# $pause_sec=0; +# $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00304',$user,$server_ip,$session_name,$one_mysql_log);} +# $VDpr_ct = mysql_num_rows($rslt); +# if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) +# { +# $row=mysql_fetch_row($rslt); +# $agent_log_id = $row[5]; +# $pause_sec = (($StarTtime - $row[0]) + $row[1]); +# +# $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} +# } +# } + + $val_pause_epoch=0; + $val_pause_sec=0; + $val_dispo_epoch=0; + $val_dispo_sec=0; + $val_wait_epoch=0; + $val_wait_sec=0; + $stmt = "SELECT dispo_epoch,wait_epoch,pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00326',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) + { + $row=mysql_fetch_row($rslt); + $val_dispo_epoch = $row[0]; + $val_wait_epoch = $row[1]; + $val_pause_epoch = $row[2]; + $val_dispo_sec = ($StarTtime - $val_dispo_epoch); + $val_wait_sec = ($StarTtime - $val_wait_epoch); + $val_pause_sec = ($StarTtime - $val_pause_epoch); + } + if ($val_dispo_epoch > 1000) + { + $stmt="UPDATE vicidial_agent_log set status='ALTNUM',dispo_sec='$val_dispo_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00327',$user,$server_ip,$session_name,$one_mysql_log);} + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00328',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','ANDIAL');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00329',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id',last_state_change='$NOW_TIME' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00330',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); + } + else + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00331',$user,$server_ip,$session_name,$one_mysql_log);} + } + + echo "$agent_log_id\n"; + + + if ($agent_dialed_number > 0) + { + $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$phone_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; + 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);} + } + + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00048',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + 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]; + $queuemetrics_pe_phone_append = $row[6]; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00390',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + # UNPAUSEALL + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00049',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + # OPKALDOUTBOUND (formerly ENTERQUEUE) + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00050',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + # CONNECT + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00051',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + + } + } + + +################################################################################ +### manDiaLlookCaLL - for manual VICIDiaL dialing this will attempt to look up +### the trunk channel that the call was placed on +################################################################################ +if ($ACTION == 'manDiaLlookCaLL') + { + $MT[0]=''; + $row=''; $rowx=''; + $call_good=0; + if (strlen($MDnextCID)<18) + { + echo "NO\n"; + echo "MDnextCID $MDnextCID er ikke valid\n"; + exit; + } + else + { + ##### look for the channel in the UPDATED vicidial_manager record of the call initiation + $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status IN('UPDATED','DEAD') LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00052',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid =$row[0]; + $channel =$row[1]; + $call_output = "$uniqueid\n$channel\n"; + $call_good++; + } + else + { + ### after 10 sekunder, start checking for call termination in the carrier log + if ( ($DiaL_SecondS > 0) and (preg_match("/0$/",$DiaL_SecondS)) ) + { + $stmt="SELECT uniqueid,channel,end_epoch FROM call_log where caller_code='$MDnextCID' and server_ip='$server_ip' order by start_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00291',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VM_mancallX_ct = mysql_num_rows($rslt); + if ($VM_mancallX_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid = $row[0]; + $channel = $row[1]; + $end_epoch = $row[2]; + + ### Check carrier log for error + $stmt="SELECT dialstatus,hangup_cause FROM vicidial_carrier_log where uniqueid='$uniqueid' and server_ip='$server_ip' and channel='$channel' and dialstatus IN('BUSY','CHANUNAVAIL','CONGESTION') LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00292',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $CL_mancall_ct = mysql_num_rows($rslt); + if ($CL_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dialstatus =$row[0]; + $hangup_cause =$row[1]; + + $channel = $dialstatus; + $hangup_cause_msg = "Cause: " . $hangup_cause . " - " . hangup_cause_description($hangup_cause); + + $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg; + $call_good++; + + ### Delete call record + $stmt="DELETE from vicidial_auto_calls where callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00293',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00399',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + } + } + + if ($call_good > 0) + { + $wait_sec=0; + $dead_epochSQL = ''; + $stmt = "SELECT wait_epoch,wait_sec,dead_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,'00053',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + $now_dead_epoch = $row[2]; + if ( ($now_dead_epoch > 1000) and ($now_dead_epoch < $StarTtime) ) + {$dead_epochSQL = ",dead_epoch='$StarTtime'";} + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' $dead_epochSQL where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00054',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_auto_calls set uniqueid='$uniqueid',channel='$channel' where callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00055',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE call_log set uniqueid='$uniqueid',channel='$channel' where caller_code='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00300',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "$call_output"; + } + else + {echo "NO\n$DiaL_SecondS\n";} + } + } + + + +################################################################################ +### manDiaLlogCALL - for manual VICIDiaL logging of calls places record in +### vicidial_log and then sends process to call_log entry +################################################################################ +if ($ACTION == 'manDiaLlogCaLL') +{ + $MT[0]=''; + $row=''; $rowx=''; + $vidSQL=''; + $VDterm_reason=''; + +if ($stage == "start") + { + if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) ) + { + 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 "INTET I LOGGEN\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign er ikke valid\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00056',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$uniqueid',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00400',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + + $manualVLexists=0; + $beginUNIQUEID = preg_replace("/\..*/","",$uniqueid); + $stmt="SELECT count(*) from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00223',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VL_exists_ct = mysql_num_rows($rslt); + if ($VL_exists_ct > 0) + { + $row=mysql_fetch_row($rslt); + $manualVLexists = $row[0]; + } + + $manualVLexistsDUP=0; + if ($manualVLexists < 1) + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group,alt_dial) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group','$alt_dial');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00279',$user,$server_ip,$session_name,$one_mysql_log);} + $DUPerrno = mysql_errno($link); + if ($DUPerrno > 0) + {$manualVLexistsDUP=1;} + $affected_rows = mysql_affected_rows($link); + } + if ( ($manualVLexists > 0) or ($manualVLexistsDUP > 0) ) + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="UPDATE vicidial_log SET list_id='$list_id',comments='MANUAL',user_group='$user_group',alt_dial='$alt_dial' where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00224',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + } + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Indsat: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "INTET I LOGGEN\n"; + } + + $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00058',$user,$server_ip,$session_name,$one_mysql_log);} + + # ##### insert log into call_log for manual VICIDiaL call + # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # $affected_rows = mysql_affected_rows($link); + + # if ($affected_rows > 0) + # { + # echo "CALL_LOG Indsat: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "INTET I LOGGEN\n"; + # } + } + } + +if ($stage == "end") + { + $status_dispo = 'DISPO'; + if ($alt_num_status > 0) + {$status_dispo = 'ALTNUM';} + ##### get call type from vicidial_live_agents table + $VLA_inOUT='NONE'; + $stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00059',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLA_inOUT_ct = mysql_num_rows($rslt); + if ($VLA_inOUT_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VLA_inOUT = $row[0]; + } + + if ( (strlen($uniqueid)<1) and ($VLA_inOUT == 'INBOUND') ) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND_LOG_0|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$start_epoch|$phone_number|$agent_log_id|\n"); + fclose($fp); + $uniqueid='6666.1'; + } + if ( (strlen($uniqueid)<1) or (strlen($lead_id)<1) ) + { + echo "INTET I LOGGEN\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id er ikke valid\n"; + exit; + } + else + { + $term_reason='NONE'; + if ($start_epoch < 1000) + { + if ($VLA_inOUT == 'INBOUND') + { + $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,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,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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00060',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch = $row[0]; + $VDterm_reason = $row[1]; + $VDvicidial_id = $row[2]; + $VDcampaign_id = $row[3]; + $VDstatus = $row[4]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + + if ( ($length_in_sec < 1) and ($VLA_inOUT == 'INBOUND') ) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND_LOG_1|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$start_epoch|\n"); + fclose($fp); + + ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log + $stmt="SELECT start_epoch,term_reason,campaign_id,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00061',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VM_mancall_ct = mysql_num_rows($rslt); + if ($VM_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $start_epoch = $row[0]; + $VDterm_reason = $row[1]; + $VDcampaign_id = $row[2]; + $VDstatus = $row[3]; + $length_in_sec = ($StarTtime - $start_epoch); + } + else + { + $length_in_sec = 0; + } + } + } + else {$length_in_sec = ($StarTtime - $start_epoch);} + + if (strlen($VDcampaign_id)<1) {$VDcampaign_id = $campaign;} + + $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 ($VLA_inOUT == 'INBOUND') + { + $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);} + $affected_rows = mysql_affected_rows($link); + 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 + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND_LOG_2|$uniqueid|$lead_id|$user|$inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$start_epoch|\n"); + fclose($fp); + } + } + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00063',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + 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]; + $queuemetrics_dispo_pause = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; + + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + } + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + + if ($auto_dial_level > 0) + { + ### check to see if campaign has alt_dial enabled + $stmt="SELECT auto_alt_dial,use_internal_dnc,use_campaign_dnc FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00064',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_alt_dial = $row[0]; + $use_internal_dnc = $row[1]; + $use_campaign_dnc = $row[2]; + } + else {$auto_alt_dial = 'NONE';} + if (eregi("(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED|ALT_AND_ADDR3_AND_EXTENDED|EXTENDED_ONLY)",$auto_alt_dial)) + { + ### check to see if lead should be alt_dialed + if (strlen($alt_dial)<2) {$alt_dial = 'NONE';} + + ### check if inbound call, if so find a recent outbound call to pull alt_dial value from + if ($VLA_inOUT == 'INBOUND') + { + $one_hour_ago = date("Y-m-d H:i:s", mktime(date("H")-1,date("i"),date("s"),date("m"),date("d"),date("Y"))); + ##### find a recent outbound call associated with this inbound call + $stmt="SELECT alt_dial FROM vicidial_log where lead_id='$lead_id' and status IN('DROP','XDROP') and call_date > \"$one_hour_ago\" order by call_date desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00235',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VL_alt_ct = mysql_num_rows($rslt); + if ($VL_alt_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial = $row[0]; + } + } + + if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)",$auto_alt_dial)) ) + { + $alt_dial_skip=0; + $stmt="SELECT alt_phone,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00065',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone = $row[0]; + $alt_phone = eregi_replace("[^0-9]","",$alt_phone); + $gmt_offset_now = $row[1]; + $state = $row[2]; + $vendor_lead_code = $row[3]; + } + else {$alt_phone = '';} + if (strlen($alt_phone)>5) + { + if ( (ereg("Y",$use_internal_dnc)) or (ereg("AREACODE",$use_internal_dnc)) ) + { + if (ereg("AREACODE",$use_internal_dnc)) + { + $alt_phone_areacode = substr($alt_phone, 0, 3); + $alt_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_dnc where phone_number IN('$alt_phone','$alt_phone_areacode');"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$alt_phone';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00066',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_dnc_ct = mysql_num_rows($rslt); + if ($VLAP_dnc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VD_alt_dnc_count = $row[0]; + } + } + else {$VD_alt_dnc_count=0;} + if ( (ereg("Y",$use_campaign_dnc)) or (ereg("AREACODE",$use_campaign_dnc)) ) + { + if (ereg("AREACODE",$use_campaign_dnc)) + { + $alt_phone_areacode = substr($alt_phone, 0, 3); + $alt_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$alt_phone','$alt_phone_areacode') and campaign_id='$campaign';"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$alt_phone' and campaign_id='$campaign';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00067',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_cdnc_ct = mysql_num_rows($rslt); + if ($VLAP_cdnc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VD_alt_dnc_count = ($VD_alt_dnc_count + $row[0]); + } + } + 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',source='A',vendor_lead_code='$vendor_lead_code';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00068',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {$alt_dial_skip=1;} + } + else + {$alt_dial_skip=1;} + if ($alt_dial_skip > 0) + {$alt_dial='ALT';} + } + + if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) + { + $addr3_dial_skip=0; + $stmt="SELECT address3,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00069',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_mancall_ct = mysql_num_rows($rslt); + if ($VAC_mancall_ct > 0) + { + $row=mysql_fetch_row($rslt); + $address3 = $row[0]; + $address3 = eregi_replace("[^0-9]","",$address3); + $gmt_offset_now = $row[1]; + $state = $row[2]; + $vendor_lead_code = $row[3]; + } + else {$address3 = '';} + if (strlen($address3)>5) + { + if ( (ereg("Y",$use_internal_dnc)) or (ereg("AREACODE",$use_internal_dnc)) ) + { + if (ereg("AREACODE",$use_internal_dnc)) + { + $addr3_phone_areacode = substr($address3, 0, 3); + $addr3_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_dnc where phone_number IN('$address3','$addr3_phone_areacode');"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$address3';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00070',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_dnc_ct = mysql_num_rows($rslt); + if ($VLAP_dnc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VD_alt_dnc_count = $row[0]; + } + } + else {$VD_alt_dnc_count=0;} + if ( (ereg("Y",$use_campaign_dnc)) or (ereg("AREACODE",$use_campaign_dnc)) ) + { + if (ereg("AREACODE",$use_campaign_dnc)) + { + $addr3_phone_areacode = substr($address3, 0, 3); + $addr3_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$address3','$addr3_phone_areacode') and campaign_id='$campaign';"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$address3' and campaign_id='$campaign';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00071',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_cdnc_ct = mysql_num_rows($rslt); + if ($VLAP_cdnc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VD_alt_dnc_count = ($VD_alt_dnc_count + $row[0]); + } + } + 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',source='A',vendor_lead_code='$vendor_lead_code';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00072',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {$addr3_dial_skip=1;} + } + else + {$addr3_dial_skip=1;} + if ($addr3_dial_skip > 0) + {$alt_dial='ADDR3';} + } + + # $fp = fopen ("./alt_multi_log.txt", "a"); + # fwrite ($fp, "$NOW_TIME|PRE-X|$campaign|$lead_id|$phone_number|$user|$Ctype|$callerid|$uniqueid|$stmt|$auto_alt_dial|$alt_dial\n"); + # fclose($fp); + + if ( ( ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("EXTENDED_ONLY",$auto_alt_dial)) ) or ( (eregi("(ALT)",$alt_dial)) and (eregi("(ALT_AND_EXTENDED)",$auto_alt_dial)) ) or ( (eregi("(ADDR3)",$alt_dial)) and (eregi("(ADDR3_AND_EXTENDED|ALT_AND_ADDR3_AND_EXTENDED)",$auto_alt_dial)) ) or ( (eregi("(X)",$alt_dial)) and (eregi("EXTENDED",$auto_alt_dial)) ) ) and (!eregi("LAST",$alt_dial)) ) + { + if (eregi("(ADDR3)",$alt_dial)) {$Xlast=0;} + else + {$Xlast = ereg_replace("[^0-9]","",$alt_dial);} + if (strlen($Xlast)<1) + {$Xlast=0;} + $VD_altdialx=''; + + $stmt="SELECT gmt_offset_now,state,list_id,entry_list_id,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00073',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VL_deailts_ct = mysql_num_rows($rslt); + if ($VL_deailts_ct > 0) + { + $row=mysql_fetch_row($rslt); + $EA_gmt_offset_now = $row[0]; + $EA_state = $row[1]; + $EA_list_id = $row[2]; + $EA_entry_list_id = $row[3]; + $EA_vendor_lead_code = $row[4]; + } + $alt_dial_phones_count=0; + $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00074',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_ct = mysql_num_rows($rslt); + if ($VLAP_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_dial_phones_count = $row[0]; + } + while ( ($alt_dial_phones_count > 0) and ($alt_dial_phones_count > $Xlast) ) + { + $Xlast++; + $stmt="SELECT alt_phone_id,phone_number,active FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Xlast';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00075',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_detail_ct = mysql_num_rows($rslt); + if ($VLAP_detail_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VD_altdial_id = $row[0]; + $VD_altdial_phone = $row[1]; + $VD_altdial_active = $row[2]; + } + else + {$Xlast=9999999999;} + + if (ereg("Y",$VD_altdial_active)) + { + if ( (ereg("Y",$use_internal_dnc)) or (ereg("AREACODE",$use_internal_dnc)) ) + { + if (ereg("AREACODE",$use_internal_dnc)) + { + $vdap_phone_areacode = substr($VD_altdial_phone, 0, 3); + $vdap_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_dnc where phone_number IN('$VD_altdial_phone','$vdap_phone_areacode');"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_altdial_phone';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00076',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_dnc_ct = mysql_num_rows($rslt); + if ($VLAP_dnc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VD_alt_dnc_count = $row[0]; + } + } + else {$VD_alt_dnc_count=0;} + if ( (ereg("Y",$use_campaign_dnc)) or (ereg("AREACODE",$use_campaign_dnc)) ) + { + if (ereg("AREACODE",$use_campaign_dnc)) + { + $vdap_phone_areacode = substr($VD_altdial_phone, 0, 3); + $vdap_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$VD_altdial_phone','$vdap_phone_areacode') and campaign_id='$campaign';"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_altdial_phone' and campaign_id='$campaign';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00077',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLAP_cdnc_ct = mysql_num_rows($rslt); + if ($VLAP_cdnc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VD_alt_dnc_count = ($VD_alt_dnc_count + $row[0]); + } + } + if ($VD_alt_dnc_count < 1) + { + 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',source='A',vendor_lead_code='$EA_vendor_lead_code';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00078',$user,$server_ip,$session_name,$one_mysql_log);} + $Xlast=9999999999; + } + } + } + } + } + + if ($enable_queuemetrics_logging > 0) + { + ### grab call lead information needed for QM logging + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00079',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER' and queue='$VDcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00080',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + + if ($caller_complete < 1) + { + $term_reason='AGENT'; + } + else + { + $term_reason='CALLER'; + } + + } + + if ($nodeletevdac < 1) + { + ### delete call record from vicidial_auto_calls + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$VDcampaign_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00081',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $licf_SQL = ''; + if ($VLA_inOUT == 'INBOUND') + {$licf_SQL = ",last_inbound_call_finish='$NOW_TIME'";} + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' $licf_SQL where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00082',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9082$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00391',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00083',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + } + } + else + { + if ($enable_queuemetrics_logging > 0) + { + $CLqueue_position=1; + ### check to see if lead should be alt_dialed + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid,queue_position from vicidial_auto_calls where lead_id='$lead_id' order by call_time desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00084',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + $CLqueue_position = $row[10]; + } + + $CLstage = preg_replace("/XFER|CLOSER|-/",'',$CLstage); + if ($CLstage < 0.25) {$CLstage=0;} + + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00392',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00085',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + + if ($nodeletevdac < 1) + { + # $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';"; + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$VDcampaign_id' and callerid LIKE \"M%\";"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00086',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',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,'00087',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9087$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + $affected_rows = mysql_affected_rows($link); + if ($affected_rows > 0) + { + if ($enable_queuemetrics_logging > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00088',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + } + } + + if ( ($VLA_inOUT == 'AUTO') or ($VLA_inOUT == 'MANUAL') ) + { + $SQLterm = "term_reason='$term_reason',"; + + if ( (ereg("NONE",$term_reason)) or (ereg("NONE",$VDterm_reason)) or (strlen($VDterm_reason) < 1) ) + { + ### check to see if lead should be alt_dialed + $stmt="SELECT term_reason,uniqueid,status from vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00089',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDterm_reason = $row[0]; + $VDvicidial_id = $row[1]; + $VDstatus = $row[2]; + $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; + } + if (ereg("CALLER",$VDterm_reason)) + { + $SQLterm = ""; + } + else + { + $SQLterm = "term_reason='AGENT',"; + } + } + + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$uniqueid',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00401',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + + ### check to see if the vicidial_log record exists, if not, insert it + $manualVLexists=0; + $beginUNIQUEID = preg_replace("/\..*/","",$uniqueid); + $stmt="SELECT status from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00223',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $manualVLexists = mysql_num_rows($rslt); + if ($manualVLexists > 0) + { + $row=mysql_fetch_row($rslt); + $VDstatus = $row[0]; + } + + if ($manualVLexists < 1) + { + ##### insert log into vicidial_log for manual VICIDiaL call + $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group,alt_dial) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','DONEM','$phone_code','$phone_number','$user','MANUAL','N','$user_group','$alt_dial');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00280',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "VICIDiaL_LOG Indsat: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "INTET I LOGGEN\n"; + } + } + else + { + $stmt="UPDATE vicidial_log SET uniqueid='$uniqueid' where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00057',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + } + + ##### update the duration and end time in the vicidial_log table + if ($VDstatus == 'INCALL') {$vl_statusSQL = ",status='$status_dispo'";} + $stmt="UPDATE vicidial_log set $SQLterm end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vl_statusSQL where uniqueid='$uniqueid' and lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00090',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + if ($affected_rows > 0) + { + echo "$uniqueid\n$channel\n"; + } + else + { + echo "INTET I LOGGEN\n\n"; + } + } + else + { + $SQLterm = "term_reason='$term_reason'"; + $QL_term=''; + + if ( (ereg("NONE",$term_reason)) or (ereg("NONE",$VDterm_reason)) or (strlen($VDterm_reason) < 1) ) + { + ### find out who hung up the call + $stmt="SELECT term_reason,closecallid,queue_position from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00091',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDterm_reason = $row[0]; + $VDvicidial_id = $row[1]; + $VDqueue_position = $row[2]; + $VDIDselect = "VDCL_LID4HOUR $lead_id $four_hours_ago"; + } + if (ereg("CALLER",$VDterm_reason)) + { + $SQLterm = ""; + } + else + { + $SQLterm = "term_reason='AGENT'"; + $QL_term = 'COMPLETEAGENT'; + } + } + + if (strlen($SQLterm) > 0) + { + ##### update the duration and end time in the vicidial_log table + $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00092',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + } + + if ($enable_queuemetrics_logging > 0) + { + if ( (strlen($QL_term) > 0) and ($leaving_threeway > 0) ) + { + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETEAGENT' and queue='$VDcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00093',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $agent_complete = $row[0]; + } + if ($agent_complete < 1) + { + if (strlen($VDqueue_position) < 1) + { + ### find out who hung up the call + $stmt="SELECT queue_position from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00273',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDqueue_position = $row[0]; + } + } + if (strlen($VDqueue_position) < 1) + {$VDqueue_position=1;} + + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00393',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$VDqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00094',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + } + } + } + } + + echo $VDstop_rec_after_each_call . '|' . $extension . '|' . $conf_silent_prefix . '|' . $conf_exten . '|' . $user_abb . "|\n"; + + ##### if VICIDiaL call and hangup_after_each_call activated, find all recording + ##### channels and hang them up while entering info into recording_log and + ##### returning filename/recordingID + if ($VDstop_rec_after_each_call == 1) + { + $local_DEF = 'Local/'; + $local_AMP = '@'; + $total_rec=0; + $total_hangup=0; + $loop_count=0; + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00095',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + else + { + # if (preg_match("/$agentchannel/i",$row[0])) + if ( ($agentchannel == "$row[0]") or (ereg('ASTblind',$row[0])) ) + { + $donothing=1; + } + else + { + $hangup_channels[$total_hangup] = "$row[0]"; + $total_hangup++; + } + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + $loop_count=0; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00184',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + else + { + # if (preg_match("/$agentchannel/i",$row[0])) + if ( ($agentchannel == "$row[0]") or (ereg('ASTblind',$row[0])) ) + { + $donothing=1; + } + else + { + $hangup_channels[$total_hangup] = "$row[0]"; + $total_hangup++; + } + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + + ### if a conference call or 3way call was attempted, then hangup all channels except for the agentchannel + if ( ( ($conf_dialed > 0) or ($hangup_all_non_reserved > 0) ) and ($leaving_threeway < 1) and ($blind_transfer < 1) ) + { + $loop_count=0; + while($loop_count < $total_hangup) + { + if (strlen($hangup_channels[$loop_count])>5) + { + $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);} + } + $loop_count++; + } + } + + $total_recFN=0; + $loop_count=0; + $filename=$MT; # not necessary : and cmd_line_f LIKE \"%_$user_abb\" + $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00097',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$recFN_list = mysql_num_rows($rslt);} + while ($recFN_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + $filename[$total_recFN] = preg_replace("/Callerid: /i","",$row[0]); + if ($format=='debug') {echo "\n";} + $total_recFN++; + $loop_count++; + } + + $loop_count=0; + while($loop_count < $total_rec) + { + if (strlen($rec_channels[$loop_count])>5) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00098',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; + if (strlen($filename[$loop_count])>2) + { + $stmt="SELECT recording_id,start_epoch,vicidial_id,lead_id FROM recording_log where filename='$filename[$loop_count]'"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00099',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$fn_count = mysql_num_rows($rslt);} + if ($fn_count) + { + $row=mysql_fetch_row($rslt); + $recording_id = $row[0]; + $start_time = $row[1]; + $vicidial_id = $row[2]; + $RClead_id = $row[3]; + + if ( (strlen($RClead_id)<1) or ($RClead_id < 1) or ($RClead_id=='NULL') ) + {$lidSQL = ",lead_id='$lead_id'";} + if (strlen($vicidial_id)<1) + {$vidSQL = ",vicidial_id='$VDvicidial_id'";} + else + { + if ( (ereg('.',$vicidial_id)) and ($VLA_inOUT == 'INBOUND') ) + { + if (!ereg('.',$VDvicidial_id)) + {$vidSQL = ",vicidial_id='$VDvicidial_id'";} + + 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); + $length_in_min = ($length_in_sec / 60); + $length_in_min = sprintf("%8.2f", $length_in_min); + + $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' $vidSQL $lidSQL where filename='$filename[$loop_count]' and end_epoch is NULL;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00100',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "$recording_id|$length_in_min|"; + + # $fp = fopen ("./recording_debug_$NOW_DATE$txt", "a"); + # fwrite ($fp, "$NOW_TIME|RECORD_LOG|$filename[$loop_count]|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|$VDIDselect|\n"); + # fclose($fp); + } + else {echo "||";} + } + else {echo "||";} + echo "\n"; + } + $loop_count++; + } + } + + + $talk_sec=0; + $talk_epochSQL=''; + $dead_secSQL=''; + $lead_id_commentsSQL=''; + $StarTtime = date("U"); + $stmt = "SELECT talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_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,'00101',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + if ( (eregi("NULL",$row[0])) or ($row[0] < 1000) ) + { + $talk_epochSQL=",talk_epoch='$StarTtime'"; + $row[0]=$row[3]; + } + if ( (!eregi("NULL",$row[6])) and ($row[6] > 1000) ) + { + $dead_sec = ($StarTtime - $row[6]); + if ($dead_sec < 0) {$dead_sec=0;} + $dead_secSQL=",dead_sec='$dead_sec'"; + } + $talk_sec = (($StarTtime - $row[0]) + $row[1]); + if ( ( ($auto_dial_level < 1) or (preg_match('/^M/',$MDnextCID)) ) and (preg_match('/INBOUND_MAN/',$dial_method)) ) + { + if ( (eregi("NULL",$row[5])) or (strlen($row[5]) < 1) ) + { + $lead_id_commentsSQL .= ",comments='MANUAL'"; + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1) or (strlen($row[4]) < 1) ) + { + $lead_id_commentsSQL .= ",lead_id='$lead_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);} + + ### update vicidial_carrier_log to match uniqueIDs + $beginUNIQUEID = preg_replace("/\..*/","",$uniqueid); + $stmt="UPDATE vicidial_carrier_log set uniqueid='$uniqueid' where lead_id='$lead_id' and uniqueid LIKE \"$beginUNIQUEID%\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00299',$user,$server_ip,$session_name,$one_mysql_log);} + + ### if queuemetrics_dispo_pause dispo tag is enabled, log it here + if (strlen($queuemetrics_dispo_pause) > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$queuemetrics_dispo_pause';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00364',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + } +} + + +################################################################################ +### VDADREcheckINCOMING - for auto-dial VICIDiaL dialing this will recheck for +### calls to see if the channel has updated +################################################################################ +if ($ACTION == 'VDADREcheckINCOMING') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || (strlen($lead_id)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Kampanje $campaign er ikke valid\n"; + echo "lead_id $lead_id er ikke valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00103',$user,$server_ip,$session_name,$one_mysql_log);} + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + } + } + } + + +################################################################################ +### VDADcheckINCOMING - for auto-dial VICIDiaL dialing this will check for calls +### in the vicidial_live_agents table in QUEUE status, then +### lookup the lead info and pass it back to vicidial.php +################################################################################ +if ($ACTION == 'VDADcheckINCOMING') + { + $VDCL_ingroup_recording_override = ''; + $VDCL_ingroup_rec_filename = ''; + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + $alt_phone_code=''; + $alt_phone_number=''; + $alt_phone_note=''; + $alt_phone_active=''; + $alt_phone_count=''; + $INclosecallid=''; + $INxfercallid=''; + + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) + { + $channel_live=0; + echo "0\n"; + echo "Kampanje $campaign er ikke valid\n"; + exit; + } + else + { + ### grab the call and lead info from the vicidial_live_agents table + $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip,comments FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00104',$user,$server_ip,$session_name,$one_mysql_log);} + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $lead_id =$row[0]; + $uniqueid =$row[1]; + $callerid =$row[2]; + $channel =$row[3]; + $call_server_ip =$row[4]; + $VLAcomments=$row[5]; + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + ##### grab number of calls today in this campaign and increment + $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00105',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysql_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',calls_today='$calls_today',external_hangup=0,external_status='',external_pause='',external_dial='',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,'00106',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9106$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00107',$user,$server_ip,$session_name,$one_mysql_log);} + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT 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";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = 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 = stripslashes(trim("$row[29]")); + $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 + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00368',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00369',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or ($dispo == 'CBHOLD') ) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00109',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00110',$user,$server_ip,$session_name,$one_mysql_log);} + + ### 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,full_name FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + $fullname = $row[1]; + } + + $stmt = "SELECT campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00112',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAC_cid_ct = mysql_num_rows($rslt); + if ($VDAC_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + $dialed_number =$row[1]; + $dialed_label =$row[2]; + $call_type =$row[3]; + if ( ($dialed_number != $phone_number) and (strlen($dialed_label) < 3) ) + { + if ($dialed_number != $alt_phone) + { + if ($dialed_number != $address3) + { + $dialed_label = 'X1'; + $stmt = "SELECT alt_phone_count from vicidial_list_alt_phones where lead_id='$lead_id' and phone_number = '$dialed_number' order by alt_phone_count limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00248',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAP_cid_ct = mysql_num_rows($rslt); + if ($VDAP_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $Xalt_phone_count =$row[0]; + + $stmt = "SELECT count(*) from vicidial_list_alt_phones where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00249',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAPct_cid_ct = mysql_num_rows($rslt); + if ($VDAPct_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $COUNTalt_phone_count =$row[0]; + + if ($COUNTalt_phone_count <= $Xalt_phone_count) + {$dialed_label = 'XLAST';} + else + {$dialed_label = "X$Xalt_phone_count";} + } + + } + } + else + {$dialed_label = 'ADDR3';} + } + else + {$dialed_label = 'ALT';} + } + } + else + { + $dialed_number = $phone_number; + $dialed_label = 'MAIN'; + if (preg_match('/^M|^V/',$callerid)) + { + $call_type = 'OUT'; + $VDADchannel_group = $campaign; + } + else + { + $call_type = 'IN'; + $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);} + $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]; + } + } + 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|$INclosecallid|$INxfercallid|\n"); + fclose($fp); + } + } + + if ( ($call_type=='OUT') or ($call_type=='OUTBALANCE') ) + { + $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00113',$user,$server_ip,$session_name,$one_mysql_log);} + + $script_recording_delay=0; + ##### grab number of calls today in this campaign and increment + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='$campaign' and vs.script_id=vc.campaign_script and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00261',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $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,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);} + $VDIG_cid_ct = mysql_num_rows($rslt); + 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]; + 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_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 + if (strlen($list_id)>0) + { + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00281',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_xferOR_ct = mysql_num_rows($rslt); + if ($VDIG_xferOR_ct > 0) + { + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 0) + {$VDCL_xferconf_a_number = $row[0];} + if (strlen($row[1]) > 0) + {$VDCL_xferconf_b_number = $row[1];} + if (strlen($row[2]) > 0) + {$VDCL_xferconf_c_number = $row[2];} + if (strlen($row[3]) > 0) + {$VDCL_xferconf_d_number = $row[3];} + if (strlen($row[4]) > 0) + {$VDCL_xferconf_e_number = $row[4];} + } + } + + 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)) + { + if (ereg('LAST',$dialed_label)) + { + $stmt = "SELECT phone_code,phone_number,alt_phone_note,active,alt_phone_count FROM vicidial_list_alt_phones where lead_id='$lead_id' order by alt_phone_count desc limit 1;"; + } + else + { + $Talt_dial = ereg_replace("[^0-9]","",$dialed_label); + $stmt = "SELECT phone_code,phone_number,alt_phone_note,active,alt_phone_count FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Talt_dial';"; + } + + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00116',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAP_ct = mysql_num_rows($rslt); + if ($VLAP_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alt_phone_code = $row[0]; + $alt_phone_number = $row[1]; + $alt_phone_note = $row[2]; + $alt_phone_active = $row[3]; + $alt_phone_count = $row[4]; + } + } + } + else + { + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00117',$user,$server_ip,$session_name,$one_mysql_log);} + + 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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00118',$user,$server_ip,$session_name,$one_mysql_log);} + $VDL_cid_ct = mysql_num_rows($rslt); + if ($VDL_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_front_VDlog =$row[0]; + } + + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_inbound_groups vig WHERE group_id='$VDADchannel_group' and vs.script_id=vig.ingroup_script and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00262',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $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,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);} + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[0]; + $VDCL_group_color = $row[1]; + $VDCL_group_web = stripslashes($row[2]); + $VDCL_fronter_display = $row[3]; + $VDCL_ingroup_script = $row[4]; + $VDCL_get_call_launch = $row[5]; + $VDCL_xferconf_a_dtmf = $row[6]; + $VDCL_xferconf_a_number = $row[7]; + $VDCL_xferconf_b_dtmf = $row[8]; + $VDCL_xferconf_b_number = $row[9]; + $VDCL_default_xfer_group = $row[10]; + $VDCL_ingroup_recording_override = $row[11]; + $VDCL_ingroup_rec_filename = $row[12]; + $VDCL_default_group_alias = $row[13]; + $VDCL_group_web_two = stripslashes($row[14]); + $VDCL_timer_action = $row[15]; + $VDCL_timer_action_message = $row[16]; + $VDCL_timer_action_seconds = $row[17]; + $VDCL_start_call_url = $row[18]; + $VDCL_dispo_call_url = $row[19]; + $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,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);} + $VDIG_cidOR_ct = mysql_num_rows($rslt); + if ($VDIG_cidOR_ct > 0) + { + $row=mysql_fetch_row($rslt); + if (strlen($VDCL_xferconf_a_dtmf) < 1) + {$VDCL_xferconf_a_dtmf = $row[1];} + if (strlen($VDCL_xferconf_a_number) < 1) + {$VDCL_xferconf_a_number = $row[2];} + if (strlen($VDCL_xferconf_b_dtmf) < 1) + {$VDCL_xferconf_b_dtmf = $row[3];} + if (strlen($VDCL_xferconf_b_number) < 1) + {$VDCL_xferconf_b_number = $row[4];} + if (strlen($VDCL_default_group_alias) < 1) + {$VDCL_default_group_alias = $row[5];} + if (strlen($VDCL_timer_action) < 1) + {$VDCL_timer_action = $row[6];} + if (strlen($VDCL_timer_action_message) < 1) + {$VDCL_timer_action_message = $row[7];} + if (strlen($VDCL_timer_action_seconds) < 1) + {$VDCL_timer_action_seconds = $row[8];} + if (strlen($VDCL_start_call_url) < 1) + {$VDCL_start_call_url = $row[9];} + if (strlen($VDCL_dispo_call_url) < 1) + {$VDCL_dispo_call_url = $row[10];} + if (strlen($VDCL_xferconf_c_number) < 1) + {$VDCL_xferconf_c_number = $row[11];} + if (strlen($VDCL_xferconf_d_number) < 1) + {$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) ) + { + $VDCL_ingroup_script = $row[0]; + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='$campaign' and vs.script_id=vc.campaign_script and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00263',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + } + } + + $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00188',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidgwv_ct = mysql_num_rows($rslt); + if ($VDIG_cidgwv_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } + + if (strlen($VDCL_group_web_vars) < 1) + { + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00189',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } + } + + ### update the comments in vicidial_live_agents record + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND',last_inbound_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00120',$user,$server_ip,$session_name,$one_mysql_log);} + + $Ctype = 'I'; + } + 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,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);} + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_ingroup_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_group_alias = $row[6]; + $VDCL_timer_action = $row[7]; + $VDCL_timer_action_message = $row[8]; + $VDCL_timer_action_seconds = $row[9]; + $VDCL_start_call_url = $row[10]; + $VDCL_dispo_call_url = $row[11]; + $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; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='$VDADchannel_group' and vs.script_id=vc.campaign_script and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00264',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00190',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } + } + + $VDCL_caller_id_number=''; + if (strlen($VDCL_default_group_alias)>1) + { + $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00187',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidnum_ct = mysql_num_rows($rslt); + if ($VDIG_cidnum_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_caller_id_number = $row[0]; + } + } + + ### Check for List ID override settings + if (strlen($list_id)>0) + { + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00282',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidOR_ct = mysql_num_rows($rslt); + if ($VDIG_cidOR_ct > 0) + { + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 0) + {$VDCL_xferconf_a_number = $row[0];} + if (strlen($row[1]) > 0) + {$VDCL_xferconf_b_number = $row[1];} + if (strlen($row[2]) > 0) + {$VDCL_xferconf_c_number = $row[2];} + if (strlen($row[3]) > 0) + {$VDCL_xferconf_d_number = $row[3];} + if (strlen($row[4]) > 0) + {$VDCL_xferconf_e_number = $row[4];} + if (strlen($row[5]) > 5) + {$VDCL_group_web = $row[5];} + if (strlen($row[6]) > 5) + {$VDCL_group_web_two = $row[6];} + } + } + + $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 på 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|$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";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00122',$user,$server_ip,$session_name,$one_mysql_log);} + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + } + + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_lists WHERE list_id='$list_id' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00265',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vls_vc_ct = mysql_num_rows($rslt); + if ($vls_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='$list_id' and vs.script_id=vls.agent_script_override and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00266',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + } + } + + $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); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + $LeaD_InfO .= $alt_phone_code . "\n"; + $LeaD_InfO .= $alt_phone_number . "\n"; + $LeaD_InfO .= $alt_phone_note . "\n"; + $LeaD_InfO .= $alt_phone_active . "\n"; + $LeaD_InfO .= $alt_phone_count . "\n"; + $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; + + + + $wait_sec=0; + $StarTtime = date("U"); + $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00123',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $wait_sec = (($StarTtime - $row[0]) + $row[1]); + } + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00124',$user,$server_ip,$session_name,$one_mysql_log);} + + ### If a scheduled callback, change vicidial_callback record to INACTIVE + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00370',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00371',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or (eregi("CALLBK|CBHOLD", $dispo)) ) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00125',$user,$server_ip,$session_name,$one_mysql_log);} + } + + ##### check if system is set to generate logfile for transfers + $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00126',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $enable_agc_xfer_log_ct = mysql_num_rows($rslt); + if ($enable_agc_xfer_log_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_agc_xfer_log =$row[0]; + } + + if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) ) + { + # DATETIME|campaign|lead_id|phone_number|user|type + # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|A + $fp = fopen ("./xfer_log.txt", "a"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|$Ctype|$callerid|$uniqueid|$province\n"); + fclose($fp); + } + + ### Issue Start Call URL if defined + if (strlen($VDCL_start_call_url) > 7) + { + if (eregi('--A--user_custom_',$VDCL_start_call_url)) + { + $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five 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,'00283',$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 = urlencode(trim($row[0])); + $user_custom_two = urlencode(trim($row[1])); + $user_custom_three = urlencode(trim($row[2])); + $user_custom_four = urlencode(trim($row[3])); + $user_custom_five = urlencode(trim($row[4])); + } + } + $VDCL_start_call_url = preg_replace('/^VAR/','',$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--lead_id--B--',urlencode(trim($lead_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--vendor_id--B--',urlencode(trim($vendor_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--vendor_lead_code--B--',urlencode(trim($vendor_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--list_id--B--',urlencode(trim($list_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--gmt_offset_now--B--',urlencode(trim($gmt_offset_now)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--phone_code--B--',urlencode(trim($phone_code)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--phone_number--B--',urlencode(trim($phone_number)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--title--B--',urlencode(trim($title)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--first_name--B--',urlencode(trim($first_name)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--middle_initial--B--',urlencode(trim($middle_initial)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--last_name--B--',urlencode(trim($last_name)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--address1--B--',urlencode(trim($address1)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--address2--B--',urlencode(trim($address2)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--address3--B--',urlencode(trim($address3)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--city--B--',urlencode(trim($city)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--state--B--',urlencode(trim($state)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--province--B--',urlencode(trim($province)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--postal_code--B--',urlencode(trim($postal_code)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--country_code--B--',urlencode(trim($country_code)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--gender--B--',urlencode(trim($gender)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--date_of_birth--B--',urlencode(trim($date_of_birth)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--alt_phone--B--',urlencode(trim($alt_phone)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--email--B--',urlencode(trim($email)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--security_phrase--B--',urlencode(trim($security_phrase)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--comments--B--',urlencode(trim($comments)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--user--B--',urlencode(trim($user)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--pass--B--',urlencode(trim($pass)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--campaign--B--',urlencode(trim($campaign)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--phone_login--B--',urlencode(trim($phone_login)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--original_phone_login--B--',urlencode(trim($original_phone_login)),$VDCL_start_call_url); + $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($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); + $VDCL_start_call_url = eregi_replace('--A--customer_zap_channel--B--',urlencode(trim($customer_zap_channel)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--customer_server_ip--B--',urlencode(trim($customer_server_ip)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--server_ip--B--',urlencode(trim($server_ip)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--SIPexten--B--',urlencode(trim($SIPexten)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--session_id--B--',urlencode(trim($session_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--phone--B--',urlencode(trim($phone)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--parked_by--B--',urlencode(trim($parked_by)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--dispo--B--',urlencode(trim($dispo)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--dialed_number--B--',urlencode(trim($dialed_number)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--dialed_label--B--',urlencode(trim($dialed_label)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--source_id--B--',urlencode(trim($source_id)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--rank--B--',urlencode(trim($rank)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--owner--B--',urlencode(trim($owner)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--camp_script--B--',urlencode(trim($camp_script)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--in_script--B--',urlencode(trim($in_script)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--fullname--B--',urlencode(trim($fullname)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--user_custom_one--B--',urlencode(trim($user_custom_one)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--user_custom_two--B--',urlencode(trim($user_custom_two)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--user_custom_three--B--',urlencode(trim($user_custom_three)),$VDCL_start_call_url); + $VDCL_start_call_url = eregi_replace('--A--user_custom_four--B--',urlencode(trim($user_custom_four)),$VDCL_start_call_url); + $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); + $VDCL_start_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($callerid)),$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 = urlencode(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++; + } + } + } + + $stmt="UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00420',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$VDCL_start_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='start',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00421',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### grab the call_start_url ### + if ($DB > 0) {echo "$VDCL_start_call_url
\n";} + $SCUfile = file("$VDCL_start_call_url"); + if ($DB > 0) {echo "$SCUfile[0]
\n";} + + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00422',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + ##### 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);} + $ss_conf_ct = mysql_num_rows($rslt); + if ($ss_conf_ct > 0) + { + $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)) ) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) + { + $SCUoutput=''; + foreach ($SCUfile as $SCUline) + {$SCUoutput .= "$SCUline";} + # {"result":true,"durationLimit":3071} + if ( (strlen($SCUoutput) > 4) or (preg_match("/minuteswarning/",$VDCL_start_call_url)) ) + { + $minuteswarning=3; # default to 3 + if (preg_match("/minuteswarning/",$VDCL_start_call_url)) + { + $minuteswarningARY = explode('minuteswarning=',$VDCL_start_call_url); + $minuteswarning = preg_replace('/&.*/','',$minuteswarningARY[1]); + } + ### add this to the Start Call URL for callcard calls to be logged "&minuteswarning=1&callcard=1" + if (preg_match("/callcard=/",$VDCL_start_call_url)) + { + $stmt="SELECT balance_minutes_start FROM callcard_log where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00315',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $bms_ct = mysql_num_rows($rslt); + if ($bms_ct > 0) + { + $row=mysql_fetch_row($rslt); + $durationLimit = $row[0]; + + $stmt="UPDATE callcard_log set agent_time='$NOW_TIME',agent='$user' where uniqueid='$uniqueid' order by call_time desc LIMIT 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00316',$user,$server_ip,$session_name,$one_mysql_log);} + $ccl_update = mysql_affected_rows($link); + } + } + else + { + $SCUresponse = explode('durationLimit',$SCUoutput); + $durationLimit = preg_replace('/\D/','',$SCUresponse[1]); + } + if (strlen($durationLimit) < 1) {$durationLimit = 0;} + $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|$minuteswarning|$uniqueid|\n"); + fclose($fp); + } + } + ##### END special filtering and response for Vtiger account balance function ##### + } + } + else + { + echo "0\n"; + # echo "No calls in QUEUE for $user på $server_ip\n"; + exit; + } + } + } + + +################################################################################ +### userLOGout - Logs the user out of VICIDiaL client, deleting db records and +### inserting into vicidial_user_log +################################################################################ +if ($ACTION == 'userLOGout') + { + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) + { + echo "NO\n"; + echo "campaign $campaign or conf_exten $conf_exten er ikke valid\n"; + exit; + } + else + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00127',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + ##### Insert a LOGOUT record into the user log + $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00128',$user,$server_ip,$session_name,$one_mysql_log);} + $vul_insert = mysql_affected_rows($link); + + if ($no_delete_sessions < 1) + { + ##### Remove the reservation på the vicidial_conferences meetme room + $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00129',$user,$server_ip,$session_name,$one_mysql_log);} + $vc_remove = mysql_affected_rows($link); + } + + ##### Delete the web_client_sessions + $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00132',$user,$server_ip,$session_name,$one_mysql_log);} + $wcs_delete = mysql_affected_rows($link); + + ##### Hangup the client phone + $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00133',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) + { + $row=mysql_fetch_row($rslt); + $agent_channel = "$row[0]"; + if ($format=='debug') {echo "\n";} + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00134',$user,$server_ip,$session_name,$one_mysql_log);} + } + + if ($LogouTKicKAlL > 0) + { + $local_DEF = 'Local/5555'; + $local_AMP = '@'; + $kick_local_channel = "$local_DEF$conf_exten$local_AMP$ext_context"; + $queryCID = "ULGH3458$StarTtime"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $kick_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00135',$user,$server_ip,$session_name,$one_mysql_log);} + } + + sleep(1); + + ##### Delete the vicidial_live_agents record for this session + $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00130',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9130$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + $vla_delete = mysql_affected_rows($link); + + ##### Delete the vicidial_live_inbound_agents records for this session + $stmt="DELETE from vicidial_live_inbound_agents where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00131',$user,$server_ip,$session_name,$one_mysql_log);} + $vlia_delete = mysql_affected_rows($link); + + $pause_sec=0; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00136',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + { + $row=mysql_fetch_row($rslt); + $agent_log_id = $row[5]; + $pause_sec = (($StarTtime - $row[0]) + $row[1]); + + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00137',$user,$server_ip,$session_name,$one_mysql_log);} + } + + if ($vla_delete > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00138',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + 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]; + $queuemetrics_loginout = $row[7]; + $queuemetrics_addmember_enabled = $row[8]; + $queuemetrics_dispo_pause = $row[9]; + $queuemetrics_pe_phone_append = $row[10]; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_message = 'LOGGED OUT'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_message\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + + 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); + + # $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSE',serverid='1';"; + # if ($DB) {echo "$stmt\n";} + # + # $rslt=mysql_query($stmt, $linkB); + # $affected_rows = mysql_affected_rows($linkB); + + $logintime=0; + $stmt = "SELECT time_id,data1 FROM queue_log where agent='Agent/$user' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > $check_time 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";} + $li_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $li_conf_ct) + { + $row=mysql_fetch_row($rslt); + $logintime = $row[0]; + $loginphone = $row[1]; + $i++; + } + + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00394',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $time_logged_in = ($StarTtime - $logintime); + if ($time_logged_in > 1000000) {$time_logged_in=1;} + + if ($queuemetrics_loginout != 'NONE') + { + $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' $data4SQL;"; + 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) + { + if ($queuemetrics_loginout == 'NONE') + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00396',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + if ( ($logintime < 1) or ($queuemetrics_loginout == 'NONE') ) + { + $stmtB = "SELECT time_id,data3 FROM queue_log where agent='Agent/$user' and verb='PAUSEREASON' and data1='LOGIN' order by time_id desc limit 1;"; + $rsltB=mysql_query($stmtB, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00365',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "
$stmtB\n";} + $qml_ct = mysql_num_rows($rsltB); + if ($qml_ct > 0) + { + $row=mysql_fetch_row($rsltB); + $logintime = $row[0]; + $loginphone = $row[1]; + } + } + $stmt = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$user' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$campaign' 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";} + $amq_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $amq_conf_ct) + { + $row=mysql_fetch_row($rslt); + $AMqueue[$i] = $row[0]; + $i++; + } + + ### add the logged-in campaign as well + $AMqueue[$i] = $campaign; + $i++; + $amq_conf_ct++; + + $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' $data4SQL;"; + $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); + } + } + + echo "$vul_insert|$vc_remove|$vla_delete|$wcs_delete|$agent_channel|$vlia_delete\n"; + } + } + + +################################################################################ +### updateDISPO - update the vicidial_list table to reflect the agent choice of +### call disposition for that lead +################################################################################ +if ($ACTION == 'updateDISPO') + { + $MT[0]=''; + $row=''; $rowx=''; + $MAN_vl_insert=0; + if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) + { + echo "Dispo Choice $dispo or lead_id $lead_id er ikke valid\n"; + exit; + } + else + { + $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);} + $VC_dcu_ct = mysql_num_rows($rslt); + if ($VC_dcu_ct > 0) + { + $row=mysql_fetch_row($rslt); + $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',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);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9141$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + if ($auto_dial_level < 1) + { + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',callerid='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00285',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142',$user,$server_ip,$session_name,$one_mysql_log);} + + # $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); + $log_dispo_choice = $dispo_choice; + if (strlen($CallBackLeadStatus) > 0) {$log_dispo_choice = $CallBackLeadStatus;} + + $stmt = "SELECT count(*) from vicidial_inbound_groups where group_id='$stage';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00143',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $call_type='IN'; + $stmt = "UPDATE vicidial_closer_log set status='$log_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,'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";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00286',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $dispo_call_url = $row[0]; + } + 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)) ) + { + $stmt = "SELECT count(*) from vicidial_log where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\";"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00213',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_log set status='$log_dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00145',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + { + $VLlist_id = ''; $VLphone_number = ''; $VLphone_code = ''; $user_group=''; + $stmt = "SELECT user_group FROM vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00217',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VUinfo_ct = mysql_num_rows($rslt); + if ($VUinfo_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = "$row[0]"; + } + + $stmt = "SELECT list_id,phone_number,phone_code,alt_phone,address3 FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00216',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VLinfo_ct = mysql_num_rows($rslt); + if ($VLinfo_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VLlist_id = "$row[0]"; + if (strlen($phone_number)<6) + { + $VLphone_number = "$row[1]"; + $VLalt = 'MAIN'; + $VLalt_phone = "$row[3]"; + $VLaddress3 = "$row[4]"; + } + else + { + $VLphone_number = "$phone_number"; + if ($phone_number == "$row[1]") + {$VLalt = 'MAIN';} + else + { + if ($phone_number != $VLalt_phone) + { + if ($phone_number != $VLaddress3) + { + $VLalt = 'X1'; + $stmt = "SELECT alt_phone_count from vicidial_list_alt_phones where lead_id='$lead_id' and phone_number = '$dialed_number' order by alt_phone_count limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00250',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAP_cid_ct = mysql_num_rows($rslt); + if ($VDAP_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $Xalt_phone_count =$row[0]; + + $stmt = "SELECT count(*) from vicidial_list_alt_phones where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00251',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAPct_cid_ct = mysql_num_rows($rslt); + if ($VDAPct_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $COUNTalt_phone_count =$row[0]; + + if ($COUNTalt_phone_count <= $Xalt_phone_count) + {$VLalt = 'XLAST';} + else + {$VLalt = "X$Xalt_phone_count";} + } + + } + } + else + {$VLalt = 'ADDR3';} + } + else + {$VLalt = 'ALT';} + } + } + if (strlen($phone_code)<1) + {$VLphone_code = "$row[2]";} + else + {$VLphone_code = "$phone_code";} + } + + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 9) {$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='$log_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";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00215',$user,$server_ip,$session_name,$one_mysql_log);} + + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$FAKEcall_id',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00402',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + + $MAN_vl_insert++; + } + + $stmt="DELETE FROM vicidial_auto_calls where callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00219',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00403',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + { + $stmt="UPDATE vicidial_log set status='$log_dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00145',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + + ### find all DNC-type statuses in the system + if ( ($use_internal_dnc=='Y') or ($use_campaign_dnc=='Y') ) + { + $DNC_string_check = '|'; + $stmt = "SELECT status FROM vicidial_statuses where dnc='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00195',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $dncvs_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dncvs_ct) + { + $row=mysql_fetch_row($rslt); + $DNC_string_check .= "$row[0]|"; + $i++; + } + + $stmt = "SELECT status FROM vicidial_campaign_statuses where dnc='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00196',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $dncvcs_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dncvcs_ct) + { + $row=mysql_fetch_row($rslt); + $DNC_string_check .= "$row[0]|"; + $i++; + } + + # echo "$DNC_string_check"; + } + + $insert_into_dnc=0; + if ( ($use_internal_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) + { + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $stmt="INSERT 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";} + $insert_into_dnc++; + } + if ( ($use_campaign_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) + { + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $stmt="INSERT 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";} + $insert_into_dnc++; + } + } + + $dispo_sec=0; + $dispo_epochSQL=''; + $lead_id_commentsSQL=''; + $StarTtime = date("U"); + $stmt = "SELECT dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00150',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $agent_log_id = $row[6]; + if ( (eregi("NULL",$row[2])) or ($row[2] < 1000) ) + { + $row[2]=$StarTtime; + $wait_sec=($row[2] - $row[3]); + $dispo_epochSQL = ",talk_epoch='$row[2]',wait_sec='$wait_sec'"; + } + if ( (eregi("NULL",$row[0])) or ($row[0] < 1000) ) + { + $dispo_epochSQL .= ",dispo_epoch='$StarTtime'"; + $row[0]=$row[2]; + } + $dispo_sec = (($StarTtime - $row[0]) + $row[1]); + if ( (preg_match('/^M/',$MDnextCID)) and (preg_match('/INBOUND_MAN/',$dial_method)) ) + { + if ( (eregi("NULL",$row[5])) or (strlen($row[5]) < 1) ) + { + $lead_id_commentsSQL .= ",comments='MANUAL'"; + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1) or (strlen($row[4]) < 1) ) + { + $lead_id_commentsSQL .= ",lead_id='$lead_id'"; + } + } + } + $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',status='$log_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);} + + $stmt="UPDATE vicidial_campaigns set campaign_calldate='$NOW_TIME' where campaign_id='$campaign';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00272',$user,$server_ip,$session_name,$one_mysql_log);} + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00152',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $CALL_agent_log_id = $agent_log_id; + + if ($auto_dial_level < 1) + { + $MAN_insert_leadIDsql=''; + if ($MAN_vl_insert > 0) + {$MAN_insert_leadIDsql = ",lead_id='$lead_id'";} + $stmt="INSERT INTO vicidial_agent_log SET user='$user',server_ip='$server_ip',event_time='$NOW_TIME',campaign_id='$campaign',pause_epoch='$StarTtime',pause_sec='0',wait_epoch='$StarTtime',user_group='$user_group'$MAN_insert_leadIDsql;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00153',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00220',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); + } + + ### OPKALDBACK ENTRY + if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) + { + $comments = eregi_replace('"','',$comments); + $comments = eregi_replace("'",'',$comments); + $comments = eregi_replace(';','',$comments); + $comments = eregi_replace("\\\\",' ',$comments); + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group,lead_status) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group','$CallBackLeadStatus');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00154',$user,$server_ip,$session_name,$one_mysql_log);} + } + + ### BEGIN Call Notat Logging ### + if (strlen($call_notes) > 1) + { + $VDADchannel_group=$campaign; + $stmt = "SELECT campaign_id,closecallid 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,'00372',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_cn_ct = mysql_num_rows($rslt); + if ($VDCL_cn_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group = $row[0]; + $vicidial_id = $row[1]; + } + else + {$vicidial_id = $uniqueid;} + + # Insert into vicidial_call_notes + $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$NOW_TIME',call_notes='" . mysql_real_escape_string($call_notes) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00373',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $notesid = mysql_insert_id($link); + } + ### END Call Notat Logging ### + + $stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,api_manual_dial from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VC_auto_alt_dial_statuses = $row[0]; + $use_internal_dnc = $row[1]; + $use_campaign_dnc = $row[2]; + $api_manual_dial = $row[3]; + + if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) ) + { + $stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00156',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + ##### Check for alt phone number in DNC list if applicable + $UD_DNC_campaign=0; + $UD_DNC_internal=0; + $vh_phone=''; + $stmt="SELECT phone_number FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00267',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ud_record_ct = mysql_num_rows($rslt); + if ($ud_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $vh_phone = $row[0]; + } + + if ( (ereg("Y",$use_internal_dnc)) or (ereg("AREACODE",$use_internal_dnc)) ) + { + if (ereg("AREACODE",$use_internal_dnc)) + { + $vhp_phone_areacode = substr($vh_phone, 0, 3); + $vhp_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_dnc where phone_number IN('$vh_phone','$vhp_phone_areacode');"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$vh_phone';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00268',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ud_record_ct = mysql_num_rows($rslt); + if ($ud_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $UD_DNC_internal = $row[0]; + } + } + + if ( (ereg("Y",$use_campaign_dnc)) or (ereg("AREACODE",$use_campaign_dnc)) ) + { + if (ereg("AREACODE",$use_campaign_dnc)) + { + $vhp_phone_areacode = substr($vh_phone, 0, 3); + $vhp_phone_areacode .= "XXXXXXX"; + $stmtA="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$vh_phone','$vhp_phone_areacode') and campaign_id='$campaign';"; + } + else + {$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$vh_phone' and campaign_id='$campaign';";} + $rslt=mysql_query($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00269',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ud_record_ct = mysql_num_rows($rslt); + if ($ud_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $UD_DNC_campaign = $row[0]; + } + } + + if ( ($UD_DNC_campaign > 0) or ($UD_DNC_internal > 0) ) + { + if ( ( (ereg(" DNCC ",$VC_auto_alt_dial_statuses)) and ($UD_DNC_campaign > 0) ) or ( (ereg(" DNCL ",$VC_auto_alt_dial_statuses)) and ($UD_DNC_internal > 0) ) ) + { + $stmt="UPDATE vicidial_hopper set status='DNC' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00157',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + else + { + $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00157',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + } + else + { + $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00158',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="DELETE from vicidial_manual_dial_queue where user='$user' and status='QUEUE';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00363',$user,$server_ip,$session_name,$one_mysql_log);} + } + + ####### START Vtiger Call Logging ####### + $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00197',$user,$server_ip,$session_name,$one_mysql_log);} + $ss_conf_ct = mysql_num_rows($rslt); + if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_vtiger_integration = $row[0]; + $vtiger_server_ip = $row[1]; + $vtiger_dbname = $row[2]; + $vtiger_login = $row[3]; + $vtiger_pass = $row[4]; + $vtiger_url = $row[5]; + } + + if ($enable_vtiger_integration > 0) + { + $stmt = "SELECT vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_search_dead,vtiger_status_call FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00198',$user,$server_ip,$session_name,$one_mysql_log);} + $vtc_conf_ct = mysql_num_rows($rslt); + if ($vtc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $vtiger_search_category = $row[0]; + $vtiger_create_call_record = $row[1]; + $vtiger_create_lead_record = $row[2]; + $vtiger_search_dead = $row[3]; + $vtiger_status_call = $row[4]; + } + if ( (ereg('ACCTID',$vtiger_search_category)) or (ereg('ACCOUNT',$vtiger_search_category)) ) + { + ### find the full status name for this status + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);} + $vs_ct = mysql_num_rows($rslt); + if ($vs_ct > 0) + { + $row=mysql_fetch_row($rslt); + $status_name = $row[0]; + } + else + { + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);} + $vs_ct = mysql_num_rows($rslt); + if ($vs_ct > 0) + { + $row=mysql_fetch_row($rslt); + $status_name = $row[0]; + } + } + if (strlen($status_name) < 1) {$status_name = $dispo_choice;} + + ### connect to your vtiger database + $linkV=mysql_connect("$vtiger_server_ip", "$vtiger_login","$vtiger_pass"); + if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysql_error());} + mysql_select_db("$vtiger_dbname", $linkV); + + $stmt = "SELECT vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00210',$user,$server_ip,$session_name,$one_mysql_log);} + $vlc_ct = mysql_num_rows($rslt); + if ($vlc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $vendor_id = $row[0]; + } + + # make sure the ID is present in Vtiger database as an account + $stmt="SELECT count(*) from vtiger_account where accountid='$vendor_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00199',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VIDcount = $row[0]; + if ($VIDcount > 0) + { + ### create a call record in vtiger linked to the account + if (ereg('DISPO',$vtiger_create_call_record)) + { + $TODAY = date("Y-m-d"); + $HHMMnow = date("H:i"); + $minute_old = mktime(date("H"), date("i")+5, date("s"), date("m"), date("d"), date("Y")); + $HHMMend = date("H:i",$minute_old); + + #Get logged in user ID + $stmt="SELECT id from vtiger_users where user_name='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00200',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $user_id = $row[0]; + + ## if numbered callback activity record, alter existing record + $vtiger_callback_modified=0; + if ($vtiger_callback_id > 0) + { + # make sure the ID is present in Vtiger database as an account + $stmt="SELECT count(*) from vtiger_seactivityrel where activityid='$vtiger_callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00213',$user,$server_ip,$session_name,$one_mysql_log);} + $vt_act_ct = mysql_num_rows($rslt); + if ($vt_act_ct > 0) + { + $row=mysql_fetch_row($rslt); + $activity_check = $row[0]; + } + if ($activity_check > 0) + { + $act_description=''; + $stmt="SELECT description from vtiger_crmentity where crmid='$vtiger_callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00214',$user,$server_ip,$session_name,$one_mysql_log);} + $vt_actd_ct = mysql_num_rows($rslt); + if ($vt_actd_ct > 0) + { + $row=mysql_fetch_row($rslt); + $act_description = $row[0]; + } + $act_subject=''; + $stmt="SELECT subject from vtiger_activity where activityid='$vtiger_callback_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00215',$user,$server_ip,$session_name,$one_mysql_log);} + $vt_actd_ct = mysql_num_rows($rslt); + if ($vt_actd_ct > 0) + { + $row=mysql_fetch_row($rslt); + $act_subject = $row[0]; + } + + $stmt = "UPDATE vtiger_crmentity SET modifiedby='$user_id', description='$act_description - VICIDIAL Call user $user',modifiedtime='$NOW_TIME',viewedtime='$NOW_TIME' where crmid='$vtiger_callback_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00216',$user,$server_ip,$session_name,$one_mysql_log);} + $stmt = "UPDATE vtiger_activity SET subject='VC Call: $status_name - $act_subject',date_start='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',eventstatus='Held' where activityid='$vtiger_callback_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00217',$user,$server_ip,$session_name,$one_mysql_log);} + $vtiger_callback_modified=1; + } + } + + ## create new activity record + if ($vtiger_callback_modified < 1) + { + # Get next aviable id from vtiger_crmentity_seq to use as activityid in vtiger_crmentity + $stmt="SELECT id from vtiger_crmentity_seq ;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00201',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $activityid = ($row[0] + 1); + + # Increase next aviable crmid with 1 so next record gets proper id + $stmt="UPDATE vtiger_crmentity_seq SET id = '$activityid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00202',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_salesmanactivityrel + $stmt = "INSERT INTO vtiger_salesmanactivityrel SET smid='$user_id',activityid='$activityid';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00203',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_seactivityrel + $stmt = "INSERT INTO vtiger_seactivityrel SET crmid='$vendor_id',activityid='$activityid';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00204',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_crmentity + $stmt = "INSERT INTO vtiger_crmentity (crmid, smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('$activityid', '$user_id', '$user_id','$user_id', 'Calendar', 'VICIDIAL Call user $user', '$NOW_TIME', '$NOW_TIME', '$NOW_TIME', NULL, '0', '1', '0');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00205',$user,$server_ip,$session_name,$one_mysql_log);} + + #Insert values into vtiger_activity + $stmt = "INSERT INTO vtiger_activity SET activityid='$activityid',subject='VC Call: $status_name',activitytype='Call',date_start='$TODAY',due_date='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL Bruger $user',notime='0',visibility='Public',recurringtype='--None--';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00206',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "|$leadid|\n";} + } + } + ### update the status of the record in vtiger + if (ereg('Y',$vtiger_status_call)) + { + #Get logged in user ID + $stmt="SELECT id from vtiger_users where user_name='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00207',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $user_id = $row[0]; + + #Update vtiger_crmentity + $stmt = "UPDATE vtiger_crmentity SET modifiedby='$user_id', modifiedtime='$NOW_TIME' where crmid='$vendor_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00208',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "|$leadid|\n";} + + if ($insert_into_dnc > 0) {$emailoptoutSQL = ", emailoptout='1'";} + #Update vtiger_account dnc=emailoptout + $stmt = "UPDATE vtiger_account SET siccode='$status_name' $emailoptoutSQL where accountid='$vendor_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00209',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "|$leadid|\n";} + + + ### check and see if the custom date fields exist, if they do then update them if necessary + # Date of Sidste Attempt, Date of Sidste Non-Contact, Date of Sidste Contact, Date of Sidste Sale + + # first find the sale statuses that are in the system + $SALE_string_check = '|'; + $stmt = "SELECT status FROM vicidial_statuses where sale='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $salevs_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $salevs_ct) + { + $row=mysql_fetch_row($rslt); + $SALE_string_check .= "$row[0]|"; + $i++; + } + $stmt = "SELECT status FROM vicidial_campaign_statuses where sale='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $salevcs_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $salevcs_ct) + { + $row=mysql_fetch_row($rslt); + $SALE_string_check .= "$row[0]|"; + $i++; + } + + # second find the customer contact statuses that are in the system + $CC_string_check = '|'; + $stmt = "SELECT status FROM vicidial_statuses where customer_contact='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00213',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cc_vs_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $cc_vs_ct) + { + $row=mysql_fetch_row($rslt); + $CC_string_check .= "$row[0]|"; + $i++; + } + $stmt = "SELECT status FROM vicidial_campaign_statuses where customer_contact='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00287',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cc_vcs_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $cc_vcs_ct) + { + $row=mysql_fetch_row($rslt); + $CC_string_check .= "$row[0]|"; + $i++; + } + + # third calculate what custom date fields need their date updated + $VT_last_noncontact_update=0; $VT_last_noncontact_ct=0; + $VT_last_contact_update=0; $VT_last_contact_ct=0; + $VT_last_sale_update=0; $VT_last_sale_ct=0; + if (eregi("\|$dispo_choice\|", $SALE_string_check) ) + {$VT_last_sale_update++;} + if (eregi("\|$dispo_choice\|", $CC_string_check) ) + {$VT_last_contact_update++;} + else + {$VT_last_noncontact_update++;} + + # fourth see if the vtiger database has the custom date fields in it + $stmt="SELECT count(*) from vtiger_field where fieldlabel='Date of Last Attempt';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00215',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_attempt_ct = $row[0]; + + if ($VT_last_noncontact_update > 0) + { + $stmt="SELECT count(*) from vtiger_field where fieldlabel='Date of Last Non-Contact';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00216',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_noncontact_ct = $row[0]; + } + if ($VT_last_contact_update > 0) + { + $stmt="SELECT count(*) from vtiger_field where fieldlabel='Date of Last Contact';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00217',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_contact_ct = $row[0]; + } + if ($VT_last_sale_update > 0) + { + $stmt="SELECT count(*) from vtiger_field where fieldlabel='Date of Last Sale';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00218',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_sale_ct = $row[0]; + } + + # fifth find the fieldnames if they exist and update the dates + if ($VT_last_attempt_ct > 0) + { + $stmt="SELECT fieldname from vtiger_field where fieldlabel='Date of Last Attempt';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00219',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_attempt_field = $row[0]; + + $stmt = "UPDATE vtiger_accountscf SET $VT_last_attempt_field='$TODAY' where accountid='$vendor_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00223',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ($VT_last_noncontact_ct > 0) + { + $stmt="SELECT fieldname from vtiger_field where fieldlabel='Date of Last Non-Contact';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00220',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_noncontact_field = $row[0]; + + $stmt = "UPDATE vtiger_accountscf SET $VT_last_noncontact_field='$TODAY' where accountid='$vendor_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00224',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ($VT_last_contact_ct > 0) + { + $stmt="SELECT fieldname from vtiger_field where fieldlabel='Date of Last Contact';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00221',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_contact_field = $row[0]; + + $stmt = "UPDATE vtiger_accountscf SET $VT_last_contact_field='$TODAY' where accountid='$vendor_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00225',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ($VT_last_sale_ct > 0) + { + $stmt="SELECT fieldname from vtiger_field where fieldlabel='Date of Last Sale';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00222',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VT_last_sale_field = $row[0]; + + $stmt = "UPDATE vtiger_accountscf SET $VT_last_sale_field='$TODAY' where accountid='$vendor_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $linkV); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00226',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + } + } + } + ####### END Vtiger Call Logging ####### + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_callstatus,queuemetrics_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00159',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + 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]; + $queuemetrics_callstatus = $row[6]; + $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + 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); + + if (strlen($stage) < 2) + {$stage = $campaign;} + $qm_dispo_codeSQL=''; + if (strlen($qm_dispo_code) > 0) + {$qm_dispo_codeSQL = ",data3='$qm_dispo_code'";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id' $qm_dispo_codeSQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00160',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + ### check to make sure a COMPLETE record is present for this call + $QLcomplete_records=0; + $stmt = "SELECT count(*) FROM queue_log where verb IN('COMPLETEAGENT','COMPLETECALLER') and call_id='$MDnextCID' and agent='Agent/$user' and queue='$stage';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00409',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $comp_ct = mysql_num_rows($rslt); + if ($comp_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_records = $row[0]; + } + + ### if there are no complete records, look up information to insert one for this call + if ($QLcomplete_records < 1) + { + $QLconnect_time=$StarTtime; + $QLcomplete_time=$StarTtime; + $QLconnect_one=''; + $QLconnect_four=''; + $QLcomplete_position=1; + + $stmt = "SELECT time_id,data1,data4 FROM queue_log where verb='CONNECT' and call_id='$MDnextCID' and agent='Agent/$user' and queue='$stage' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00410',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $connect_ct = mysql_num_rows($rslt); + if ($connect_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLconnect_time = $row[0]; + $QLconnect_one = $row[1]; + $QLconnect_four = $row[2]; + } + + $stmt = "SELECT time_id FROM queue_log where verb='PAUSEREASON' and call_id='$MDnextCID' and agent='Agent/$user' and data1='$queuemetrics_dispo_pause' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00411',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $pausereason_ct = mysql_num_rows($rslt); + if ($pausereason_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_time = $row[0]; + } + + $QLcomplete_length = ($QLcomplete_time - $QLconnect_time); + if ($QLcomplete_length < 0) {$QLcomplete_length=0;} + if ($QLcomplete_length > 86400) {$QLcomplete_length=1;} + + ## if inbound, check for initial queue position + if (preg_match("/^Y/",$MDnextCID)) + { + $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); + + $stmt = "SELECT queue_position FROM vicidial_closer_log where lead_id='$lead_id' and campaign_id='$stage' and call_date > \"$four_hours_ago\" 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,'00412',$user,$server_ip,$session_name,$one_mysql_log);} + $vcl_ct = mysql_num_rows($rslt); + if ($vcl_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_position = $row[0]; + } + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$QLcomplete_time',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='COMPLETEAGENT',data1='$QLconnect_one',data2='$QLcomplete_length',data3='$QLcomplete_position',serverid='$queuemetrics_log_id',data4='$QLconnect_four';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00413',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + + mysql_close($linkB); + } + + ############################################ + ### BEGIN Issue Dispo Call URL if defined + ############################################ + if (strlen($dispo_call_url) > 7) + { + $talk_time=0; + $talk_time_ms=0; + $talk_time_min=0; + if ( (eregi('--A--user_custom_',$dispo_call_url)) or (eregi('--A--fullname',$dispo_call_url)) ) + { + $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,'00288',$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 = urlencode(trim($row[0])); + $user_custom_two = urlencode(trim($row[1])); + $user_custom_three = urlencode(trim($row[2])); + $user_custom_four = urlencode(trim($row[3])); + $user_custom_five = urlencode(trim($row[4])); + $fullname = urlencode(trim($row[5])); + } + } + + if (eregi('--A--talk_time',$dispo_call_url)) + { + $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,'00289',$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; + $talk_time_ms = 0; + } + else + { + $talk_time_ms = ($talk_time * 1000); + $talk_time_min = ceil($talk_time / 60); + } + } + } + + if (eregi('--A--dispo_name--B--',$dispo_call_url)) + { + ### find the full status name for this status + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00297',$user,$server_ip,$session_name,$one_mysql_log);} + $vs_name_ct = mysql_num_rows($rslt); + if ($vs_name_ct > 0) + { + $row=mysql_fetch_row($rslt); + $status_name = urlencode(trim($row[0])); + } + else + { + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00298',$user,$server_ip,$session_name,$one_mysql_log);} + $vcs_name_ct = mysql_num_rows($rslt); + if ($vcs_name_ct > 0) + { + $row=mysql_fetch_row($rslt); + $status_name = urlencode(trim($row[0])); + } + } + 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 = urlencode(trim($row[0])); + $DID_description = urlencode(trim($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,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";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo = urlencode(trim($row[3])); + $tsr = urlencode(trim($row[4])); + $vendor_id = urlencode(trim($row[5])); + $vendor_lead_code = urlencode(trim($row[5])); + $source_id = urlencode(trim($row[6])); + $list_id = urlencode(trim($row[7])); + $gmt_offset_now = urlencode(trim($row[8])); + $phone_code = urlencode(trim($row[10])); + $phone_number = urlencode(trim($row[11])); + $title = urlencode(trim($row[12])); + $first_name = urlencode(trim($row[13])); + $middle_initial = urlencode(trim($row[14])); + $last_name = urlencode(trim($row[15])); + $address1 = urlencode(trim($row[16])); + $address2 = urlencode(trim($row[17])); + $address3 = urlencode(trim($row[18])); + $city = urlencode(trim($row[19])); + $state = urlencode(trim($row[20])); + $province = urlencode(trim($row[21])); + $postal_code = urlencode(trim($row[22])); + $country_code = urlencode(trim($row[23])); + $gender = urlencode(trim($row[24])); + $date_of_birth = urlencode(trim($row[25])); + $alt_phone = urlencode(trim($row[26])); + $email = urlencode(trim($row[27])); + $security = urlencode(trim($row[28])); + $comments = urlencode(trim($row[29])); + $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); + $dispo_call_url = eregi_replace('--A--lead_id--B--',"$lead_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--vendor_id--B--',"$vendor_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--list_id--B--',"$list_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--phone_code--B--',"$phone_code",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--phone_number--B--',"$phone_number",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--title--B--',"$title",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--first_name--B--',"$first_name",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--middle_initial--B--',"$middle_initial",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--last_name--B--',"$last_name",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--address1--B--',"$address1",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--address2--B--',"$address2",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--address3--B--',"$address3",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--city--B--',"$city",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--state--B--',"$state",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--province--B--',"$province",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--postal_code--B--',"$postal_code",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--country_code--B--',"$country_code",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--gender--B--',"$gender",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--alt_phone--B--',"$alt_phone",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--email--B--',"$email",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--security_phrase--B--',"$security_phrase",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--comments--B--',"$comments",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--user--B--',"$user",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--pass--B--',"$pass",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--campaign--B--',"$campaign",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--phone_login--B--',"$phone_login",$dispo_call_url); + $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--',"$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); + $dispo_call_url = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--server_ip--B--',"$server_ip",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--SIPexten--B--',"$SIPexten",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--session_id--B--',"$session_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--phone--B--',"$phone",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--parked_by--B--',"$parked_by",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--dispo--B--',"$dispo",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--dispo_name--B--',"$dispo_name",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--dialed_number--B--',"$dialed_number",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--dialed_label--B--',"$dialed_label",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--source_id--B--',"$source_id",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--rank--B--',"$rank",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--owner--B--',"$owner",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--camp_script--B--',"$camp_script",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--in_script--B--',"$in_script",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--fullname--B--',"$fullname",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$dispo_call_url); + $dispo_call_url = eregi_replace('--A--talk_time--B--',"$talk_time",$dispo_call_url); + $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); + $dispo_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($MDnextCID)),$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 = urlencode(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++; + } + } + } + + $stmt="UPDATE vicidial_log_extended set dispo_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00423',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$dispo_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='dispo',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00424',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### send dispo_call_url ### + if ($DB > 0) {echo "$dispo_call_url
\n";} + $SCUfile = file("$dispo_call_url"); + if ($DB > 0) {echo "$SCUfile[0]
\n";} + + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00425',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + + $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00296',$user,$server_ip,$session_name,$one_mysql_log);} + $ss_conf_ct = mysql_num_rows($rslt); + if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $enable_vtiger_integration = $row[0]; + } + if ( ($enable_vtiger_integration > 0) and (ereg('mode=callend',$dispo_call_url)) and (ereg('contactwsid',$dispo_call_url)) ) + { + $SCUoutput=''; + foreach ($SCUfile as $SCUline) + {$SCUoutput .= "$SCUline";} + $fp = fopen ("./call_url_log.txt", "a"); + 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); + } + + # debug testing sleep + # sleep(5); + + echo 'Lead ' . $lead_id . ' er ændret til ' . $dispo_choice . " Status\nNext agent_log_id:\n" . $agent_log_id . "\n"; + } + +################################################################################ +### updateLEAD - update the vicidial_list table to reflect the values that are +### in the agents screen at time of call hangup +################################################################################ +if ($ACTION == 'updateLEAD') + { + $MT[0]=''; + $row=''; $rowx=''; + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) + { + echo "phone_number $phone_number or lead_id $lead_id er ikke valid\n"; + exit; + } + else + { + $stmt = "SELECT disable_alter_custdata,disable_alter_custphone FROM vicidial_campaigns where campaign_id='$campaign'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00161',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $dac_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $dac_conf_ct) + { + $row=mysql_fetch_row($rslt); + $disable_alter_custdata = $row[0]; + $disable_alter_custphone = $row[1]; + $i++; + } + if ( (ereg('Y',$disable_alter_custdata)) or (ereg('Y',$disable_alter_custphone)) ) + { + if (ereg('Y',$disable_alter_custdata)) + { + $DO_NOT_UPDATE=1; + $DO_NOT_UPDATE_text=' NOT'; + } + if (ereg('Y',$disable_alter_custphone)) + { + $DO_NOT_UPDATEphone=1; + } + $stmt = "SELECT alter_custdata_override,alter_custphone_override FROM vicidial_users where user='$user'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00162',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $aco_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $aco_conf_ct) + { + $row=mysql_fetch_row($rslt); + $alter_custdata_override = $row[0]; + $alter_custphone_override = $row[1]; + $i++; + } + if (ereg('ALLOW_ALTER',$alter_custdata_override)) + { + $DO_NOT_UPDATE=0; + $DO_NOT_UPDATE_text=''; + } + if (ereg('ALLOW_ALTER',$alter_custphone_override)) + { + $DO_NOT_UPDATEphone=0; + } + } + + if ($DO_NOT_UPDATE < 1) + { + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + $comments = eregi_replace("--AMP--",'&',$comments); + $comments = eregi_replace("--QUES--",'?',$comments); + $comments = eregi_replace("--POUND--",'#',$comments); + + $phoneSQL=''; + if ($DO_NOT_UPDATEphone < 1) + {$phoneSQL = ",phone_number='$phone_number'";} + + $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' $phoneSQL where lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00163',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00164',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9164$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + } + echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; + } + + +################################################################################ +### VDADpause - update the vicidial_live_agents table to show that the agent is +### or ready now active and ready to take calls +################################################################################ +if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) + { + $MT[0]=''; + $row=''; $rowx=''; + if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) + { + echo "stage $stage er ikke valid\n"; + exit; + } + else + { + $vla_autodialSQL=''; + if (preg_match('/INBOUND_MAN/',$dial_method)) + {$vla_autodialSQL = ",outbound_autodial='N'";} + $random = (rand(1000000, 9999999) + 10000000); + $stmt="UPDATE vicidial_live_agents set uniqueid=0,callerid='',channel='', random_id='$random',comments='',last_state_change='$NOW_TIME' $vla_autodialSQL where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00165',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9165$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + if ($comments != 'NO_STATUS_CHANGE') + { + $vla_lead_wipeSQL=''; + if ($ACTION == 'VDADready') + {$vla_lead_wipeSQL = ",lead_id=0";} + if ($ACTION == 'VDADpause') + {$vla_ring_resetSQL = ",ring_callerid=''";} + $stmt="UPDATE vicidial_live_agents set status='$stage' $vla_lead_wipeSQL $vla_ring_resetSQL where user='$user' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00166',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9166$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + $affected_rows = mysql_affected_rows($link); + } + if ( ($affected_rows > 0) or ($comments == 'NO_STATUS_CHANGE') ) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00167',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + 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_pe_phone_append = $row[6]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + if ( (ereg('READY',$stage)) or (ereg('CLOSER',$stage)) ) {$QMstatus='UNPAUSEALL';} + if (ereg('PAUSE',$stage)) {$QMstatus='PAUSEALL';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $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,'00182',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00395',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id' $data4SQL;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00168',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + + $pause_sec=0; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $dispo_epoch = $row[4]; + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + if ( (eregi("NULL",$dispo_epoch)) or ($dispo_epoch < 1000) ) + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00170',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + if ($ACTION == 'VDADpause') + { + if ( (eregi("NULL",$dispo_epoch)) or ($dispo_epoch < 1000) ) + { + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00171',$user,$server_ip,$session_name,$one_mysql_log);} + } + + $agent_log = 'NEW_ID'; + } + + if ($wrapup == 'WRAPUP') + { + if ( (eregi("NULL",$dispo_epoch)) or ($dispo_epoch < 1000) ) + { + $stmt="UPDATE vicidial_agent_log set dispo_epoch='$StarTtime', dispo_sec='0' where agent_log_id='$agent_log_id';"; + } + else + { + $dispo_sec = ($StarTtime - $dispo_epoch); + $stmt="UPDATE vicidial_agent_log set dispo_sec='$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,'00194',$user,$server_ip,$session_name,$one_mysql_log);} + } + + if ($agent_log == 'NEW_ID') + { + $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,'00182',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00153',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00221',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); + } + } + if (strlen($sub_status) > 0) + { + ### if a pause code(sub_status) is sent with this pause request, continue på to that action without printing output + $stage = 0; + $status = $sub_status; + $ACTION = 'PauseCodeSubmit'; + } + else + { + echo 'Agent ' . $user . ' er nu i status ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n"; + } + } + + +################################################################################ +### UpdatEFavoritEs - update the astguiclient favorites list for this extension +################################################################################ +if ($ACTION == 'UpdatEFavoritEs') + { + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) + { + echo "favorites list $favorites_list er ikke valid\n"; + exit; + } + else + { + $stmt = "SELECT count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00172',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + + if ($row[0] > 0) + { + $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00173',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + { + $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00174',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + echo "Favorites list has been updated to $favorites_list for $exten\n"; + } + + +################################################################################ +### PauseCodeSubmit - Update vicidial_agent_log with pause code +################################################################################ +if ($ACTION == 'PauseCodeSubmit') + { + $row=''; $rowx=''; + if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) + { + echo "agent_log_id $agent_log_id or pause_code $status er ikke valid\n"; + exit; + } + else + { + ### if this is the first pause code entry in a pause session, simply update and log to queue_log + if ($stage < 1) + { + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id >= '$agent_log_id' and user='$user' and ( (sub_status is NULL) or (sub_status='') )order by agent_log_id limit 2;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00175',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + } + ### this is not the first pause code entry, insert new vicidial_agent_log entry + else + { + $pause_sec=0; + $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,'00306',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pause_sec = ($StarTtime - $row[0]); + } + $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,'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,'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) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','$status');"; + if ($DB) {echo "$stmt\n";} + $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);} + $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,'00310',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); + } + + ### if entry accepted, add a queue_log entry if QM integration is enabled + if ($affected_rows > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages,queuemetrics_pe_phone_append FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00176',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + 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]; + $allow_sipsak_messages = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ( ($enable_sipsak_messages > 0) and ($allow_sipsak_messages > 0) and (eregi("SIP",$protocol)) ) + { + $SIPSAK_prefix = 'BK-'; + passthru("/usr/local/bin/sipsak -M -O desktop -B \"$SIPSAK_prefix$status\" -r 5060 -s sip:$extension@$phone_ip > /dev/null"); + } + if ($enable_queuemetrics_logging > 0) + { + $pause_call_id='NONE'; + if (strlen($campaign_cid) > 12) {$pause_call_id = $campaign_cid;} + $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='$pause_call_id',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00177',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + + mysql_close($linkB); + } + } + } + echo ' Pause Code ' . $status . " has been recorded\nNext agent_log_id:\n" . $agent_log_id . "\n"; + } + + +################################################################################ +### AGENTSview - List statuses of other agents in sidebar or xfer frame +################################################################################ +if ($ACTION == 'AGENTSview') + { + $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00225',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $VU_user_group = $row[0]; + + $agent_status_viewable_groupsSQL=''; + ### Gather timeclock and shift enforcement restriction settings + $stmt="SELECT 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,'00226',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $agent_status_viewable_groups = $row[0]; + $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[1] == 'Y') + {$agent_status_view_time=1;} + $andSQL=''; + if (ereg("ALL-GROUPS",$agent_status_viewable_groups)) + {$AGENTviewSQL = "";} + else + { + $AGENTviewSQL = "($agent_status_viewable_groupsSQL)"; + + if (ereg("CAMPAIGN-AGENTS",$agent_status_viewable_groups)) + {$AGENTviewSQL = "($AGENTviewSQL or (campaign_id='$campaign'))";} + $AGENTviewSQL = "and $AGENTviewSQL"; + } + if ($comments=='AgentXferViewSelect') + {$AGENTviewSQL .= " and (vla.closer_campaigns LIKE \"%AGENTDIRECT%\")";} + + + 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);} + if ($rslt) {$agents_count = mysql_num_rows($rslt);} + $loop_count=0; + while ($agents_count > $loop_count) + { + $row=mysql_fetch_row($rslt); + $user = $row[0]; + $status = $row[1]; + $full_name = $row[2]; + $call_start = $row[3]; + $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; + + if ( ($status=='READY') or ($status=='CLOSER') ) + { + $statuscolor='#ADD8E6'; + $call_time = ($StarTtime - $call_finish); + } + if ( ($status=='QUEUE') or ($status=='INCALL') ) + { + $statuscolor='#D8BFD8'; + $call_time = ($StarTtime - $call_start); + } + if ($status=='PAUSED') + { + $statuscolor='#F0E68C'; + $call_time = ($StarTtime - $call_finish); + } + + if ($call_time < 1) + { + $call_time = "0:00"; + } + else + { + $Fminutes_M = ($call_time / 60); + $Fminutes_M_int = floor($Fminutes_M); + $Fminutes_M_int = intval("$Fminutes_M_int"); + $Fminutes_S = ($Fminutes_M - $Fminutes_M_int); + $Fminutes_S = ($Fminutes_S * 60); + $Fminutes_S = round($Fminutes_S, 0); + if ($Fminutes_S < 10) {$Fminutes_S = "0$Fminutes_S";} + $call_time = "$Fminutes_M_int:$Fminutes_S"; + } + + if ($comments=='AgentXferViewSelect') + { + $AXVSuserORDER[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = $call_time; + $AXVSstatuscolor[$j] = $statuscolor; + $j++; + } + else + { + echo ""; + if ($agent_status_view_time > 0) + {echo "";} + echo ""; + } + $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') + { + $AXVSuserORDER[$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 "
  "; + echo "$row[0] - $row[2]"; + echo "   $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($AXVSuserORDER); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserORDER[$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      -Indgående      -PAUSE  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} + + echo "\n"; + } + + +################################################################################ +### CALLSINQUEUEview - List calls in queue for the bottombar 228 +################################################################################ +if ($ACTION == 'CALLSINQUEUEview') + { + $stmt="SELECT view_calls_in_queue,grab_calls_in_queue from vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00228',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $view_calls_in_queue = $row[0]; + $grab_calls_in_queue = $row[1]; + + if (eregi('NONE',$view_calls_in_queue)) + { + echo "Muligheden for at se opkald i kø er ikke aktivt i denne kampanje\n"; + exit; + } + else + { + $view_calls_in_queue = ereg_replace('ALL','99', $view_calls_in_queue); + + ### grab the status and campaign/in-group information for this agent to display + $ADsql=''; + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00229',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the basic data på calls in the queue for this agent + $stmt="SELECT lead_id,campaign_id,phone_number,uniqueid,UNIX_TIMESTAMP(call_time),call_type,auto_call_id from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql) order by queue_priority,call_time;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00230',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$calls_count = mysql_num_rows($rslt);} + $loop_count=0; + while ($calls_count > $loop_count) + { + $row=mysql_fetch_row($rslt); + $CQlead_id[$loop_count] = $row[0]; + $CQcampaign_id[$loop_count] = $row[1]; + $CQphone_number[$loop_count] = $row[2]; + $CQuniqueid[$loop_count] = $row[3]; + $CQcall_time[$loop_count] = $row[4]; + $CQcall_type[$loop_count] = $row[5]; + $CQauto_call_id[$loop_count] = $row[6]; + $loop_count++; + } + + ### re-order the calls to always make sure the AGENTDIRECT calls are first + $loop_count=0; + $o=0; + while ($calls_count > $loop_count) + { + if (eregi('AGENTDIRECT', $CQcampaign_id[$loop_count])) + { + $OQlead_id[$o] = $CQlead_id[$loop_count]; + $OQcampaign_id[$o] = $CQcampaign_id[$loop_count]; + $OQphone_number[$o] = $CQphone_number[$loop_count]; + $OQuniqueid[$o] = $CQuniqueid[$loop_count]; + $OQcall_time[$o] = $CQcall_time[$loop_count]; + $OQcall_type[$o] = $CQcall_type[$loop_count]; + $OQauto_call_id[$o] = $CQauto_call_id[$loop_count]; + $o++; + } + $loop_count++; + } + $loop_count=0; + while ($calls_count > $loop_count) + { + if (!eregi('AGENTDIRECT', $CQcampaign_id[$loop_count])) + { + $OQlead_id[$o] = $CQlead_id[$loop_count]; + $OQcampaign_id[$o] = $CQcampaign_id[$loop_count]; + $OQphone_number[$o] = $CQphone_number[$loop_count]; + $OQuniqueid[$o] = $CQuniqueid[$loop_count]; + $OQcall_time[$o] = $CQcall_time[$loop_count]; + $OQcall_type[$o] = $CQcall_type[$loop_count]; + $OQauto_call_id[$o] = $CQauto_call_id[$loop_count]; + $o++; + } + $loop_count++; + } + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + ### Print call information and gather more info på the calls as they are printed + $loop_count=0; + while ( ($calls_count > $loop_count) and ($view_calls_in_queue > $loop_count) ) + { + $call_time = ($StarTtime - $OQcall_time[$loop_count]); + $Fminutes_M = ($call_time / 60); + $Fminutes_M_int = floor($Fminutes_M); + $Fminutes_M_int = intval("$Fminutes_M_int"); + $Fminutes_S = ($Fminutes_M - $Fminutes_M_int); + $Fminutes_S = ($Fminutes_S * 60); + $Fminutes_S = round($Fminutes_S, 0); + if ($Fminutes_S < 10) {$Fminutes_S = "0$Fminutes_S";} + $call_time = "$Fminutes_M_int:$Fminutes_S"; + $call_handle_method=''; + + if ($OQcall_type[$loop_count]=='IN') + { + $stmt="SELECT group_name,group_color from vicidial_inbound_groups where group_id='$OQcampaign_id[$loop_count]';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00231',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $group_name = $row[0]; + $group_color = $row[1]; + } + $stmt="SELECT comments,user,first_name,last_name from vicidial_list where lead_id='$OQlead_id[$loop_count]'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00232',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $comments = $row[0]; + $agent = $row[1]; + $first_last_name = "$row[2] $row[3]"; + $caller_name = $first_last_name; + + $stmt="SELECT full_name from vicidial_users where user='$agent'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00232',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$agent_name_count = mysql_num_rows($rslt);} + if ($agent_name_count > 0) + { + $row=mysql_fetch_row($rslt); + $agent_name = $row[0]; + } + else + {$agent_name='';} + + if (strlen($caller_name)<2) + {$caller_name = $comments;} + if (strlen($caller_name) > 30) {$caller_name = substr("$caller_name", 0, 30);} + + if (eregi("0$|2$|4$|6$|8$", $loop_count)) {$Qcolor='bgcolor="#FCFCFC"';} + else{$Qcolor='bgcolor="#ECECEC"';} + + if ( (eregi('Y',$grab_calls_in_queue)) and ($OQcall_type[$loop_count]=='IN') ) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + else + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + $loop_count++; + } + echo "
    PHONE     NAME     WAIT     AGENT           OPKALD GROUP     TYPE  
TAKE OPKALD     $OQphone_number[$loop_count]     $caller_name     $call_time     $agent - $agent_name           $OQcampaign_id[$loop_count] - $group_name     $OQcall_type[$loop_count]  
    $OQphone_number[$loop_count]     $caller_name     $call_time     $agent - $agent_name           $OQcampaign_id[$loop_count] - $group_name     $OQcall_type[$loop_count]  

 \n"; + } + } + + +################################################################################ +### 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     STATUS     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     RING  
Ingen opfordrer denne dag
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Luk Opkaldslog"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Gå tilbage"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Resultater fundet: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set sekunder='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STATUS     LAST OPKALD     CITY     STATE     ZIP     INFO     RING  
Ingen resultater fundet
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Ingen resultater fundet
"; + echo "
"; + echo "Gå tilbage"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Gå tilbage"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampanje not found\n"; + echo "

"; + echo "Gå tilbage"; + echo "
"; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Gå tilbage"; + echo "
"; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Resultater fundet: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set sekunder='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Ingen resultater fundet
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Ingen resultater fundet
"; + echo "
"; + echo "Gå tilbage"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Gå tilbage"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampanje not found\n"; + echo "

"; + echo "Gå tilbage"; + echo "
"; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Tilbagekald status:   $row[0]
Tilbagekald Lead status:   $row[7]
Tilbagekald Nedstigning:   $row[1]
Tilbagekald Trigger Time:   $row[2]
Tilbagekald Kommentarer:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Títel'; + $label_first_name = 'Første'; + $label_middle_initial = 'MI'; + $label_last_name = 'Sidste'; + $label_address1 = 'Adresse1'; + $label_address2 = 'Adresse2'; + $label_address3 = 'Adresse3'; + $label_city = 'By'; + $label_state = 'Stat'; + $label_province = 'Provins'; + $label_postal_code = 'Postnummer'; + $label_vendor_lead_code = 'Vendor ID'; + $label_gender = 'Gender'; + $label_phone_number = 'Telefon'; + $label_phone_code = 'Landsnummer'; + $label_alt_phone = 'Alt. telefon'; + $label_security_phrase = 'Vis'; + $label_email = 'Email'; + $label_comments = 'kommentar'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefon and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon Area Code Udenfor Dialable Zone $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Postnummer Udenfor Dialable Zone $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon Area Code Udenfor Dialable Zone $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Postnummer Udenfor Dialable Zone $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Status:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Opringt Since Sidste Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Opringt Count:   $row[24]
Sidste Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
CALL log for denne LEAD:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STATUS     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Ingen opkald fundet
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + +################################################################################ +### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent +################################################################################ +if ($ACTION == 'CALLSINQUEUEgrab') + { + $stmt="SELECT view_calls_in_queue,grab_calls_in_queue from vicidial_campaigns where campaign_id='$campaign'"; + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00233',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $view_calls_in_queue = $row[0]; + $grab_calls_in_queue = $row[1]; + + if ( (eregi('NONE',$view_calls_in_queue)) or (eregi('N',$grab_calls_in_queue)) ) + { + echo "ERROR: Muligheden for at se opkald i kø er ikke aktivt i denne kampanje\n"; + exit; + } + else + { + $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($stmtU, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00270',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$vac_count = mysql_num_rows($rslt);} + if ($vac_count > 0) + { + $row=mysql_fetch_row($rslt); + $GCcall_time = $row[0]; + $GCcampaign_id = $row[1]; + $GCuniqueid = $row[2]; + $GCphone_number = $row[3]; + $GClead_id = $row[4]; + $GCqueue_priority = $row[5]; + $GCcall_type = $row[6]; + + $stmt="INSERT INTO vicidial_grab_call_log SET auto_call_id='$stage',user='$user',event_date='$NOW_TIME',call_time='$GCcall_time',campaign_id='$GCcampaign_id',uniqueid='$GCuniqueid',phone_number='$GCphone_number',lead_id='$GClead_id',queue_priority='$GCqueue_priority',call_type='$GCcall_type';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00271',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + } + + echo "SUCCESS: Call $stage grabbed for $user"; + } + else + { + echo "ERROR: Call $stage could not be grabbed for $user\n"; + } + + $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; + } + } + + +################################################################################ +### CalLBacKLisT - List the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKLisT') + { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; + if ($agentonly_callback_campaign_lock > 0) + {$campaignCBsql = "and campaign_id='$campaign'";} + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} + echo "$callbacks_count\n"; + $loop_count=0; + while ($callbacks_count>$loop_count) + { + $row=mysql_fetch_row($rslt); + $callback_id[$loop_count] = $row[0]; + $lead_id[$loop_count] = $row[1]; + $campaign_id[$loop_count] = $row[2]; + $status[$loop_count] = $row[3]; + $entry_time[$loop_count] = $row[4]; + $callback_time[$loop_count] = $row[5]; + $comments[$loop_count] = $row[6]; + $loop_count++; + } + $loop_count=0; + while ($callbacks_count>$loop_count) + { + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; + $loop_count++; + } + + } + + +################################################################################ +### CalLBacKCounT - send the count of the USERONLY callbacks for an agent +################################################################################ +if ($ACTION == 'CalLBacKCounT') + { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; + if ($agentonly_callback_campaign_lock > 0) + {$campaignCBsql = "and campaign_id='$campaign'";} + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $cbcount=$row[0]; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; + } + + + + +################################################################################ +### DiaLableLeaDsCounT - send the count of the dialable leads in this campaign +################################################################################ +if ($ACTION == 'DiaLableLeaDsCounT') + { + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$dialable_count = mysql_num_rows($rslt);} + if ($dialable_count > 0) + { + $row=mysql_fetch_row($rslt); + $DLcount = $row[0]; + } + + echo "$DLcount"; + } + + +################################################################################ +### 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') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + + +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) + { + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } + } + + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_dk/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_dk/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_dk/vdc_script_display.php new file mode 100644 index 00000000..6cd51669 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/vdc_script_display.php @@ -0,0 +1,523 @@ + LICENSE: AGPLv2 +# +# This script is designed display the contents of the SCRIPT tab in the agent interface +# +# CHANGELOG: +# 90824-1435 - First build of script +# 90827-1548 - Added list override script option +# 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll +# + +$version = '2.4-11'; +$build = '120227-2017'; + +require("dbconnect.php"); + + +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} + $vendor_lead_code = $vendor_id; +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];} + elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["title"])) {$title=$_GET["title"];} + elseif (isset($_POST["title"])) {$title=$_POST["title"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];} + elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["address1"])) {$address1=$_GET["address1"];} + elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];} +if (isset($_GET["address2"])) {$address2=$_GET["address2"];} + elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];} +if (isset($_GET["address3"])) {$address3=$_GET["address3"];} + elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +if (isset($_GET["gender"])) {$gender=$_GET["gender"];} + elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];} +if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];} + elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];} +if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];} + elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +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["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["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +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["source_id"])) {$source_id=$_GET["source_id"];} + elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];} +if (isset($_GET["rank"])) {$rank=$_GET["rank"];} + elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];} +if (isset($_GET["owner"])) {$owner=$_GET["owner"];} + elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];} +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"];} +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"];} + 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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'; +$script_height = ($script_height - 20); + +$IFRAME=0; + +############################################# +##### 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); + } + + +# 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 "Invalid Username/Password: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +if ($format=='debug') + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "VICIDiaL Script Display Script"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if (strlen($in_script) < 1) + {$call_script = $camp_script;} +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';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $agent_script_override = $row[0]; + if (strlen($agent_script_override) > 0) + {$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); +$script_name = $row[0]; +$script_text = stripslashes($row[1]); + +if (eregi("iframe src",$script_text)) + { + $IFRAME=1; + $lead_id = eregi_replace(' ','+',$lead_id); + $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); + $title = eregi_replace(' ','+',$title); + $first_name = eregi_replace(' ','+',$first_name); + $middle_initial = eregi_replace(' ','+',$middle_initial); + $last_name = eregi_replace(' ','+',$last_name); + $address1 = eregi_replace(' ','+',$address1); + $address2 = eregi_replace(' ','+',$address2); + $address3 = eregi_replace(' ','+',$address3); + $city = eregi_replace(' ','+',$city); + $state = eregi_replace(' ','+',$state); + $province = eregi_replace(' ','+',$province); + $postal_code = eregi_replace(' ','+',$postal_code); + $country_code = eregi_replace(' ','+',$country_code); + $gender = eregi_replace(' ','+',$gender); + $date_of_birth = eregi_replace(' ','+',$date_of_birth); + $alt_phone = eregi_replace(' ','+',$alt_phone); + $email = eregi_replace(' ','+',$email); + $security_phrase = eregi_replace(' ','+',$security_phrase); + $comments = eregi_replace(' ','+',$comments); + $user = eregi_replace(' ','+',$user); + $pass = eregi_replace(' ','+',$pass); + $campaign = eregi_replace(' ','+',$campaign); + $phone_login = eregi_replace(' ','+',$phone_login); + $original_phone_login = eregi_replace(' ','+',$original_phone_login); + $phone_pass = eregi_replace(' ','+',$phone_pass); + $fronter = eregi_replace(' ','+',$fronter); + $closer = eregi_replace(' ','+',$closer); + $group = eregi_replace(' ','+',$group); + $channel_group = eregi_replace(' ','+',$channel_group); + $SQLdate = eregi_replace(' ','+',$SQLdate); + $epoch = eregi_replace(' ','+',$epoch); + $uniqueid = eregi_replace(' ','+',$uniqueid); + $customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel); + $customer_server_ip = eregi_replace(' ','+',$customer_server_ip); + $server_ip = eregi_replace(' ','+',$server_ip); + $SIPexten = eregi_replace(' ','+',$SIPexten); + $session_id = eregi_replace(' ','+',$session_id); + $phone = eregi_replace(' ','+',$phone); + $parked_by = eregi_replace(' ','+',$parked_by); + $dispo = eregi_replace(' ','+',$dispo); + $dialed_number = eregi_replace(' ','+',$dialed_number); + $dialed_label = eregi_replace(' ','+',$dialed_label); + $source_id = eregi_replace(' ','+',$source_id); + $rank = eregi_replace(' ','+',$rank); + $owner = eregi_replace(' ','+',$owner); + $camp_script = eregi_replace(' ','+',$camp_script); + $in_script = eregi_replace(' ','+',$in_script); + $script_width = eregi_replace(' ','+',$script_width); + $script_height = eregi_replace(' ','+',$script_height); + $fullname = eregi_replace(' ','+',$fullname); + $recording_filename = eregi_replace(' ','+',$recording_filename); + $recording_id = eregi_replace(' ','+',$recording_id); + $user_custom_one = eregi_replace(' ','+',$user_custom_one); + $user_custom_two = eregi_replace(' ','+',$user_custom_two); + $user_custom_three = eregi_replace(' ','+',$user_custom_three); + $user_custom_four = eregi_replace(' ','+',$user_custom_four); + $user_custom_five = eregi_replace(' ','+',$user_custom_five); + $preset_number_a = eregi_replace(' ','+',$preset_number_a); + $preset_number_b = eregi_replace(' ','+',$preset_number_b); + $preset_number_c = eregi_replace(' ','+',$preset_number_c); + $preset_number_d = eregi_replace(' ','+',$preset_number_d); + $preset_number_e = eregi_replace(' ','+',$preset_number_e); + $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); + $web_vars = eregi_replace(' ','+',$web_vars); + } + +$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); +$script_text = eregi_replace('--A--title--B--',"$title",$script_text); +$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text); +$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text); +$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text); +$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text); +$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text); +$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text); +$script_text = eregi_replace('--A--city--B--',"$city",$script_text); +$script_text = eregi_replace('--A--state--B--',"$state",$script_text); +$script_text = eregi_replace('--A--province--B--',"$province",$script_text); +$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text); +$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text); +$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text); +$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text); +$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text); +$script_text = eregi_replace('--A--email--B--',"$email",$script_text); +$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text); +$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text); +$script_text = eregi_replace('--A--user--B--',"$user",$script_text); +$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text); +$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text); +$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text); +$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text); +$script_text = eregi_replace('--A--group--B--',"$group",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text); +$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text); +$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text); +$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text); +$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text); +$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text); +$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text); +$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text); +$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text); +$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text); +$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text); +$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text); +$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text); +$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text); +$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text); +$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text); +$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text); +$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text); +$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text); +$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text); +$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text); +$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text); +$script_text = eregi_replace('--A--preset_number_a--B--',"$preset_number_a",$script_text); +$script_text = eregi_replace('--A--preset_number_b--B--',"$preset_number_b",$script_text); +$script_text = eregi_replace('--A--preset_number_c--B--',"$preset_number_c",$script_text); +$script_text = eregi_replace('--A--preset_number_d--B--',"$preset_number_d",$script_text); +$script_text = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$script_text); +$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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); + + +echo "\n"; +echo "\n"; +echo "
\n"; +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} +echo "
$script_name
\n"; +echo "$script_text\n"; +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} +echo "
\n"; + +exit; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_dk/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_dk/vdc_script_notes.php new file mode 100644 index 00000000..3e5e678c --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/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 = 'Títel'; +$label_first_name = 'Første'; +$label_middle_initial = 'MI'; +$label_last_name = 'Sidste'; +$label_address1 = 'Adresse1'; +$label_address2 = 'Adresse2'; +$label_address3 = 'Adresse3'; +$label_city = 'By'; +$label_state = 'Stat'; +$label_province = 'Provins'; +$label_postal_code = 'Postnummer'; +$label_vendor_lead_code = 'Vendor ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'Landsnummer'; +$label_alt_phone = 'Alt. telefon'; +$label_security_phrase = 'Vis'; +$label_email = 'Email'; +$label_comments = 'kommentar'; + +$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 "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Notat"; +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 Notat:

+
Please click INDSEND to commit the changes,           * denotes required fields
+
+ + + + +
+ + +
+ + + + + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_dk/vicidial.php b/agc_2-X/trunk/LANG_www/agc_dk/vicidial.php new file mode 100644 index 00000000..afca8caf --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/vicidial.php @@ -0,0 +1,13910 @@ + LICENSE: AGPLv2 +# +# Other scripts that this application depends on: +# - vdc_db_query.php: Updates information in the database +# - 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 +# 50628-1620 - Added some basic formatting and worked on process flow +# 50628-1715 - Startup variables mapped to javascript variables +# 50629-1303 - Added Login Closer in-groups selection box and vla update +# 50629-1530 - Rough layout for customer info form section and button links +# 50630-1453 - Rough Manual Dial/Hangup with customer info displayed +# 50701-1450 - Added vicidial_log entries on dial and hangup +# 50701-1634 - Added Logout function +# 50705-1259 - Added call disposition functionality +# 50705-1432 - Added lead info DB update function +# 50705-1658 - Added web form functionality +# 50706-1043 - Added call park and pickup functions +# 50706-1234 - Added Start/Stop Recording functionality +# 50706-1614 - Added conference channels display option +# 50711-1333 - Removed call check redundancy and fixed a span bug +# 50727-1424 - Added customer channel and participant present sensing/alerts +# 50804-1057 - Added SendDTMF function and reconfigured the transfer span +# 50804-1224 - Added Local and Internal Closer transfer functions +# 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs +# 50804-1808 - Added button images for left buttons +# 50815-1151 - Added 3Way calling functions to Transfer-conf frame +# 50815-1602 - Added images and buttons for xfer functions +# 50816-1813 - Added basic autodial outbound call pickup functions +# 50817-1113 - Fixes to auto_dialing call receipt +# 50817-1234 - Added inbound call receipt capability +# 50817-1541 - Added customer time display +# 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option +# 50818-1703 - Added pretty login section +# 50825-1200 - Modified form field lengths, added double-click dispositions +# 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER +# 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug +# 50903-0904 - Added preview-lead code for manual dialing +# 50904-0016 - Added ability to hangup manual dials before pickup +# 50906-1319 - Added override for filters on xfer calls, fixed login display bug +# 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode +# 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use +# 50913-1212 - Added campaign_cid to 3rd party calls +# 50923-1546 - Modified to work with language translation +# 50926-1656 - Added campaign pull-down at login of active campaigns +# 50928-1633 - Added manual dial alternate number dial option +# 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs +# 51004-1656 - Fixed recording filename bug and new Spanish translation +# 51020-1103 - Added campaign-specific recording control abilities +# 51020-1352 - Added Basic vicidial_agent_log framework +# 51021-1050 - Fixed custtime display and disable Enter/Return keypresses +# 51021-1718 - Allows for multi-line comments (changes \n to !N in database) +# 51110-1432 - Fixed non-standard http port issue +# 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial +# 51118-1305 - Activate multi-line comments from $multi_line_comments var +# 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view +# 51121-1506 - Small PHP optimizations in many scripts and disabled globalize +# 51129-1010 - Added ability to accept calls from other VICIDIAL servers +# 51129-1254 - Fixed Hangups of other agents channels when customer hangs up +# 51208-1732 - Created user-first login that looks for default phone info +# 51219-1526 - Added variable framework for campaign and in-group scripts +# 51221-1200 - Added SCRIPT tab, layout and functionality +# 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup +# 51222-1605 - Added VMail message blind transfer button to xfer-conf frame +# 51229-1028 - Added checks on web_form_address to allow for var in the DB value +# 60117-1312 - Added Transfer-conf frame toggle on button press +# 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame +# 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys +# 60213-1210 - Added ability to sort routing of calls by user_level +# 60214-0932 - Initial Callback calendar display framework +# 60214-1407 - Added ability to minimize the dispo screen to see info below +# 60215-1104 - Added ANYONE scheduled callbacks functionality +# 60410-1116 - Added persistant pause after dispo option and change dispo text +# - Added web form submit that opens new window with dispo on submit +# - Added PREVIOUS CALLBACK in customer info to flag callbacks +# - Added link to try to hangup the call again in the dispo screen +# - Added link noone-in-session screen to call agent phone again +# - Added link customer-hungup screen to go straight to dispo screen +# 60410-1532 - Added agent status and campaign calls dialing display option +# 60411-1547 - Add ability to set callback as USERONLY and some basic formatting +# 60413-1752 - Add basic USERONLY callback frame and listings +# 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans +# - Added beta-level USERONLY callback functionality +# - Added beta-level manual dialing with lead insertion functionality +# 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug +# 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode +# - Changed several permissions to database-defined +# 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished +# 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error +# 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials +# 60426-1058 - Added vicidial_user setting for default blended check for CLOSER +# 60501-1008 - Added option to manual dial screen to manually lookup phone number +# 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen +# 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug +# - Fixed recording filename display to not overrun 25 characters +# 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo +# 60608-1453 - Added CLOSER campaign allowable in-groups limitations +# 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC +# 60619-1047 - Added variable filters to close security holes for login form +# 60804-1710 - fixed scheduled CALLBK for other languages build +# 60808-1145 - Added consultative transfers with customer data +# 60808-2232 - Added campaign name to pulldown for login screen +# 60809-1603 - Added option to locally transfer consult xfers +# 60809-1732 - Added recheck of transferred channels before customer gone mesg +# 60810-1011 - Fixed CXFER leave 3way call bugs +# 60816-1602 - Added ALLCALLS recording delay option allcalls_delay +# 60816-1716 - Fixed customer time display bug and client DST setting +# 60821-1555 - Added option to omit phone_code on dialout of leads +# 60821-1628 - Added ALLFORCE recording option +# 60821-1643 - Added no_delete_sessions option to not delete sessions +# 60822-0512 - Changed phone number fields to be maxlength of 12 +# 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php +# 60906-1152 - Added Previous CallBack info display span +# 60906-1715 - Allow for Local phone extension conferences +# 61004-1729 - Add ability to control volume per channel in "calls in this session" +# 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions +# 61122-1523 - Added more SCRIPT variables +# 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries +# 61130-1617 - Added lead_id to MonitorConf for recording_log +# 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT +# 70109-1128 - Fixed wrapup timer bug +# 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode +# - Added option for alternate number dialing with hotkeys +# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns +# 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group +# 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code +# 70201-1703 - Fixed cursor bug for most text input fields +# 70202-1453 - Added first portions of Agent Pause Codes +# 70203-0108 - Finished Agent Pause Codes functionality +# 70203-0930 - Added dialed_number to webform output +# 70203-1010 - Added dialed_label to webform output +# 70206-1201 - Fixed allow_closers bug +# 70206-1332 - Added vicidial_recording_override users setting function +# 70212-1252 - Fixed small issue with CXFER +# 70213-1018 - Changed CXFER and AXFER to update customer information before transfer +# 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log +# 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log +# 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL +# 70226-1252 - Added Mute/UnMute to agent screen +# 70309-1035 - Allow amphersands and questions marks in comments to pass through +# 70313-1052 - Allow pound signs(hash) in comments to pass through +# 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf +# 70319-1446 - Added agent-deactive-display and disable customer info update functions +# 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper +# 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen +# 70322-1545 - Added sipsak display ability +# 70510-1319 - Added onUnload force Logout +# 70806-1530 - Added Presets Dial links above agent mute button +# 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE +# 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM +# 71022-1427 - Added formatting of the customer phone number in the main status bar +# 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions +# 71101-1204 - Fixed bug in callback calendar with DST +# 71116-0957 - Added campaign_weight and calls_today to the vla table insertion +# 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login +# 71122-0256 - Added auto-pause notification +# 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to +# 71127-0408 - Added height and width settings for easier modification of screen size +# 71129-2025 - restricted callbacks count and list to campaign only +# 71223-0318 - changed logging of closer calls +# 71226-1117 - added option to kick all calls from conference upon logout +# 80109-1510 - added gender select list +# 80116-1032 - added option on CLOSER-type campaigns to change in-groups when paused +# 80317-2106 - added recording override options for inbound group calls +# 80331-1433 - Added second transfer try for VICIDIAL transfers/hangups on manual dial calls +# 80402-0121 - Fixes for manual dial transfers on some systems +# 80407-2112 - Work on adding phone login load balancing across servers +# 80416-0559 - Added ability to log computer_ip at login, set the $PhonESComPIP variable +# 80428-0413 - UTF8 changes and testing +# 80505-0054 - Added multi-phones load-balanced alias option +# 80507-0932 - Fixed Script display bug (+ instead of space) +# 80519-1425 - Added calls in queue display +# 80523-1630 - Added Timeclock links +# 80625-0047 - Added U option for gender, added date/phone display options +# 80630-2210 - Added queue_log entries for Manual Dial +# 80703-0139 - Added alter customer phone permissions +# 80703-1106 - Added API functionality for Hangup and Dispo, added Agent Display Queue Count +# 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording +# 80709-0358 - Added Default alt phone dial hard-code option +# 80719-1147 - Changed recording and senddtmf conf prefix +# 80815-1014 - Added manual dial list restriction option +# 80823-2123 - Fixed form scroll for IE, added copy to clipboard(IE-only feature) +# 80831-0548 - Added Extended alt-dial-phone display information for non-manual calls +# 80909-1717 - Added support for campaign-specific DNC lists +# 80915-1754 - Rewrote leave-3way functions for external calling +# 81002-1908 - Fixed double-login bug in some conditions +# 81007-0945 - Added three_way_call_cid option for outbound 3way calls +# 81010-1047 - Fixed conf calling prefix to use settings, other 3way improvements +# 81011-1403 - Fixed bugs in leave3way when transferring a manual dial call +# 81012-1729 - Added INBOUND_MAN dial method to allow manual list dialing and inbound calls +# 81013-1644 - Fixed bug in leave 3way for manual dial fronters +# 81015-0405 - Fixed bug related to hangups on 3way calls +# 81016-0703 - Changed leave 3way to allow function at any time transfer-conf is available +# 81020-1501 - Fixed bugs in queue_log logging +# 81023-0411 - Added compatibility for dial-in agents using AGI, bug fixes +# 81030-0403 - Added option to force Pause Codes on PAUSE +# 81103-1427 - Added 3way call dial prefix +# 81104-0140 - Added mysql error logging capability +# 81104-1618 - Changed MySQL queries logging +# 81106-0411 - Changedthe campaign login list behaviour +# 81110-0057 - Changed Pause time to start new vicidial_agent_log on every pause +# 81110-1514 - Added hangup_all_non_reserved to fix non-Hangup bug +# 81119-1811 - webform backslash fix +# 81124-2213 - Fixes blind transfer bug +# 81209-1617 - Added campaign web form target option and web form address variables +# 81211-0422 - Fixed Manual dial agent_log bug +# 90102-1402 - Added time sync check notification +# 90115-0619 - Added ability to send Local Closer to AGENTDIRECT agent_only +# 90120-1719 - Added API pause/resume and number dial functionality +# 90126-2302 - Added Vtiger login option and agent alert option +# 90128-0230 - Added vendor_lead_code to API dial and manuald dial with lookup +# 90202-0148 - Added option to disable BLENDED checkbox +# 90209-0132 - Changed tab images and color scheme +# 90303-1145 - Fixed rare manual dial live hangup bug +# 90304-1333 - Added user-specific web vars option +# 90305-0917 - Added prefix-choice and group-alias options for calls coming from API +# 90307-1736 - Added Shift enforcement and manager override features +# 90315-1009 - Changed revision for new trunk 2.2.0 +# 90320-0309 - Fixed agent log bug when using wrapup time +# 90323-1555 - Initial call to agent phone now has campaign callerIDnumber +# 90408-0104 - Added Vtiger callback record ability +# 90508-0727 - Changed to PHP long tags +# 90511-1018 - Added restriction not allowing dialing into agent sessions from manual dial +# 90519-0635 - Fixed manual dial status and logging bug +# 90525-1012 - Fixed transfer issue of auto-received call after manual dial call +# 90529-0741 - Added nophone agent phone login that will not show any empty session alerts +# 90531-0635 - Added option to hide customer phone number +# 90611-1422 - Fixed multiple logging bugs +# 90628-0655 - Added Quick Transfer button and Preset Prepopulate option +# 90705-1400 - Added Agent view sidebar option +# 90706-1432 - Added Agent view transfer selection +# 90709-1649 - Fixed alt-number transfers and dispo variable reset for webform +# 90712-2304 - Added ADD-ALL group selection, view calls in queue, grab call from queue, requeue button +# 90717-0640 - Added dialed_label and dialed_number to script variables +# 90721-1114 - Added rank and owner as vicidial_list fields +# 90726-2012 - Added allow_alerts option +# 90729-0647 - Added agent_display_dialable_leads option +# 90730-0145 - Fixed bugs in re-queue and INBOUND_MAN with blended selected +# 90808-0117 - Fixed manual dial calls today bug, added last_state_change to vicidial_live_agents +# 90812-0046 - Added no-delete-sessions = 1 as default, unused sessions cleared out at timeclock end of day +# 90814-0829 - Moved mute button next to hotkeys button +# 90827-0133 - Reworked Script display code +# 90827-1549 - Added list script override option, original_phone_login variable +# 90831-1456 - Added active_agent_login_server option for servers +# 90908-1038 - Added DEAD call display +# 90909-0921 - Fixed park issues +# 90916-1144 - Added Second web form button, Answering Machine Message change +# 90917-1325 - Fixed script loading bug with customer webform at the same time +# 90920-2108 - Changed web forms to use window.open instead of traditional links(IE7 compatibility issue) +# 90923-1310 - Rolled back last change +# 90928-1955 - Added lead update before closer transfer +# 90930-2243 - Added Territory selection functions +# 91108-2118 - Added QM pause code entry +# 91111-1433 - Fixed Gender pulldown list display for IE, remove links for recording channels in SHOW CHANNELS +# 91123-1801 - Added code for outbound_autodial field +# 91130-2021 - Added code for manager override of in-group selection +# 91204-1638 - Added recording_filename and recording_id script variables and script refresh link +# 91205-2055 - Added CONSULTATIVE checkbox in a redesigned Transfer-Conf frame +# 91206-2020 - Fixed vicidial_agent_log logging bug on logout when not paused +# 91211-1412 - Added User custom variables and CRM login popup +# 91219-0657 - Set pause code automatically on ReQueue and INBOUND_MAN Dial-Next-Number +# 91228-1339 - Added API "fields update" functions and "timer action" functions +# 100103-1250 - Added 3 more conf-presets, list ID override presets and call start/dispo URLs +# 100107-0108 - Added dynamic screen size based on login screen browser dimensions +# 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 +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay +# + +$version = '2.4-344c'; +$build = '120403-1204'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=75; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["JS_browser_width"])) {$JS_browser_width=$_GET["JS_browser_width"];} + elseif (isset($_POST["JS_browser_width"])) {$JS_browser_width=$_POST["JS_browser_width"];} +if (isset($_GET["JS_browser_height"])) {$JS_browser_height=$_GET["JS_browser_height"];} + elseif (isset($_POST["JS_browser_height"])) {$JS_browser_height=$_POST["JS_browser_height"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];} + elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (isset($_GET["MGR_override"])) {$MGR_override=$_GET["MGR_override"];} + elseif (isset($_POST["MGR_override"])) {$MGR_override=$_POST["MGR_override"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (isset($VD_campaign)) + { + $VD_campaign = strtoupper($VD_campaign); + $VD_campaign = eregi_replace(" ",'',$VD_campaign); + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); +$VD_campaign = ereg_replace("[^-_0-9a-zA-Z]","",$VD_campaign); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Du er nu logget ud. Tak\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; + + +$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,static_agent_url,custom_fields_enabled,pllb_grouping_limit FROM system_settings;"; +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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]; + $SSpllb_grouping_limit = $row[13]; + } +##### END SETTINGS LOOKUP ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$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 på hold count +$agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count + $campagentstatctmax = '3'; # Number of sekunder for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name på 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 på 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 RING link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups på 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 læg på kunde +$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 RING 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 på the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of sekunder to delay consultative transfers when customfields are active + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY + +$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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location på the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +### BEGIN find any custom field labels ### +$label_title = 'Títel'; +$label_first_name = 'Første'; +$label_middle_initial = 'MI'; +$label_last_name = 'Sidste'; +$label_address1 = 'Adresse1'; +$label_address2 = 'Adresse2'; +$label_address3 = 'Adresse3'; +$label_city = 'By'; +$label_state = 'Stat'; +$label_province = 'Provins'; +$label_postal_code = 'Postnummer'; +$label_vendor_lead_code = 'Vendor ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'Landsnummer'; +$label_alt_phone = 'Alt. telefon'; +$label_security_phrase = 'Vis'; +$label_email = 'Email'; +$label_comments = 'kommentar'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + +if ($campaign_login_list > 0) + { + $camp_form_code = "\n"; + } +else + { + $camp_form_code = "\n"; + } + + +if ($LogiNAJAX > 0) + { + ?> + + + + + + + + Agent web client: Logpå igen\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "
\"VICIdial\" Logpå igen
 
Telefon login:
Telefon password:
Bruger login:
Bruger password:
Kampanje: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +if ($user_login_first == 1) + { + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Agent web client: Kampanje login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

Bruger login

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Kampanje login
 
Bruger login:
Bruger password:
Kampanje: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + 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 "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "
\"VICIdial\" Login
 
Telefon login:
Telefon password:
Bruger login: /
Bruger password:
Kampanje: $camp_form_code
\"   \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + } + } + } + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Agent web client: Telefon login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "
\"VICIdial\" phone login
 
Telefon login:
Telefon password:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; + + if ( (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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override,preset_contact_search from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $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]; + $VU_agent_lead_search_override = $row[26]; + $VU_preset_contact_search = $row[27]; + + + 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"); + $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;"; + $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 = "DU SKAL FØST LOGGE PÅ STEMPELKLOKKEN
"; + } + } + ### 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)) ) + { + $shift_ok=0; + if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "FEJL: Ingen vagter er aktiveret for din bruger gruppe
"; + } + 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 = "FEJL: Du må ikke logge ind udenfor din vagttid
"; + } + } + 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.= "Din leder Login:
\n"; + $VDdisplayMESSAGE.= "Din lederPassword:
\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|XXXX|$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: Kampanje login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 " Login: \n
"; + echo "Password:
\n"; + echo "Kampanje: $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) + { + $VARstatuses=''; + $VARstatusnames=''; + $VARSELstatuses=''; + $VARSELstatuses_ct=0; + $VARCBstatuses=''; + $VARCBstatusesLIST=''; + ##### grab the statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name,scheduled_callback,selectable FROM vicidial_statuses WHERE status != 'NEW' order by status limit 500;"; + $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]; + $CBstatuses[$i] =$row[2]; + $SELstatuses[$i] =$row[3]; + if ($TEST_all_statuses > 0) {$SELstatuses[$i]='Y';} + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $VARSELstatuses = "$VARSELstatuses'$SELstatuses[$i]',"; + $VARCBstatuses = "$VARCBstatuses'$CBstatuses[$i]',"; + if ($CBstatuses[$i] == 'Y') + {$VARCBstatusesLIST .= " $statuses[$i]";} + if ($SELstatuses[$i] == 'Y') + {$VARSELstatuses_ct++;} + $i++; + } + + ##### grab the campaign-specific statuses that can be used for dispositioning by an agent + $stmt="SELECT status,status_name,scheduled_callback,selectable FROM vicidial_campaign_statuses WHERE status != 'NEW' and campaign_id='$VD_campaign' order by status limit 500;"; + $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]; + $CBstatuses[$i] =$row[2]; + $SELstatuses[$i] =$row[3]; + if ($TEST_all_statuses > 0) {$SELstatuses[$i]='Y';} + $VARstatuses = "$VARstatuses'$statuses[$i]',"; + $VARstatusnames = "$VARstatusnames'$status_names[$i]',"; + $VARSELstatuses = "$VARSELstatuses'$SELstatuses[$i]',"; + $VARCBstatuses = "$VARCBstatuses'$CBstatuses[$i]',"; + if ($CBstatuses[$i] == 'Y') + {$VARCBstatusesLIST .= " $statuses[$i]";} + if ($SELstatuses[$i] == 'Y') + {$VARSELstatuses_ct++;} + $i++; + $j++; + } + $VD_statuses_ct = ($VD_statuses_ct+$VD_statuses_camp); + $VARstatuses = substr("$VARstatuses", 0, -1); + $VARstatusnames = substr("$VARstatusnames", 0, -1); + $VARSELstatuses = substr("$VARSELstatuses", 0, -1); + $VARCBstatuses = substr("$VARCBstatuses", 0, -1); + $VARCBstatusesLIST .= " "; + + ##### 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,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment,auto_pause_precall,auto_pause_precall_code,auto_resume_precall,manual_dial_cid,custom_3way_button_transfer,callback_days_limit,disable_dispo_screen,disable_dispo_status,screen_labels,status_display_fields,pllb_grouping,pllb_grouping_limit 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]; + $api_manual_dial = $row[82]; + $manual_dial_call_time_check = $row[83]; + $my_callback_option = $row[84]; + $per_call_notes = $row[85]; + $agent_lead_search = $row[86]; + $agent_lead_search_method = $row[87]; + $qm_phone_environment = $row[88]; + $auto_pause_precall = $row[89]; + $auto_pause_precall_code = $row[90]; + $auto_resume_precall = $row[91]; + $manual_dial_cid = $row[92]; + $custom_3way_button_transfer = $row[93]; + $callback_days_limit = $row[94]; + $disable_dispo_screen = $row[95]; + $disable_dispo_status = $row[96]; + $screen_labels = $row[97]; + $status_display_fields = $row[98]; + $pllb_grouping = $row[99]; + $pllb_grouping_limit = $row[100]; + + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($qm_phone_environment)>0) ) + {$qm_phone_environment .= "-$qm_extension";} + + $status_display_CALLID=0; + $status_display_LEADID=0; + $status_display_LISTID=0; + if (preg_match("/CALLID/",$status_display_fields)) + {$status_display_CALLID=1;} + if (preg_match("/LEADID/",$status_display_fields)) + {$status_display_LEADID=1;} + if (preg_match("/LISTID/",$status_display_fields)) + {$status_display_LISTID=1;} + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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 vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01073',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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 ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + + $hide_dispo_list=0; + if ( ($disable_dispo_screen == 'DISPO_ENABLED') or ($disable_dispo_screen == 'DISPO_SELECT_DISABLED') or (strlen($disable_dispo_status) < 1) ) + { + if ($disable_dispo_screen == 'DISPO_SELECT_DISABLED') + {$hide_dispo_list=1;} + $disable_dispo_screen=0; + $disable_dispo_status=''; + } + if ( ($disable_dispo_screen == 'DISPO_DISABLED') and (strlen($disable_dispo_status) > 0) ) + {$disable_dispo_screen=1;} + + if ( ($VU_agent_lead_search_override == 'ENABLED') or ($VU_agent_lead_search_override == 'DISABLED') ) + {$agent_lead_search = $VU_agent_lead_search_override;} + $AllowManualQueueCalls=1; + $AllowManualQueueCallsChoice=0; + if ($api_manual_dial == 'QUEUE') + { + $AllowManualQueueCalls=0; + $AllowManualQueueCallsChoice=1; + } + 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;} + + $custom_3way_button_transfer_enabled=0; + $custom_3way_button_transfer_park=0; + $custom_3way_button_transfer_view=0; + $custom_3way_button_transfer_contacts=0; + if (preg_match("/PRESET_|FIELD_/",$custom_3way_button_transfer)) + {$custom_3way_button_transfer_enabled=1;} + if (preg_match("/HOLD_/",$custom_3way_button_transfer)) + {$custom_3way_button_transfer_park=1; $custom_3way_button_transfer_enabled=1;} + if (preg_match("/VIEW_PRESET/",$custom_3way_button_transfer)) + {$custom_3way_button_transfer_view=1; $custom_3way_button_transfer_enabled=1;} + if ( (preg_match("/VIEW_CONTACTS/",$custom_3way_button_transfer)) and ($enable_xfer_presets == 'CONTACTS') and ($VU_preset_contact_search != 'DISABLED') ) + {$custom_3way_button_transfer_contacts=1; $custom_3way_button_transfer_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;} + } + + $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 = "Kampanje ikke aktiv, prøv igen
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "login er inkorrekt, prøv igen
"; + } + } + if ($VDloginDISPLAY) + { + echo "Agent web client: Kampanje login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "
\"VICIdial\" Kampanje login
 
Bruger login:
Bruger password:
Kampanje: $camp_form_code
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_found = $row[0]; + } + if ($alias_found > 0) + { + $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_name = $row[0]; + $phone_login = $row[1]; + } + } + + $pa=0; + if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) + { + $phoneSQL = "("; + $phones_auto = explode(',',$phone_login); + $phones_auto_ct = count($phones_auto); + while($pa < $phones_auto_ct) + { + if ($pa > 0) + {$phoneSQL .= " or ";} + $desc = ($phones_auto_ct - $pa); # traverse in reverse order + $phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')"; + $pa++; + } + $phoneSQL .= ")"; + } + else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";} + + $authphone=0; + #$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; + $stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01020',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Agent web client: Telefon login Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\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 "
\"VICIdial\" Login Error
 
Beklager din telefonlogin/password er ikke aktive på dette system, prøv igen:
 
Telefon login:
Telefon password:

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ##### BEGIN phone login load balancing functions ##### + ### go through the phones logins list to figure out which server has + ### fewest non-remote agents logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + $pb_valid_server_ips=''; + $pb_force_set=0; + while ( ($pb < $phones_auto_ct) and ($pb_force_set < 1) ) + { + ### 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]' and extension NOT LIKE \"R%\";"; + 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 if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'01070',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'01071',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pllb_grouping == 'ONE_SERVER_ONLY') or ($pllb_grouping == 'CASCADING') ) + { + if ($pllb_grouping == 'ONE_SERVER_ONLY') + { + ### one-server-only plib check + ### get number of agents logged in to each server + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01074',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowG=mysql_fetch_row($rslt); + + if ($rowG[0] > 0) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + $pb_force_set++; + echo "\n"; + } + } + else + { + ### cascading plib check + ### get number of agents logged in to each server + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01075',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowG=mysql_fetch_row($rslt); + + echo "\n"; + if ( ($rowG[0] > 0) and ($rowG[0] < $pllb_grouping_limit) and ($row[0] < $SSpllb_grouping_limit) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + $pb_force_set++; + echo "\n"; + } + } + } + if ($pb_force_set < 1) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + } + $pb++; + } + + + + + + + echo "\n"; + } + ##### END phone login load balancing functions ##### + + 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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); + } + + $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 ($protocol == 'EXTERNAL') + { + $protocol = 'Local'; + $extension = "$dialplan_number$AT$ext_context"; + } + if (preg_match("/Zap/i",$protocol)) + { + if (preg_match("/^1\.0|^1\.2|^1\.4\.1|^1\.4\.20|^1\.4\.21/i",$asterisk_version)) + {$do_nothing=1;} + else + { + $protocol = 'DAHDI'; + } + } + + $SIP_user = "$protocol/$extension"; + $SIP_user_DiaL = "$protocol/$extension"; + $qm_extension = "$extension"; + if ( (ereg('8300',$dialplan_number)) and (strlen($dialplan_number)<5) and ($protocol == 'Local') ) + { + $SIP_user = "$protocol/$extension$VD_login"; + $qm_extension = "$extension$VD_login"; + } + + # 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 på 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 på phone: $SIP_user på kampanje: $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,queuemetrics_pe_phone_append 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]; + $queuemetrics_pe_phone_append = $row[10]; + } + ##### 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') + { + $TEMP_SIP_user_DiaL = $SIP_user_DiaL; + if ($on_hook_agent == 'Y') + {$TEMP_SIP_user_DiaL = 'Local/8300@default';} + ### insert a NY record to the vicidial_manager table to be processed + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $TEMP_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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + } + + ##### grab the campaign_weight and number of calls today på that campaign for the agent + $stmt="SELECT campaign_weight,calls_today,campaign_grade 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]; + $campaign_grade = $row[2]; + $i++; + } + else + { + $campaign_weight = '0'; + $calls_today = '0'; + $campaign_grade = '1'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today,campaign_grade) values('$VD_login','$VD_campaign','0','0','$calls_today','$campaign_grade');"; + 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,on_hook_ring_time,on_hook_agent,last_inbound_call_time,last_inbound_call_finish,campaign_grade) 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','$phone_ring_timeout','$on_hook_agent','$NOW_TIME','$NOW_TIME','$campaign_grade');"; + 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') or ($queuemetrics_loginout=='NONE') ) + { + $QM_LOGIN = 'AGENTCALLBACKLOGIN'; + $QM_PHONE = "$SIP_user_DiaL"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($qm_phone_environment)>0) ) + {$qm_phone_environment .= "-$qm_extension";} + + if ($queuemetrics_loginout!='NONE') + { + $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',data4='$qm_phone_environment';"; + 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',data4='$qm_phone_environment';"; + 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',data4='$qm_phone_environment';"; + 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,on_hook_ring_time,on_hook_agent,campaign_grade) 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','$phone_ring_timeout','$on_hook_agent','$campaign_grade');"; + 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') or ($queuemetrics_loginout=='NONE') ) + { + $QM_LOGIN = 'AGENTCALLBACKLOGIN'; + $QM_PHONE = "$SIP_user_DiaL"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + if ($queuemetrics_loginout!='NONE') + { + $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',data4='$qm_phone_environment';"; + 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',data4='$qm_phone_environment';"; + 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"; + + 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',data4='$qm_phone_environment';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01072',$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: Kampanje login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\n"; + echo "Beklager der er ingen leads i hoppern til denne kampanje\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " Login: \n
"; + echo "Password:
\n"; + echo "Kampanje: $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: Kampanje login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Stempelklokke
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dansk
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " Login: \n
"; + echo "Password:
\n"; + echo "Kampanje: $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',data3='$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,'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 ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($per_call_notes == 'ENABLED') + { + if ($MASTERheight < 340) {$MASTERheight = '340';} + } +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call sekunder counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - sekunder på call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + +################################################################ +### BEGIN - build the callback calendar (12 months) ### +################################################################ +define ('ADAY', (60*60*24)); +$CdayARY = getdate(); +$Cmon = $CdayARY['mon']; +$Cyear = $CdayARY['year']; +$CTODAY = date("Y-m"); +$CTODAYmday = date("j"); +$CINC=0; +$live_days=0; +$limit_days=999; +if ($callback_days_limit > 0) + {$limit_days=$callback_days_limit;} + +$Cmonths = Array('Januar','February','Marts','April','Maj','Juni', + 'Juli','August','September','Oktober','November','December'); +$Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); + +$CCAL_OUT = ''; + +$CCAL_OUT .= ""; + +while ($CINC < 12) + { + if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "";} + + $CCAL_OUT .= ""; + + if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} + $CINC++; + } + +$CCAL_OUT .= "
"; + + $CYyear = $Cyear; + $Cmonth= ($Cmon + $CINC); + if ($Cmonth > 12) + { + $Cmonth = ($Cmonth - 12); + $CYyear++; + } + $Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); + $CfirstdayARY = getdate($Cstart); + #echo "|$Cmon|$Cmonth|$CINC|\n"; + $CPRNTDAY = date("Y-m", $Cstart); + + $CCAL_OUT .= ""; + $CCAL_OUT .= ""; + $CCAL_OUT .= ""; + $CCAL_OUT .= ""; + + foreach($Cdays as $Cday) + { + $CDCLR="#ffffff"; + $CCAL_OUT .= ""; + } + + for( $Ccount=0;$Ccount<(6*7);$Ccount++) + { + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + if ($limit_days > $live_days) + { + $CBL = ""; + $CEL = ""; + } + else + {$CBL=''; $CEL='';} + $CCAL_OUT .= ""; + $Cstart += ADAY; + $live_days++; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="$MAIN_COLOR"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + if ($limit_days > $live_days) + { + $CBL = ""; + $CEL = ""; + } + else + {$CBL=''; $CEL='';} + $live_days++; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } + } + $CCAL_OUT .= ""; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$Cday"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + +#echo "$CCAL_OUT\n"; +################################################################ +### END - build the callback calendar (12 months) ### +################################################################ + + +?> + + + + +\n"; + +$zi=2; + +?> + + +
+ + +
+
+
+
+
+
+
+           Loading +
+
+
+
+ + + + + +
+ + + + + Inlogget som Bruger + ring)";} + echo "  på kampanje: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + LOGUD\n"; ?> +
+
+ + + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Aktive samtaler
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STATUS:
+
+ Ring næste nummer
+ + + FORHÅNDSVISNING AF LEAD
+ RING ALT NUMMER
+ + INDSPILNINGS FIL:
+
+
+ INDSPILNINGS ID:
+
+ + Start indspilning
+
+ Webformular
+ 0) + {echo "\"Webformular
\n";} + ?> +  
+ Set opkald på vent
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Forflyttning - konference
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Brugerdefineret
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ læg på kunde
+
+
Send DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  Kunde Time:                         Kanal:
Kunde information:         + LEAD SØG";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Ring Noter: "; + if ($agent_call_log_view == '1') + {echo "
se noter ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+ + +
+ + + + + +MANUELT OPKALD       HURTIG KALD
+
+ + +
+
+ + +SE Opkaldslog
+
+ + +     + + + +
VERSION:   BUILD:     Server:              
+ + Gem conferance opkalds kanal information +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +GENVEJSTASTER IKKE AKTIVE + + + sekunder: +     + + +
+
+ + +Din status:
Calls Dialing: +
+ + + D1 - RING\n"; + echo "   \n"; + echo "D2 - RING\n"; + } + else {echo "
\n";} + ?> +

 
+
+ +
 Opkald der er i kø:  
 
+ + + 0) + { + if ($view_calls_in_queue_launch > 0) + {echo "Gem opkald der i kø\n";} + else + {echo "Vis opkald der er i kø\n";} + } +?> + + + +X AKTIVE GENKALD
+
+ +
  +Andre agenters status:  
 
+ +$webphone_content\n"; + } +else + { + echo "
  + Web Telefon:  
$webphone_content
\n"; + } +?> + + +
Agenter Vis +
+ + + +
  WebTelefon View -
+ + + + + 0) + { + echo "Dialable Leads:
 \n"; + } +?> +
+ + + + +
\n";} + ?> +
AGENT SCRIPT
+
+ + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Forflyttning - konference            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LUKKER LOKALT     + + Læg på Xfer linje +
+ seconds +   + channel + + FORESPØRGSEL   + + Læg på begge linjer +
+ Nummer at ringe +   + +                     + +   + + AGENTER + + + + + RING OVERRIDE + + FORLAD 3 PARTS SAMTALE +
+ Ring blind forflytning +   + Ring med kunde +   + Set brugers opkald på vent +   + + Forudindstillinger Button + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Viderestilling tilrådighid for agenter:
+ + + + + +
Leadets udfald er:

+ -
+
+
+ + + + + + + +
Udfalds genvejstaster: + Når aktivt tast den relevante genvejstast så bliver røret lagt på og udfald på opkaldet sat automatiskt:
+ + + + + +
+
+ + + + + + + + + +
Information vdr side genkald: close
+
+
+
+
+ +
+
+ + + + + + + + + +
Udvidet information vdr alt nummer: minimer
+
+
+
+
+ +
+
+ + + + + +
maximere
Alt Telefon Info
+
+ + +
Ingen er i din session:
+ Gå tilbage +

+ Ring agent igen +
+
+ + +
Kunden har lagt røret på:
+ Gå tilbage +

+ Afslut og sæt udfald på opkald +
+
+ + +
Samtale afslut: sekunder tilbage i afslut

+ +

+ Afslut samtale afslut og kom videre +
+
+ + +
+


+ Lukke besked +
+
+ + +
Din session er aflyst
LOGUD

Gå tilbage +
+
+ + +
der er problemer med synkroniseringen af klokke kontakt adminstrator


Gå tilbage +
+
+ + +

LOGUD
+
+ + +
+
+ + +
 
+
+ + +
Alle ændringer i kundeinfo der er lavet nu bliver ikke gemt du skal ændre information inden du lægger røret på.
+
+ + +
SÆT UDFALD PÅ OPKALD :       Læg på igen       minimer
+
\n";} + ?> + + + + Valg af samtalets afsluttende udfald +
+ PAUSE AF AGENT OPKALD
+ RENS FORMULAR | + INDSEND +

+ WEB FORM INDSEND +

  +
+
+ + +
Vælg en ring tilbage dato :
+
\n";} + ?> + + + Vælg en dato forneden   +     + Hour: +   + Minutes: +   + +  
+ KUN MINE GENKALD
";} + ?> + Kommentar vdr genkald:

+ + INDSEND

+ +

  +
+
+ + +
GENKALD FOR AGENT :
Hvis du vil se oplysninger om en af ​​de tilbagekald nedenstående, klik på INFO linket. At ringe til kunden tilbage nu, klik på RING linket. Hvis du klikker på en post nedenfor for at ringe til det, vil det blive fjernet fra listen. +
+
\n";} + ?> +
+
  + Genopfrisk +                 + Gå tilbage +
+
+ + +
NYT LEAD FOR MANUELT OPKALD :

Angiv information forneden vdr det nye lead du ønsker at ringe. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Dial Code:   (Dette plejer at være 45 i Danmark)
Telefon Number: +   (digits only) + + + +
Søg existerende Leads:   (Er dette valg gjort bliver der søgt i existerende leads efter nummeret inden et nyt lead bliver skabt)
+

+     +
+

If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the OPKALDS IN THIS SESSION link at the bottom of the screen and hang it up by clicking på its channel link there.
 
Dial Override:   (kun tal tak) +
+
+ Ring Nu +                 + Forhåndsvis opkald +                 + Gå tilbage +
+
+ + +
LUKKERE INKOMMENDE GRUPPE VALG
+
\n";} + ?> + Lukkere inkommende gruppe valg +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) + { + ?> + BLENDED OPKALD(outbound aktiveret)
+ + RESET | + INDSEND +



  +
+
+ + +
Valg af landområde
+
\n";} + ?> + Territory Selection +
+ RESET | + INDSEND +



  +
+
+ + + Kanal + Kanal + KUN MINE GENKALD
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " BLENDED OPKALD
";} + ?> +
+ + +
      AGENT OPKALD LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
+
+ + +
      Søg efter en kontaktperson:             close [X]
+
\n";} + ?> +

+ Bemærkninger: når du laver en søgning efter en kontakt, der er wildcard eller delvis søgetermer ikke tilladt.
Kontakt søgeanmodninger er alle logget ind i systemet. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Første Name:
Sidste Name:
BU Name:
Department:
Group Name:
Job Títel:
Location:

INDSEND SEARCH             nulstille formular
+

  +
+
+ + +
      KONTAKT SØGERESULTATER:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Søg efter en LEAD:             close [X]
+
\n";} + ?> +

+ Bemærkninger: når du laver en søgning efter en bly, telefonnummer, fører ID eller er de bedste felter til at anvende.
Brug de andre felter kan være langsommere. Bly søgning tillader ikke jokertegn eller delvis søgetermer.
Bly søgeanmodninger er alle logget ind i systemet. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefon Number:
Telefon Number Fields: + Main Telefonnummer + Alternativ Telefonnummer + Adresse3 Telefonnummer +
Lead ID:
:
:
:
:
:
:

INDSEND SEARCH             nulstille formular
+

  +
+
+ + +
      SØGERESULTATER:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      OPKALD NOTER LOG:             close [X]
+
\n";} + ?> +
Ring Notat List
+

  + Luk Info Boks +
+
+ + +
      Kunde information:             close [X] +
+
\n";} + ?> + Lead Info +

  + Luk Info Boks +
+
+ + +
VÆLG EN PAUSEKODE :
+
\n";} + ?> + Pause Code Selection + +

  +
+
+ + +
Vælg en forudindstillet :
+
\n";} + ?> + Presets Selection + +
+
+ + +
VÆLG ET GRUPPE ALIAS :
+
\n";} + ?> + Gruppe alias valg + +

  +
+
+ + +
ALERT :
+     +

Gå tilbage +
+
+ + + + +
+ + +
+ + + + + + +
+ +
+ + + + + +
+   Agent Alert! +
+ + + + + + +
  +

+alert +
  +

+ + Alert Box + +

+
+ +
  + +
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_dk/voicemail_check.php b/agc_2-X/trunk/LANG_www/agc_dk/voicemail_check.php new file mode 100644 index 00000000..757f443d --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_dk/voicemail_check.php @@ -0,0 +1,141 @@ + LICENSE: AGPLv2 +# +# This script is designed purely to check whether the voicemail box on the server defined has new and old messages +# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table +# +# required variables: +# - $server_ip +# - $session_name +# - $user +# - $pass +# optional variables: +# - $format - ('text','debug') +# - $vmail_box - ('101','1234',...) +# +# +# changes +# 50422-1147 - First build of script +# 50503-1241 - added session_name checking for extra security +# 50711-1201 - removed HTTP authentication in favor of user/pass vars +# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES +# 60619-1204 - Added variable filters to close security holes for login form +# 90508-0727 - Changed to PHP long tags +# + +require("dbconnect.php"); + +### If you have globals turned off uncomment these lines +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_name"])) {$session_name=$_GET["session_name"];} + elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];} +if (isset($_GET["format"])) {$format=$_GET["format"];} + elseif (isset($_POST["format"])) {$format=$_POST["format"];} +if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];} + elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];} + +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); + +# default optional vars if not set +if (!isset($format)) {$format="text";} + +$version = '0.0.5'; +$build = '60619-1204'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +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";} + $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 "Ikke gyldigt Brugernavn/Password: |$user|$pass|\n"; + exit; + } + else + { + + if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) + { + echo "Ikke gyldigt server_ip: |$server_ip| or Ikke gyldigt session_name: |$session_name|\n"; + exit; + } + else + { + $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $SNauth=$row[0]; + if($SNauth==0) + { + echo "Ikke gyldigt session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "Voicemail check"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "voicemail box $vmail_box er ikke valid\n"; + exit; + } + else + { + $stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $vmails_list = mysql_num_rows($rslt); + $loop_count=0; + while ($vmails_list>$loop_count) + { + $loop_count++; + $row=mysql_fetch_row($rslt); + echo "$row[0]|$row[1]"; + if ($format=='debug') {echo "\n";} + } + } + + +if ($format=='debug') + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } + +exit; + +?> diff --git a/agc_2-X/trunk/LANG_www/agc_el/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_el/astguiclient.php index 7d12b348..affd95a5 100644 --- a/agc_2-X/trunk/LANG_www/agc_el/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_el/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_el/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_el/conf_exten_check.php index 709ca680..87b7f1eb 100644 --- a/agc_2-X/trunk/LANG_www/agc_el/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_el/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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 @@ -52,17 +52,23 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.4-27'; -$build = '100727-2209'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -107,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -144,7 +155,6 @@ if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) } else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n"; @@ -171,30 +181,29 @@ else } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Ελεγχος τηλ.σύνδεσης διάσκεψης"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Ελεγχος τηλ.σύνδεσης διάσκεψης"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten δεν ισχύει\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -215,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -224,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -232,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check στο calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Κλήσεις στη ουρά: $RingCalls";} + else {$RingCalls = "Κλήσεις στη ουρά: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check στο calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -258,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -285,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Κλήσεις στη ουρά: $RingCalls";} - else {$RingCalls = "Κλήσεις στη ουρά: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -361,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -410,6 +445,52 @@ echo " $external_park = $row[11]; $timer_action_destination = $row[12]; + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } + if (strlen($external_status)<1) {$external_status = '::::::::::';} $web_epoch = date("U"); @@ -577,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - 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"; + 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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -619,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten δεν ισχύει or Exten $exten δεν ισχύει\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Διάσκεψη $conf_exten έχει καταχωρηθεί $exten\n"; + echo "Διάσκεψη $conf_exten έχει καταχωρηθεί $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_el/functions.php b/agc_2-X/trunk/LANG_www/agc_el/functions.php index 9af6831b..cc866913 100644 --- a/agc_2-X/trunk/LANG_www/agc_el/functions.php +++ b/agc_2-X/trunk/LANG_www/agc_el/functions.php @@ -4,15 +4,19 @@ # # functions for agent scripts # -# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # # CHANGES: # 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change # - ##### BEGIN gather values for display of custom list fields for a lead ##### function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) { @@ -70,7 +74,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $A_field_order[$o] = $rowx[15]; $A_field_value[$o] = ''; - if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + if (!preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) { if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) { @@ -115,7 +119,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $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)) + if (preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) {$A_field_value[$o] = '--A--' . $A_field_label[$o] . '--B--';} $o++; } @@ -151,7 +155,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) {$CFoutput .= "right";} $CFoutput .= ">"; } - if ($A_field_type[$o]!='SCRIPT') + if ( ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) {$CFoutput .= "$A_field_name[$o]";} if ( ($A_name_position[$o]=='TOP') or ($A_field_type[$o]=='SCRIPT') ) {$CFoutput .= "   $helpHTML
";} @@ -238,6 +242,18 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} $field_HTML .= "$A_field_default[$o]\n"; } + if ($A_field_type[$o]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\n"; + } if ($A_field_type[$o]=='SCRIPT') { if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} @@ -316,7 +332,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $field_HTML .= ""; } - if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') ) + if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) { $CFoutput .= " $field_HTML $helpHTML"; } @@ -475,6 +491,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_id",$CFoutput); # custom fields replacement $o=0; @@ -496,6 +513,902 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + ##### MySQL Error Logging ##### function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) diff --git a/agc_2-X/trunk/LANG_www/agc_el/manager_send.php b/agc_2-X/trunk/LANG_www/agc_el/manager_send.php index a46f3cfc..fac00c24 100644 --- a/agc_2-X/trunk/LANG_www/agc_el/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_el/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -43,6 +43,9 @@ # - $nodeletevdac - ('0','1') # - $alertCID - ('0','1') # - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -103,12 +106,14 @@ # 101004-1345 - Added Ivr park functions # 101024-1638 - Added park_log logging for parked calls # 101107-2331 - Added CALLERONHOLD/CALLEROFFHOLD queue_log entries -# +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.4-53'; -$build = '101107-2331'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=115; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -198,6 +203,12 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} header ("Content-type: text/html; charset=utf-8"); @@ -418,7 +429,7 @@ if ($ACTION=="OriginateVDRelogin") if ($ACTION=="Originate") { - if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or ( (strlen($queryCID)<10) && ($alertCID < 1) ) ) + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or ( (strlen($queryCID)<10) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten δεν ισχύει or queryCID $queryCID δεν ισχύει, Originate εντολή που δεν έγινε εισαγωγή\n"; } @@ -438,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -624,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -639,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -713,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -1411,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel δεν είναι ενεργό στο $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1595,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1614,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1628,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel δεν είναι ενεργό στο $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { diff --git a/agc_2-X/trunk/LANG_www/agc_el/phone_only.php b/agc_2-X/trunk/LANG_www/agc_el/phone_only.php new file mode 100644 index 00000000..66a229f1 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_el/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Έχετε αποσυνδεθεί. Σας ευχαριστούμε\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST στο server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link στο the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location στο the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Τηλ 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 "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Τηλ-Only Σύνδεση
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη:
  \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 "Τηλ 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 "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Τηλ-Only Σύνδεση
 
Σύνδεση Τηλεφώνου:
Κωδικός πρόσβασης Τηλεφώνου:
  \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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Η σύνδεση δεν είναι σωστή, παρακαλώ προσπαθήστε πάλι
"; + } + } + if ($VDloginDISPLAY) + { + echo "Τηλ 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 "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Τηλ-Only Σύνδεση
 
Σύνδεση χρήστη:
Κωδικός πρόσβασης χρήστη:
  \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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Τηλ 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 "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Τηλ-Only Σύνδεση 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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Τηλ 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call δευτερόλεπτα counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - δευτερόλεπτα στο call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Τηλ: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Τηλ:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_el/timeclock.php b/agc_2-X/trunk/LANG_www/agc_el/timeclock.php index bb3b35de..91c93f47 100644 --- a/agc_2-X/trunk/LANG_www/agc_el/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_el/timeclock.php @@ -266,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Τώρα έχετε συνδεδεμένων"; + $LOGtimeMESSAGE = "Μπορείτε συνδεδεμένος στο $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; diff --git a/agc_2-X/trunk/LANG_www/agc_el/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_el/vdc_db_query.php index 75927bb6..ffd65486 100644 --- a/agc_2-X/trunk/LANG_www/agc_el/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_el/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -89,6 +89,11 @@ # - $DiaL_SecondS - ('0','1','2',...) # - $date - ('2010-02-19') # - $custom_field_names - ('|start_date|finish_date|favorite_color|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -262,15 +267,53 @@ # 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.4-168'; -$build = '101111-1556'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=352; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -453,6 +496,34 @@ if (isset($_GET["custom_field_names"])) {$FORMcustom_field_names=$_GET["custo 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadΚατάσταση"])) {$CallBackLeadΚατάσταση=$_GET["CallBackLeadΚατάσταση"];} + elseif (isset($_POST["CallBackLeadΚατάσταση"])) {$CallBackLeadΚατάσταση=$_POST["CallBackLeadΚατάσταση"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -469,6 +540,44 @@ $MT[0]=''; $agents='@agents'; $US='_'; while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; ##### Hangup Cause Dictionary ##### $hangup_cause_dictionary = array( @@ -526,7 +635,7 @@ $hangup_cause_dictionary = array( ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -537,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -555,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -785,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo "\n"; + $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -661,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -11224,327 +12722,434 @@ else \n"; -$zi=1; +$zi=2; ?> - -
+ + + - height=>
-
-
-
-
-
-
-           Loading -
-
-
+
+
+
+
+
+
+
+           Loading +
+
+
- MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> - +
- - - + + -
+ + + Σύνδεση ως χρήστης - -     - + ring)";} + echo "  στην εκστρατεία: $VD_campaign  \n"; + ?> +     + 0) {echo "TERRITORIES     \n";} ?> 0) {echo "GROUPS     \n";} ?> ΑΠΟΣΥΝΔΕΣΗ\n"; ?> -
+
- height=30> - - - +
MAINSCRIPT
+ + + 0) - {echo "\n";} + {echo "\n";} ?> - - - -
MAINSCRIPT \"FORM\"\"FORM\" VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Ενεργή κλήση
+   LIVE   session ID:     + Ενεργή κλήση + +
- height=>

Agent Screen
+

Agent Screen
- id="MainTable"> - - - - - - -
ΚΑΤΑΣΤΑΣΗ:
+ + + + - +
+
\n"; + } + ?> + + ΚΑΤΑΣΤΑΣΗ:
- Κλήση επόμενου αριθμού
- ΠΡΟΒΟΛΗ ΟΔΗΓΟΥ
- ΚΛΗΣΗ ENAΛ/ΚΟΥ ΤΗΛΕΦΩΝΟΥ
+ Κλήση επόμενου αριθμού
+ + + ΠΡΟΒΟΛΗ ΟΔΗΓΟΥ
+ ΚΛΗΣΗ ENAΛ/ΚΟΥ ΤΗΛΕΦΩΝΟΥ
- ΑΡΧΕΙΟ ΗΧΟΓΡ:
+ ΑΡΧΕΙΟ ΗΧΟΓΡ:
-
- ΤΑΥΤΟΤΗΤΑ ΕΓΓΡΑΦΗΣ:
+
+ ΤΑΥΤΟΤΗΤΑ ΕΓΓΡΑΦΗΣ:
- Εναρξη ηχογράφισης
-
- Σελίδα Διαδικτύου
+ Εναρξη ηχογράφισης
+
+ Σελίδα Διαδικτύου
0) - {echo "\"Σελίδα
\n";} + {echo "\"Σελίδα
\n";} ?> -  
- Στάθμευση Κλήσης
+  
+ Στάθμευση Κλήσης
\"IVR
\n";} + {echo "\"IVR
\n";} else - {echo "\n";} + {echo "\n";} ?> - Μεταφορά - διάσκεψη
+ Μεταφορά - διάσκεψη
0) - {echo "\"Quick
\n";} + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Προσαρμοσμένη
\n";} ?> 0) - {echo "
\n";} + {echo "
\n";} ?> -
- Κλείσιμο Πελάτη
-
-
Στείλε DTMF

+
+ Κλείσιμο Πελάτη
+
+
Στείλε DTMF

align=left valign=top> - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - +
  Customer Time:                         Κανάλι:
+ + - - -
  Χρόνος πελατών:                         Κανάλι:
Πληροφορίες Πελάτη:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + -
:   :   :   :
:
: :
: : :
: : :
: -                     "; - echo ""; - } - else - { - echo ""; - } - ?> - - : :
: :
: - + Πληροφορίες Πελάτη:         \n";} + if ($agent_lead_search == 'ENABLED') + {echo "ΜΟΛΥΒΔΟΣ ΑΝΑΖΗΤΗΣΗ";} + ?> +
+ + + -
+ ";} else - {echo "\n";} + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Καλέστε Σημειώσεις: "; + if ($agent_call_log_view == '1') + {echo "
δείτε τις σημειώσεις ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + ?>
+
+
> +
 
+
 
+ - +
+ -ΧΕΙΡ.ΚΛΗΣΗ       ΓΡΗΓΟΡΗ ΚΛΗΣΗ
-
- - -X ΕΝΕΡΓΕΣ ΕΠΑΝΑΚΛΗΣΕΙΣ
+ΧΕΙΡ.ΚΛΗΣΗ       ΓΡΗΓΟΡΗ ΚΛΗΣΗ
-
+
-VIEW ΚΛΗΣΗ LOG
+ΔΕΙΤΕ ΠΡΟΣΚΛΗΣΗ LOG
- -     - >
Agent web-client version:     ΔΗΜΙΟΥΡΓΙΑ:               Κεντρικός υπολογιστής:              
+ +     + - - + - +
ΕΚΔΟΣΗ:   ΔΗΜΙΟΥΡΓΙΑ:     Κεντρικός υπολογιστής:              
Παρουσίαση πληροφοριών κλήσης καναλιού διασκέψης -

 
+

 
+
0) ) {echo "Alert is ON";} else {echo "Alert is OFF";} ?> -
+
- -
+ +
0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -ΠΛΗΚΤΡΑ ΚΛΕΙΔΙΑ ΑΝΕΝΕΡΓΑ +ΠΛΗΚΤΡΑ ΚΛΕΙΔΙΑ ΑΝΕΝΕΡΓΑ - δευτερόλεπτα: -     + δευτερόλεπτα: +     -
+
-Your Κατάσταση:
Calls Dialing: +Your Κατάσταση:
Calls Dialing:
- + D1 - ΚΛΗΣΗ\n"; - echo "
\n"; + echo "   \n"; echo "D2 - ΚΛΗΣΗ\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
-
 Κλήσεις Στην Ουρά:  
 
+
 Κλήσεις Στην Ουρά:  
 
- + 0) { @@ -11556,20 +13161,35 @@ if ($view_calls_in_queue > 0) ?> -
  -Άλλη Κατάσταση Χειριστών:  
 
+ +X ΕΝΕΡΓΕΣ ΕΠΑΝΑΚΛΗΣΕΙΣ
+
-
  -Web Τηλ:  
+
  +Άλλη Κατάσταση Χειριστών:  
 
-
Agents View +
+$webphone_content
\n"; + } +else + { + echo "
  + Web Τηλ:  
$webphone_content
\n"; + } +?> + + +
Δείτε πράκτορες +
-
  WebΤηλ View -
+
  WebΤηλ View -
0) { - echo "Dialable Leads:
 \n"; + echo "Dialable Εκκινήσεις:
 \n"; } ?>
- - height=>
AGENT SCRIPT
+ +
\n";} + ?> +
AGENT SCRIPT
- + refresh - - height=>
+ +
\n";} + ?> +
- + refresh - > - -
+ + + -
- Μεταφορά - διάσκεψη            
+ Μεταφορά - διάσκεψη            
- - -
- + + + - - + ΤΟΠΙΚΟΣ CLOSER     + + + - - + - - - + channel + + + + - - + - - - + ΧΕΙΡΙΣΤΕΣ + + + + + + + - - + - + Blind Transfer VMail Message + + -
+ - ΤΟΠΙΚΟΣ CLOSER     - - Κλείσιμο Γραμμής Xfer -
+ Κλείσιμο Γραμμής Xfer +
- seconds +
+ seconds   - channel - - ΣΥΜΒΟΥΛΕΥΤΙΚΗ   - - Κλείσιμο και τις δύο γραμμές -
+ ΣΥΜΒΟΥΛΕΥΤΙΚΗ   + + Κλείσιμο και τις δύο γραμμές +
- Αριθμός για κλήση +
+ Αριθμός για κλήση   -                     +                     -   +   - ΧΕΙΡΙΣΤΕΣ - - - - - Υπέρβαση Κλήσης - - ΑΠΟΧΩΡΗΣΗ 3μελής ΚΛΗΣΗΣ -
+ Υπέρβαση Κλήσης + + ΑΠΟΧΩΡΗΣΗ 3μελής ΚΛΗΣΗΣ +
- Τυφλή μεταφορά κλήσης +
+ Τυφλή μεταφορά κλήσης   - Κλήση με τον πελάτη + Κλήση με τον πελάτη   - Στάθμευση κλήσης πελάτη + Στάθμευση κλήσης πελάτη   - Presets Button + Προεπιλογές Κουμπί - - D1 - D2 - D3 - D4 - D5 - - + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + +   - Blind Transfer VMail Message -
+
+
-
-Διαθέσιμοι Χειριστές για Μεταφορά:
+
+Διαθέσιμοι Χειριστές για Μεταφορά:
- height=70> - -
Τερματισμό Καθοδήγησης όπως:

- -
-
+ + +
Τερματισμό Καθοδήγησης όπως:

+ -
+
- height=70> - +
Πλήκτρα κλειδιά Τερματισμού: + + - - + - + -
Πλήκτρα κλειδιά Τερματισμού: Όταν είναι ενεργό, πιέστε απλά το πλήκτρο κλειδί για τον επιθυμητό τερματισμό της κλήσης. Η κλήση θα τρεματίσει αυτόματα:
+ - + - + -
+
- height=70> - - - +
Προηγούμενες πληροφορίες επανάκλησης: close
+ + + - - + -
Προηγούμενες πληροφορίες επανάκλησης: close
-
-
-
-
+ +
+
+
+
-
+
+ - height=70> - - - +
Εκτεταμένη Πληροφορία Εναλλ Τηλεφώνου: ελαχιστοποιήστε
+ + + - - + -
Εκτεταμένη Πληροφορία Εναλλ Τηλεφώνου: ελαχιστοποιήστε
-
-
-
-
+
+
+
+
+
-
+ +
- - - -
μεγιστοποιήστε
Alt Τηλ Info
+ + + +
μεγιστοποιήστε
Alt Τηλ Info
- height=>
Κανένας δεν είναι στη σύνοδό σας:
+
Κανένας δεν είναι στη σύνοδό σας:
Επιστροφή -

+

Ξανακάλεσε τον Χειριστή -
+
- height=>
Ο πελάτης έχει κλείσει το τηλέφωνο:
+
Ο πελάτης έχει κλείσει το τηλέφωνο:
Επιστροφή -

+

Τελείωσε και Τερμάτισε την Κλήση -
+
- height=>
Αναδίπλωση Κλήσης: απομύνοντα δευτερόλεπτα σε αναδίπλωση

+
Αναδίπλωση Κλήσης: απομύνοντα δευτερόλεπτα σε αναδίπλωση

-

+

Τελείωμα Αναδίπλωσης και Συνέχεια -
+
-
-


+
+


Κλείσιμο Μηνύματος -
+
- height=>
Η σύνοδός σας έχει τεθεί εκτός λειτουργίας
ΑΠΟΣΥΝΔΕΣΗ

Επιστροφή -
+
Η σύνοδός σας έχει τεθεί εκτός λειτουργίας
ΑΠΟΣΥΝΔΕΣΗ

Επιστροφή +
- height=>
Υπάρχει πρόβλημα συγχρονισμού με το σύστημα, παρακαλούμε ενημερώστε τον διαχειριστή του συστήματός σας


Επιστροφή -
+
Υπάρχει πρόβλημα συγχρονισμού με το σύστημα, παρακαλούμε ενημερώστε τον διαχειριστή του συστήματός σας


Επιστροφή +
- height=>

ΑΠΟΣΥΝΔΕΣΗ
+

ΑΠΟΣΥΝΔΕΣΗ
-
+
-
 
+
 
- height=47>
Οποιεσδήποτε αλλαγές που γίνονται στις πληροφορίες πελατών κατωτέρω αυτή τη στιγμή δεν θα είναι, πρέπει να αλλάξετε τις πληροφορίες πελατών ενώπιον σας Hangup η κλήση.
+
Οποιεσδήποτε αλλαγές που γίνονται στις πληροφορίες πελατών κατωτέρω αυτή τη στιγμή δεν θα είναι, πρέπει να αλλάξετε τις πληροφορίες πελατών ενώπιον σας Hangup η κλήση.
- height=>
Τερματισμός Κλήσης :       Ξανακλήσε       ελαχιστοποιήστε
+
Τερματισμός Κλήσης :       Ξανακλήσε       ελαχιστοποιήστε
+
\n";} + ?> + + Επιλογή τερματισμού της κλήσης -
- ΤΕΡΜΑΤΙΣΜΟΣ ΚΛΗΣΗΣ
+
+ ΤΕΡΜΑΤΙΣΜΟΣ ΚΛΗΣΗΣ
ΕΠΑΝΑΦΟΡΑ | ΥΠΟΒΑΛΕΤΕ -

+

WEB FORM ΥΠΟΒΑΛΕΤΕ -

  -
+

  +
- height=>
Επιλέξτε μια ημερομηνία CallBack :
- - +
Επιλέξτε μια ημερομηνία CallBack :
+
\n";} + ?> + + Επιλέξτε μια ημερομηνία κατωτέρω       Hour: - @@ -11871,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11886,165 +13533,372 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
ΜΟΝΟ ΤΗΝ ΕΠΑΝΑΚΛΗΣΗ ΜΟΥ
";} + {echo " ΜΟΝΟ ΤΗΝ ΕΠΑΝΑΚΛΗΣΗ ΜΟΥ
";} ?> - Σχόλια CB:

+ Σχόλια CB:

- ΥΠΟΒΑΛΕΤΕ

+ ΥΠΟΒΑΛΕΤΕ

-

  -
+

  +
- height=>
ΕΠΑΝΑΚΛΗΣΕΙΣ ΓΙΑ ΤΟΝ ΧΕΙΡΙΣΤΗ :
Επιλέξτε μία επανάκληση παρακάτω για να καλέσετε τον πελάτη τώρα. Εάν επιλέξετε μία εγγραφή παρακάτω, θα διαγραφεί από την λίστα. -
+
ΕΠΑΝΑΚΛΗΣΕΙΣ ΓΙΑ ΤΟΝ ΧΕΙΡΙΣΤΗ :
Για να δείτε πληροφορίες για ένα από τα παρακάτω callbacks, κάντε κλικ στο link. Για να καλέσετε τον πελάτη πίσω τώρα, κάντε κλικ στο σύνδεσμο ΚΛΗΣΗ. Αν κάνετε κλικ σε ένα αρχείο για να το καλέσετε, θα πρέπει να αφαιρεθεί από τον κατάλογο. +
+
\n";} + ?>
-
  +
  Ανανέωση                 - Επιστροφή -
+ Επιστροφή +
- height=>
ΝΕΑ ΧΕΙΡΟΚΙΝΗΤΗ ΚΛΗΣΗ ΟΔΗΓΟΥ ΓΙΑ :

Καταχωρήστε τις πληροφορίες παρακάτω για τον νέο οδηγό που επιθυμήτε να καλέσετε. -
+
ΝΕΑ ΧΕΙΡΟΚΙΝΗΤΗ ΚΛΗΣΗ ΟΔΗΓΟΥ ΓΙΑ :

Καταχωρήστε τις πληροφορίες παρακάτω για τον νέο οδηγό που επιθυμήτε να καλέσετε. +
\n"; + echo "Σημείωση: ένα πρόθεμα κλήσης από $manual_dial_prefix θα προστεθεί στην αρχή του αριθμού
\n"; } ?> - Note: all new manual dial leads will go into list

- - - + Note: all new manual dial leads will go into list

+
Κωδικός Κλήσης:   (Αυτό είναι συνήθως ένα 1 στις ΗΠΑ)
+ + - - + - - + + - +

Εάν θέλετε να καλέσετε έναν αριθμό και να μην προστεθεί ως νέος οδηγός, καταχωρήστε τον με την σωστή μορφή στο πεδίο Αγνόησε Κλήση παρακάτω. Για να κλείσετε αυτή την κλήση θα πρέπει να ανοίξετε το ΚΛΗΣΕΙΣ ΣΕ ΑΥΤΗ ΤΗΝ ΔΙΑΙΔΚΑΣΙΑ στο κάτω μέρος της οθόνης και να την κλείσετε επιλέγοντας το κανάλι.
  - - + -
Κωδικός Κλήσης:   (Αυτό είναι συνήθως ένα 1 στις ΗΠΑ)
Τηλ Number: -   (digits only) + Τηλ Number: +   (digits only) + + +
Αναζήτηση Οδηγών:   (Η επιλογή αυτή επιτρέπει να βρει τον αριθμό στο σύστημα προτού γίνει εισαγωγή ως νέος οδηγός) Αναζήτηση Οδηγών:   (Η επιλογή αυτή επιτρέπει να βρει τον αριθμό στο σύστημα προτού γίνει εισαγωγή ως νέος οδηγός)
-

+
+

   
-

Εάν θέλετε να καλέσετε έναν αριθμό και να μην προστεθεί ως νέος οδηγός, καταχωρήστε τον με την σωστή μορφή στο πεδίο Αγνόησε Κλήση παρακάτω. Για να κλείσετε αυτή την κλήση θα πρέπει να ανοίξετε το ΚΛΗΣΕΙΣ ΣΕ ΑΥΤΗ ΤΗΝ ΔΙΑΙΔΚΑΣΙΑ στο κάτω μέρος της οθόνης και να την κλείσετε επιλέγοντας το κανάλι.
 
Αγνόησε Κλήση:   (παρακαλώ μόνο ψηφία) + Αγνόησε Κλήση:   (παρακαλώ μόνο ψηφία)
-
+
+
Κάλεσε Τώρα                 Προεπισκόπηση Κλήσης                 - Επιστροφή -
+ Επιστροφή +
- height=>
CLOSER ΕΙΣΕΡΧΟΜΕΝΗ ΕΠΙΛΟΓΗ ΟΜΑΔΑΣ
+
CLOSER ΕΙΣΕΡΧΟΜΕΝΗ ΕΠΙΛΟΓΗ ΟΜΑΔΑΣ
+
\n";} + ?> Επιλογή Closer εισερχόμενης ομάδας -
+
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - ΣΥΝΔΥΑΣΜΕΝΗ ΚΛΗΣΗ(εξερχόμενες ενεργοποιημένες)
+ ΣΥΝΔΥΑΣΜΕΝΗ ΚΛΗΣΗ(εξερχόμενες ενεργοποιημένες)
ΕΠΑΝΑΦΟΡΑ | ΥΠΟΒΑΛΕΤΕ -



  -
+



  +
- height=>
TERRITORY SELECTION
+
ΕΠΙΛΟΓΗ ΕΔΑΦΟΣ
+
\n";} + ?> Territory Selection -
+
ΕΠΑΝΑΦΟΡΑ | ΥΠΟΒΑΛΕΤΕ -



  -
+



  +
- Κανάλι Κανάλι ΜΟΝΟ ΤΗΝ ΕΠΑΝΑΚΛΗΣΗ ΜΟΥ
";} + {echo " ΜΟΝΟ ΤΗΝ ΕΠΑΝΑΚΛΗΣΗ ΜΟΥ
";} if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) - {echo " ΣΥΝΔΥΑΣΜΕΝΗ ΚΛΗΣΗ
";} + {echo " ΣΥΝΔΥΑΣΜΕΝΗ ΚΛΗΣΗ
";} ?>
- height=>
AGENT ΚΛΗΣΗ LOG:
+
      AGENT ΚΛΗΣΗ LOG:             close [X]
+
\n";} + ?>
Call log List
-

  -
+

  +
+
+ + +
      Αναζήτηση επαφής:             close [X]
+
\n";} + ?> +

+ Σημειώσεις: όταν κάνετε μια αναζήτηση για μια επαφή, δεν επιτρέπεται μπαλαντέρ ή μερική όρους αναζήτησης.
Τα αιτήματα αναζήτησης Επικοινωνία όλοι συνδεδεμένοι στο σύστημα. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Πρώτο Name:
Επίθετο Name:
BU Name:
Department:
Group Name:
Job Τίτλος:
Location:

ΥΠΟΒΑΛΕΤΕ SEARCH             επαναφέρετε μορφή
+

  +
+
+ + +
      ΕΠΙΚΟΙΝΩΝΙΑ ΑΠΟΤΕΛΕΣΜΑΤΑ ΑΝΑΖΗΤΗΣΗΣ:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Αναζήτηση ΜΟΛΥΒΔΟΥ:             close [X]
+
\n";} + ?> +

+ Σημειώσεις: όταν κάνετε μια αναζήτηση για το μόλυβδο, τον αριθμό τηλεφώνου, να οδηγήσει ταυτότητας ή είναι τα καλύτερα πεδία για να χρησιμοποιήσετε.
Χρησιμοποιώντας τα άλλα πεδία μπορεί να είναι βραδύτερη. Ο μόλυβδος έρευνα δεν επιτρέπει μπαλαντέρ ή μερική όρους αναζήτησης.
Οι επικεφαλής όλων των αιτημάτων αναζήτησης συνδεδεμένοι στο σύστημα. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Τηλ Number:
Τηλ Number Fields: + Κύρια Τηλέφωνο + Αναπληρωτής Τηλέφωνο + Διεύθυνση3 Τηλέφωνο +
Lead ID:
:
:
:
:
:
:

ΥΠΟΒΑΛΕΤΕ SEARCH             επαναφέρετε μορφή
+

  +
+
+ + +
      ΑΠΟΤΕΛΕΣΜΑΤΑ ΑΝΑΖΗΤΗΣΗΣ:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Σημειώσεων μητρώου κλήσεων:             close [X]
+
\n";} + ?> +
Καλέστε Σημειώσεις Λίστα
+

  + Κλείσιμο Πληροφορίες +
- height=>
Πληροφορίες Πελάτη:
+
      Πληροφορίες Πελάτη:             close [X] +
+
\n";} + ?> Lead Info -

  -
+

  + Κλείσιμο Πληροφορίες +
- height=>
ΕΠΙΛΕΞΤΕ έναν ΚΩΔΙΚΟ ΓΙΑ ΣΥΝΤΟΜΗ ΔΙΑΚΟΠΗ :
+
ΕΠΙΛΕΞΤΕ έναν ΚΩΔΙΚΟ ΓΙΑ ΣΥΝΤΟΜΗ ΔΙΑΚΟΠΗ :
+
\n";} + ?> Παύση Code Selection - -

  -
+ +

  +
- >
SELECT A PRESET :
+
Επιλέξτε ένα προκαθορισμένο :
+
\n";} + ?> Presets Selection - -
+ +
- height=>
ΕΠΙΛΕΞΤΕ ΕΝΑ ΨΕΥΔΩΝΥΜΟ ΟΜΑΔΑΣ :
+
ΕΠΙΛΕΞΤΕ ΕΝΑ ΨΕΥΔΩΝΥΜΟ ΟΜΑΔΑΣ :
+
\n";} + ?> Επιλογή Ψευδώνυμο Ομάδας - -

  -
+ +

  +
- height=>
ALERT :
-     -

Επιστροφή -
+
ALERT :
+     +

Επιστροφή +
- + - +
+ + +
+ + + + + + +
+ +
+ + + + + +
+   Agent Alert! +
+ + + + + + +
  +

+alert +
  +

+ + Alert Box + +

+
+ +
  + +
+
+
+ +
- @@ -12053,4 +13907,4 @@ if ($agent_display_dialable_leads > 0) exit; -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_es/active_list_refresh.php b/agc_2-X/trunk/LANG_www/agc_es/active_list_refresh.php index b33bc9cc..0bf8883d 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/active_list_refresh.php +++ b/agc_2-X/trunk/LANG_www/agc_es/active_list_refresh.php @@ -160,10 +160,10 @@ if ($format=='table') { echo "\n"; echo "\n"; -echo "\n"; -echo "Mostrar Listas: "; -if ($ADD==1) {echo "Extensiones Activas";} -if ($ADD==2) {echo "Extensiones Ocupadas";} +echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build ADD: $ADD server_ip: $server_ip-->\n"; +echo "<title>Despliegue de listas: "; +if ($ADD==1) {echo "Extensiones activas";} +if ($ADD==2) {echo "Extensiones ocupadas";} if ($ADD==3) {echo "Líneas de salida";} if ($ADD==4) {echo "Extensiones Locales";} if ($ADD==5) {echo "Conferencias";} @@ -470,7 +470,7 @@ if ($ADD==5) $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); -if ($format=='table') {echo "\n<!-- tiempo de ejecución del Script: $RUNtime segundos -->";} +if ($format=='table') {echo "\n<!-- tiempo de ejecución del guión: $RUNtime segundos -->";} if ($format=='table') {echo "\n</body>\n</html>\n";} exit; diff --git a/agc_2-X/trunk/LANG_www/agc_es/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_es/astguiclient.php index 7dee1758..a415ae44 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_es/astguiclient.php @@ -1,7 +1,7 @@ <?php # astguiclient.php - the web-based version of the astGUIclient client application # -# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -107,7 +108,7 @@ if ($force_logout) Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); } - echo "Usted ahora ha registrado hacia fuera. Gracias\n"; + echo "Usted ha cerrado sesión. Gracias\n"; exit; } @@ -145,7 +146,7 @@ if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) { header ("Content-type: text/html; charset=utf-8"); - echo "<title>web client astGUIclient: Login\n"; + echo "cliente Web de astGUIclient: Login\n"; echo "\n"; echo "\n"; echo "\n"; @@ -155,19 +156,19 @@ echo "
\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "
Conexión Inicio de sesión
 
Conexión Del Usuario:
Inicio de sesión del usuario:
Contraseña Del Usuario:
Contraseña del usuario:
Conexión Del Teléfono:
Inicio de sesión del teléfono:
Contraseña Del Teléfono:
Contraseña del teléfono:

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -206,11 +207,11 @@ header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 echo "\n"; echo "\n"; -echo "\n"; +echo "\n"; if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) { -echo "web client astGUIclient: Conexión Del Teléfono\n"; +echo "cliente Web de astGUIclient: Inicio de sesión del teléfono\n"; echo "\n"; echo "\n"; echo "\n"; @@ -222,15 +223,15 @@ echo "\n"; echo "\n"; echo "


"; echo ""; -echo ""; +echo ""; echo "\n"; echo "\n"; -echo ""; +echo ""; echo "\n"; -echo ""; +echo ""; echo "\n"; -echo "\n"; -echo "\n"; +echo "\n"; +echo "\n"; echo "
Conexión Del Teléfono Inicio de sesión del teléfono
 
Conexión Del Teléfono:
Inicio de sesión del teléfono:
Contraseña Del Teléfono:
Contraseña del teléfono:

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -247,7 +248,7 @@ $row=mysql_fetch_row($rslt); $authphone=$row[0]; if (!$authphone) { - echo "web client astGUIclient: Conexión Del Teléfono\n"; + echo "cliente Web de astGUIclient: Inicio de sesión del teléfono\n"; echo "\n"; echo "\n"; echo "\n"; @@ -259,15 +260,15 @@ echo " - - - - - + + + + +
\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo ""; + echo "\n"; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "
Conexión Del Teléfono Inicio de sesión del teléfono
 
Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor:
 
Conexión Del Teléfono:
 
Lo sentimos, el inicio de sesión y la contraseña del teléfono no están activos en este sistema, por favor, inténtelo de nuevo:
 
Inicio de sesión del teléfono:
Contraseña Del Teléfono:
Contraseña del teléfono:

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -276,7 +277,7 @@ echo "
web client astGUIclient\n"; + echo "cliente Web de astGUIclient\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); @@ -887,7 +888,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} else { bsr_continue=0; - alert("Usted puede supervisa solamente Zap los canales:\n" + listenvalue); + alert("Usted sólo puede monitorear los canales Zap:\n" + listenvalue); } } if (bsr_continue == '1') @@ -1197,7 +1198,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} { recLIST = recLIST + "|" + monitorchannelvalue; filename = filedate + "_" + user_abb; - var rec_start_html = "Pare la grabación"; + var rec_start_html = "Detener la grabación"; document.getElementById(taskspan).innerHTML = rec_start_html; } @@ -1259,7 +1260,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} recLIST = recLIST + "|" + taskconfrec; filename = filedate + "_" + user_abb; var channelrec = "Local/" + taskconfrec + "@" + ext_context; - var conf_rec_start_html = "Pare la grabación"; + var conf_rec_start_html = "Detener la grabación"; document.getElementById(taskconfspan).innerHTML = conf_rec_start_html; } @@ -1386,7 +1387,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=3; if (live_calls > 0) { - var live_calls_HTML = "LLAMADAS ACTIVAS EN ESTE TELÉFONO:
"; + var live_calls_HTML = "LLAMADAS ACTIVAS EN ESTE TELÉFONO:
#CANAL CLIENTECANAL REMOTORECORDCOLGARTRANSFERENCIAPARKING
"; if ( (LCAcount > live_calls) || (LCAcount < live_calls) ) { LCAe[0]=''; LCAe[1]=''; LCAe[2]=''; LCAe[3]=''; LCAe[4]=''; LCAe[5]=''; @@ -1412,11 +1413,11 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var regx = new RegExp("\\|"+channelfieldBtrunk_array[1],"ig"); if (recLIST.match(regx)) - {live_calls_HTML = live_calls_HTML + "Pare la grabación";} + {live_calls_HTML = live_calls_HTML + "Detener la grabación";} else {live_calls_HTML = live_calls_HTML + "Grabar";} - live_calls_HTML = live_calls_HTML + ""; + live_calls_HTML = live_calls_HTML + ""; if (LCAe[ARY_ct].length < 1) {LCAe[ARY_ct] = channelfieldA_array[1]; LCAcontent_change++; LCAalter++;} @@ -1561,7 +1562,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=0; if (in_calls > 0) { - var in_log_HTML = "
#CANAL DEL CLIENTECANAL REMOTORECORDCOLGARTRANSFERENCIARETENER
COLGARTRANSFERENCIAPARKING
COLGARTRANSFERENCIARETENER
" + var in_log_HTML = "
# FECHA/HORA DE LA LLAMADANÚMERO-ENTRANTELLAMADORIDLENGTH
" while (loop_ct < in_calls) { loop_ct++; @@ -1636,7 +1637,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=-1; if (parked_count > 0) { - var park_HTML = "
# FECHA/HORA DE LA LLAMADANÚMERO ENTRANTELLAMADASIDLENGTH
" + var park_HTML = "
#CHANNEL
  LLAMADA ID
APARCAR POR
  TIEMPO EN PARKINGING
COLGARTRANSFERENCIACAPTURAR
" while (loop_ct < parked_count) { loop_ct++; @@ -1652,7 +1653,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var park_call_id = park_array[1]; var parked_by = park_array[3]; var parked_time = park_array[4]; - park_HTML = park_HTML + ""; + park_HTML = park_HTML + ""; } park_HTML = park_HTML + "
#CHANNEL
  LLAMADA ID
RETENIDA POR
  TIEMPO DE HABER SIDO RETENIDA
COLGARTRANSFERENCIATOMAR
" + loop_ct + "" + park_channel + "
  " + park_call_id + "
" + parked_by + "
  " + parked_time + "
COLGARTRANSFERENCIACAPTURAR
" + loop_ct + "" + park_channel + "
  " + park_call_id + "
" + parked_by + "
  " + parked_time + "
COLGARTRANSFERENCIATOMAR
"; @@ -1764,7 +1765,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} show_reglink=1; reglink = "Register"; } - var conf_head_HTML = "CONFERENCIA " + head_conf + "    Registrado a: " + head_reg + "   " + reglink + "         Entrar en la conferencia
Recarga     Grabar         Enviar DTMF         Marcar desde la Conf
"; + var conf_head_HTML = "CONFERENCIA " + head_conf + "    Registrado a: " + head_reg + "   " + reglink + "         Entrar a la conferencia
Recargar     Grabar         Enviar DTMF         Marcar desde la conferencia
"; document.getElementById("ConfereNceHeaderContent").innerHTML = conf_head_HTML; check_for_conf_calls(head_conf,taskrefresh); @@ -2063,7 +2064,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} } // ################################################################################ -// Send Originate command to manager to direct user to caja del buzón de voz +// Send Originate command to manager to direct user to buzón de voz function SendCheckVoiceMail() { var xmlhttp=false; @@ -2387,7 +2388,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} hideDiv('MainPanel'); showDiv('LogouTBox'); - document.getElementById("LogouTBoxLink").innerHTML = "PINCHA AQUÍ PARA ENTRAR OTRA VEZ\n"; + document.getElementById("LogouTBoxLink").innerHTML = "HAGA CLICK AQUÍ PARA INICIAR SESIÓN OTRA VEZ\n"; logout_stop_timeouts = 1; @@ -2468,7 +2469,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} start_all_refresh(); } function pause() // Pauses the refreshing of the lists - {active_display=2; display_message=" - DISPLAY ACTIVO PAUSADO -";} + {active_display=2; display_message=" - DESPLIEGUE ACTIVO PAUSADO -";} function start() // resumes the refreshing of the lists {active_display=1; display_message='';} function faster() // lowers by 1000 milliseconds the time until the next refresh @@ -2718,14 +2719,14 @@ echo "\n";
-SALIR
\n"; ?> +CERRAR SESIÓN
\n"; ?>
Pantalla PrincipalPantalla Lineas ActivasPantalla de ConferenciasComprobar buzón de vozLlamada ActivaPanel principalPanel de líneas activasPanel de conferenciasRevisar el buzón de vozLlamada activa
@@ -2736,21 +2737,21 @@ echo "\n";
TRUNK HANGUP

Active Trunks Menu
- Colgar Trunk   |   - Capturar Trunk   |   - Escuchar Trunk   |   - Recarga   |   + Colgar la troncal   |   + Apoderarse de la troncal   |   + Escuchar la troncal   |   + Recargar   |   Volver a la pantalla principal
-
Colgar Local

- Menú Local Activa
- Colgar Local   |   - Capturar Local   |   - Escuchar Local   |   - Recarga   |   +
Colgar la local

+ Menú local activo
+ Colgar la local   |   + Apoderarse de la local   |   + Escuchar la local   |   + Recargar   |   Volver a la pantalla principal
@@ -2759,33 +2760,33 @@ echo "\n"; - + -
TRANSFERIR LLAMADA ACTIVA
Canal que va a ser transferido: Channel
Extensiones:
Menú Extensiones
Extensiones:
Menú de las extensiones

- Envíe a la extensión seleccionada

- Enviar al buzón de voz seleccionada

- Envíe a este número:


- Recarga


+ Enviar a la extensión seleccionada

+ Enviar al buzón de voz seleccionado

+ Enviar a este número:


+ Recargar


Volver a la pantalla principal

Conferencias:
(Pinchar en un número de abajo para enviar a una conferencia)
Enviar mi canal también
Menú de Conferencias
+
Conferencias:
(Haga click en el número siguiente para enviar a una conferencia)
Enviar también a mi canal
Menú de conferencias
- - +
Marcar a Extensiones LOCALES
Teléfono llamando desde: Channel
Extensiones:
Menú Extensiones
+
Marcar a extensiones LOCALES
Llamada telefónica de: Channel
Extensiones:
Menú de las extensiones

- Llamar extensión seleccionada

- Llamar buzón de voz seleccionado

- Recarga


+ Llamar a la extensión seleccionada

+ Llamar al buzón de voz seleccionado

+ Recargar


Volver a la pantalla principal

- - + - + - +
LLAMADAS APARCADAS:
+
LLAMADAS RETENIDAS:
Volver a la pantalla principal

@@ -2796,19 +2797,19 @@ echo "\n";
BUZÓN DE VOZ     NUEVO:     VIEJO:             MARCADO MANUAL       DIAL
BUZÓN DE VOZ     NUEVO:     ANTERIOR:             MARCACIÓN MANUAL       DIAL
LLAMADAS APARCADAS: 0                MARCAR EXTENSIONES LOCALES
LLAMADAS RETENIDAS: 0                EXTENSIONES DE MARCACIÓN LOCALES
LLAMADAS SALIENTES:
LLAMADAS ENTRANTES:
versión astGUIclient del tela-cliente: CONSTRUCCION:
versión del cliente Web de astGUIclient: CONSTRUCCIÓN:
- +
FAVORITOS       corrija
$h) @@ -2828,8 +2829,8 @@ echo "\n";
FAVORITOS       editar
- - + +
FAVORITOS

 
SOMETA LOS CAMBIOS de los FAVORITOS - requiere registro de estado de la máquina
DE NUEVO A VENTANA PRINCIPAL - no haga caso de los cambios realizados
ACEPTAR LOS CAMBIOS A FAVORITOS - es necesario cerrar sesión para hacerlo
REGRESAR A LA VENTANA PRINCIPAL - ignorar los cambios realizados
@@ -2840,9 +2841,9 @@ echo "\n"; - @@ -2858,11 +2859,11 @@ echo "\n";
STOP | START     Actualizar la tarifa: 1000 ms Más rápido | Más lento

-
Inizializando..
+
Inicializando..
Extensiones Activas
+
Extensiones activas
ACTUALIZAR | ORDEN |
- Los Datos Van Aquí

+ Los datos van aquí

- Los Datos Van Aquí

Acciones en Trunk + Los datos van aquí

Acción de la troncal
- Los Datos Van Aquí

Acción Local + Los datos van aquí

Acción de la local
@@ -2874,12 +2875,12 @@ echo "\n";
-Lista De las Conferencias +Lista de las conferencias
-Pinchar a la izquierda del número de una sala de conferencias para obtener información +Hacer click en el número de la sala de conferencias de la izquierda para obtener más información de la misma
diff --git a/agc_2-X/trunk/LANG_www/agc_es/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_es/calendar_db.js index a7a11136..e84264bc 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/calendar_db.js +++ b/agc_2-X/trunk/LANG_www/agc_es/calendar_db.js @@ -4,7 +4,7 @@ // default settins var A_TCALDEF = { - 'months' : ['Enero', 'February', 'Marcha', 'Abril', 'Puede', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], + 'months' : ['Enero', 'February', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], 'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], 'yearscroll': true, // show year scroller 'weekstart': 0, // first day of week: 0-Su or 1-Mo diff --git a/agc_2-X/trunk/LANG_www/agc_es/call_log_display.php b/agc_2-X/trunk/LANG_www/agc_es/call_log_display.php index ba676ee0..195892ab 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/call_log_display.php +++ b/agc_2-X/trunk/LANG_www/agc_es/call_log_display.php @@ -108,8 +108,8 @@ if ($format=='debug') { echo "\n"; echo "\n"; -echo "\n"; -echo "Motrar el registro de llamadas"; +echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build EXTEN: $exten server_ip: $server_ip-->\n"; +echo "<title>Desplegar el registro de llamadas"; echo "\n"; echo "\n"; echo "\n"; @@ -188,7 +188,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_es/conf_exten_check.php index 3094eaac..0fe43c0c 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_es/conf_exten_check.php @@ -184,8 +184,8 @@ if ($format=='debug') { echo "\n"; echo "\n"; - echo "\n"; - echo "Comprobar la Extensión de Conf"; + echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build MEETME: $conf_exten server_ip: $server_ip-->\n"; + echo "<title>Revisar la extensión de configuración"; echo "\n"; echo "\n"; echo "\n"; @@ -280,8 +280,8 @@ if ($ACTION == 'refresh') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Pide, en la cola: $RingCalls";} - else {$RingCalls = "Pide, en la cola: $RingCalls";} + if ($RingCalls > 0) {$RingCalls = "Llamadas en cola: $RingCalls";} + else {$RingCalls = "Llamadas en cola: $RingCalls";} ### grab the number of calls being placed from this server and campaign $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; @@ -658,6 +658,11 @@ if ($ACTION == 'refresh') {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Estado: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; @@ -742,7 +747,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/css/custom.css b/agc_2-X/trunk/LANG_www/agc_es/css/custom.css deleted file mode 100644 index 8d1c8b69..00000000 --- a/agc_2-X/trunk/LANG_www/agc_es/css/custom.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/agc_2-X/trunk/LANG_www/agc_es/css/style.css b/agc_2-X/trunk/LANG_www/agc_es/css/style.css deleted file mode 100644 index 2e30a009..00000000 --- a/agc_2-X/trunk/LANG_www/agc_es/css/style.css +++ /dev/null @@ -1,26 +0,0 @@ -/* /!\ DO NOT EDIT THIS FILE !!! Please edit custom.css to keep your customizations after an upgrade /!\ */ - -body { padding:0; margin:0; background: #FFF; } - -div.scroll_list { height: 400px; width: 140px; overflow: scroll; } -div.text_input { overflow: auto; font-size: 10px; font-family: sans-serif; } -.body_text { font-size: 13px; font-family: sans-serif; } -.queue_text_red { font-size: 12px; font-family: sans-serif; font-weight: bold; color: red; } -.queue_text { font-size: 12px; font-family: sans-serif; color: black; text-decoration:none; } -.preview_text { font-size: 13px; font-family: sans-serif; background: #CCFFCC; } -.preview_text_red { font-size: 13px; font-family: sans-serif; background: #FFCCCC; } -.body_small { font-size: 11px; font-family: sans-serif; } -.body_small_bold { font-size: 11px; font-family: sans-serif; font-weight: bold; } -.body_tiny { font-size: 10px; font-family: sans-serif; } -.log_text { font-size: 11px; font-family: monospace; } -.log_text_red { font-size: 11px; font-family: monospace; font-weight: bold; background: #FF3333; } -.log_title { font-size: 12px; font-family: monospace; font-weight: bold; } -.sd_text { font-size: 16px; font-family: sans-serif; font-weight: bold; } -.sh_text { font-size: 14px; font-family: sans-serif; font-weight: bold; } -.sb_text { font-size: 12px; font-family: sans-serif; } -.sk_text { font-size: 11px; font-family: sans-serif; } -.skb_text { font-size: 13px; font-family: sans-serif; font-weight: bold; } -.ON_conf { font-size: 11px; font-family: monospace; color: black; background: #FFFF99; } -.OFF_conf { font-size: 11px; font-family: monospace; color: black; background: #FFCC77; } -.cust_form { font-family: sans-serif; font-size: 10px; overflow: hidden; } -.cust_form_text { font-family: sans-serif; font-size: 10px; overflow: auto; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/functions.php b/agc_2-X/trunk/LANG_www/agc_es/functions.php index 735cc845..cc866913 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/functions.php +++ b/agc_2-X/trunk/LANG_www/agc_es/functions.php @@ -4,17 +4,19 @@ # # functions for agent scripts # -# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # # CHANGES: # 100629-1201 - First Build # 101124-0625 - Added lookup_gmt and dialable_gmt functions # 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change # - ##### BEGIN gather values for display of custom list fields for a lead ##### function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) { @@ -72,7 +74,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $A_field_order[$o] = $rowx[15]; $A_field_value[$o] = ''; - if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + if (!preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) { if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) { @@ -117,7 +119,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $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)) + if (preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) {$A_field_value[$o] = '--A--' . $A_field_label[$o] . '--B--';} $o++; } @@ -153,7 +155,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) {$CFoutput .= "right";} $CFoutput .= ">"; } - if ( ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') ) + if ( ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) {$CFoutput .= "$A_field_name[$o]";} if ( ($A_name_position[$o]=='TOP') or ($A_field_type[$o]=='SCRIPT') ) {$CFoutput .= "   $helpHTML
";} @@ -242,11 +244,11 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) } if ($A_field_type[$o]=='READONLY') { - if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} 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 .= " $A_field_value[$o]\n"; } - if ($A_field_type[$o]=='HIDDEN') + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) { if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} @@ -330,7 +332,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $field_HTML .= ""; } - if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') ) + if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) { $CFoutput .= " $field_HTML $helpHTML"; } @@ -489,6 +491,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_id",$CFoutput); # custom fields replacement $o=0; diff --git a/agc_2-X/trunk/LANG_www/agc_es/inbound_popup.php b/agc_2-X/trunk/LANG_www/agc_es/inbound_popup.php index 87883518..8e39e920 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/inbound_popup.php +++ b/agc_2-X/trunk/LANG_www/agc_es/inbound_popup.php @@ -125,7 +125,7 @@ while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) echo "\n"; echo "\n"; -echo "\n"; +echo "\n"; ?> LLAMADA DE ENTRADA ACTIVA"; +echo "LLAMADA ENTRANTE ACTIVA"; echo "\n"; echo "\n"; echo "\n"; -echo "

LLAMADA DE ENTRADA ACTIVA

\n"; +echo "

LLAMADA ENTRANTE ACTIVA

\n"; echo "$NOW_TIME

\n"; } @@ -319,11 +319,11 @@ else echo "CUSTOM - \n"; echo "\n"; - echo "Número Marcado: $row[8]\n"; + echo "Número marcado: $row[8]\n"; echo "Notas:$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|\n"; echo "\n"; echo "COLGAR - \n"; - echo "ENVIAR A MI BUZÓN DE VOZ\n"; + echo "ENVIAR A MI BUZÓN DE VOZ\n"; echo "\n"; echo "\n"; @@ -343,7 +343,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php b/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php index 2c8d756e..fd358459 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_es/live_exten_check.php @@ -109,8 +109,8 @@ if ($format=='debug') { echo "\n"; echo "\n"; -echo "\n"; -echo "Comprobar Extensión Activa"; +echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build EXTEN: $exten server_ip: $server_ip-->\n"; +echo "<title>Revisar la extensión activa"; echo "\n"; echo "\n"; echo "\n"; @@ -270,7 +270,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/manager_send.php b/agc_2-X/trunk/LANG_www/agc_es/manager_send.php index fbbcf4ad..1e4fcf71 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_es/manager_send.php @@ -298,8 +298,8 @@ if ($format=='debug') { echo "\n"; echo "\n"; - echo "\n"; - echo "Enviar al Manager: "; + echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build ACTION: $ACTION server_ip: $server_ip-->\n"; + echo "<title>Enviar al gerente: "; if ($ACTION=="Originate") {echo "Originate";} if ($ACTION=="Redirect") {echo "Redirect";} if ($ACTION=="RedirectName") {echo "RedirectName";} @@ -336,7 +336,7 @@ if ($ACTION=="SysCIDOriginate") { if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) { - echo "Exten $exten No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + echo "Exten $exten No es válido or queryCID $queryCID No es válido, Originate No se ingresó el comando\n"; } else { @@ -344,7 +344,7 @@ if ($ACTION=="SysCIDOriginate") if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02004',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Originate comando enviado a Exten $exten Canal $channel en $server_ip\n"; + echo "Originate comando enviado para Exten $exten Canal $channel en $server_ip\n"; } } @@ -359,12 +359,12 @@ if ($ACTION=="OriginateName") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "extenName $extenName debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nOriginateName Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "extenName $extenName debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nOriginateName Action no se envió\n"; } else { @@ -388,13 +388,13 @@ if ($ACTION=="OriginateNameVmail") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "extenName $extenName debe ser fijado\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nOriginateNameVmail Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "extenName $extenName debe ser fijo\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nOriginateNameVmail Action no se envió\n"; } else { @@ -431,7 +431,7 @@ if ($ACTION=="Originate") { if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or ( (strlen($queryCID)<10) and ($alertCID < 1) ) ) { - echo "ERROR Exten $exten No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + echo "ERROR Exten $exten No es válido or queryCID $queryCID No es válido, Originate No se ingresó el comando\n"; } else { @@ -459,7 +459,7 @@ if ($ACTION=="Originate") if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02007',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Originate comando enviado a Exten $exten Canal $channel en $server_ip |$account|$variable|\n"; + echo "Originate comando enviado para Exten $exten Canal $channel en $server_ip |$account|$variable|\n"; if ($agent_dialed_number > 0) { @@ -507,7 +507,7 @@ if ($ACTION=="HangupConfDial") if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) { $channel_live=0; - echo "conference $exten No es válido or ext_context $ext_context or queryCID $queryCID No es válido, Hangup comando no insertado\n"; + echo "conference $exten No es válido or ext_context $ext_context or queryCID $queryCID No es válido, Hangup No se ingresó el comando\n"; } else { @@ -551,7 +551,7 @@ if ($ACTION=="Hangup") if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) { $channel_live=0; - echo "Channel $channel No es válido or queryCID $queryCID No es válido, Hangup comando no insertado\n"; + echo "Channel $channel No es válido or queryCID $queryCID No es válido, Hangup No se ingresó el comando\n"; } else { @@ -592,7 +592,7 @@ if ($ACTION=="Hangup") if ($row[0]==0) { $channel_live=0; - echo "Channel $channel no está activo en $call_server_ip, Hangup comando no insertado $rowx[0]\n$stmt\n"; + echo "Channel $channel no está activo en $call_server_ip, Hangup No se ingresó el comando $rowx[0]\n$stmt\n"; } else { @@ -610,7 +610,7 @@ if ($ACTION=="Hangup") if ($row[0] > 0) { $channel_live=0; - echo "Channel $channel in use by another agent en $call_server_ip, Hangup comando no insertado $rowx[0]\n$stmt\n"; + echo "Channel $channel in use by another agent en $call_server_ip, Hangup No se ingresó el comando $rowx[0]\n$stmt\n"; if ($WeBRooTWritablE > 0) { $fp = fopen ("./vicidial_debug.txt", "a"); @@ -758,7 +758,7 @@ if ($ACTION=="Hangup") if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02020',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Hangup comando enviado a Canal $channel en $call_server_ip\n"; + echo "Hangup comando enviado para Canal $channel en $call_server_ip\n"; } } } @@ -775,16 +775,16 @@ if ($ACTION=="RedirectVD") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "auto_dial_level $auto_dial_level debe ser fijado\n"; - echo "campaign $campaign debe ser fijado\n"; - echo "uniqueid $uniqueid debe ser fijado\n"; - echo "lead_id $lead_id debe ser fijado\n"; - echo "\nRedirectVD Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "auto_dial_level $auto_dial_level debe ser fijo\n"; + echo "campaign $campaign debe ser fijo\n"; + echo "uniqueid $uniqueid debe ser fijo\n"; + echo "lead_id $lead_id debe ser fijo\n"; + echo "\nRedirectVD Action no se envió\n"; } else { @@ -851,14 +851,14 @@ if ($ACTION=="RedirectToPark") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "extenName $extenName debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "parkedby $parkedby debe ser fijado\n"; - echo "\nRedirectToPark Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "extenName $extenName debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "parkedby $parkedby debe ser fijo\n"; + echo "\nRedirectToPark Action no se envió\n"; } else { @@ -869,7 +869,7 @@ 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='PARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';"; + $stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='RETENERED',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<!-- $stmt -->";} $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);} @@ -919,7 +919,7 @@ if ($ACTION=="RedirectToPark") 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='PARKING',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='RETENER',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); @@ -944,12 +944,12 @@ if ($ACTION=="RedirectFromPark") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nRedirectFromPark Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nRedirectFromPark Action no se envió\n"; } else { @@ -1019,7 +1019,7 @@ if ($ACTION=="RedirectFromPark") 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='PARKING',serverid='$queuemetrics_log_id';"; + $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='RETENER',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); @@ -1041,14 +1041,14 @@ if ($ACTION=="RedirectToParkIVR") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "extenName $extenName debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "parkedby $parkedby debe ser fijado\n"; - echo "\nRedirectToPark Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "extenName $extenName debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "parkedby $parkedby debe ser fijo\n"; + echo "\nRedirectToPark Action no se envió\n"; } else { @@ -1059,12 +1059,12 @@ if ($ACTION=="RedirectToParkIVR") 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='PARKING_IVR' where callerid='$CalLCID' limit 1;"; + $stmt = "UPDATE vicidial_auto_calls SET extension='RETENER_IVR' where callerid='$CalLCID' limit 1;"; if ($format=='debug') {echo "\n<!-- $stmt -->";} $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='IVRPARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';"; + $stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRRETENERED',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<!-- $stmt -->";} $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);} @@ -1113,7 +1113,7 @@ if ($ACTION=="RedirectToParkIVR") 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='IVRPARKING',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='IVRRETENER',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); @@ -1137,12 +1137,12 @@ if ($ACTION=="RedirectFromParkIVR") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nRedirectFromPark Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nRedirectFromPark Action no se envió\n"; } else { @@ -1217,7 +1217,7 @@ if ($ACTION=="RedirectFromParkIVR") 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='IVRPARKING',serverid='$queuemetrics_log_id';"; + $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='IVRRETENER',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); @@ -1240,12 +1240,12 @@ if ($ACTION=="RedirectName") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "extenName $extenName debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nRedirectName Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "extenName $extenName debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nRedirectName Action no se envió\n"; } else { @@ -1269,13 +1269,13 @@ if ($ACTION=="RedirectNameVmail") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "extenName $extenName debe ser fijado\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nRedirectNameVmail Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "extenName $extenName debe ser fijo\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nRedirectNameVmail Action no se envió\n"; } else { @@ -1309,13 +1309,13 @@ if ($ACTION=="RedirectXtraCXNeW") $channel_liveX=0; $channel_liveY=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "ExtraChannel $extrachannel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nRedirect Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "ExtraChannel $extrachannel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nRedirect Action no se envió\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) { if ($WeBRooTWritablE > 0) @@ -1395,8 +1395,8 @@ if ($ACTION=="RedirectXtraCXNeW") else { $channel_liveX=0; - echo "Cannot find empty vicidial_conference en $server_ip, Redirect comando no insertado\n|$stmt|"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No puede encontrar conferencia vacía en $server_ip";} + echo "Cannot find empty vicidial_conference en $server_ip, Redirect No se ingresó el comando\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No puede encontrar una conferencia vacía en $server_ip";} } } @@ -1417,7 +1417,7 @@ if ($ACTION=="RedirectXtraCXNeW") if ($rowx[0]==0) { $channel_liveX=0; - echo "Channel $channel no está activo en $call_server_ip, Redirect comando no insertado\n"; + echo "Channel $channel no está activo en $call_server_ip, Redirect No se ingresó el comando\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $call_server_ip";} } } @@ -1436,7 +1436,7 @@ if ($ACTION=="RedirectXtraCXNeW") if ($rowx[0]==0) { $channel_liveY=0; - echo "Channel $channel no está activo en $server_ip, Redirect comando no insertado\n"; + echo "Channel $channel no está activo en $server_ip, Redirect No se ingresó el comando\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $server_ip";} } } @@ -1450,7 +1450,7 @@ if ($ACTION=="RedirectXtraCXNeW") if ($rowx[0] < 1) { $channel_liveY=0; - echo "No Local agent to send call to, Redirect comando no insertado\n"; + echo "No Local agent to send call to, Redirect No se ingresó el comando\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} } else @@ -1486,7 +1486,7 @@ if ($ACTION=="RedirectXtraCXNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02044',$user,$server_ip,$session_name,$one_mysql_log);} - echo "RedirectXtraCX comando enviado a Canal $channel en $call_server_ip and \nHungup $extrachannel en $server_ip\n"; + echo "RedirectXtraCX comando enviado para Canal $channel en $call_server_ip and \nHungup $extrachannel en $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel en $call_server_ip, Hungup $extrachannel en $server_ip";} } } @@ -1534,14 +1534,14 @@ if ($ACTION=="RedirectXtraNeW") $channel_liveX=0; $channel_liveY=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "ExtraChannel $extrachannel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "session_id $session_id debe ser fijado\n"; - echo "\nRedirect Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "ExtraChannel $extrachannel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "session_id $session_id debe ser fijo\n"; + echo "\nRedirect Action no se envió\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) { if ($WeBRooTWritablE > 0) @@ -1612,8 +1612,8 @@ if ($ACTION=="RedirectXtraNeW") else { $channel_liveX=0; - echo "Cannot find empty vicidial_conference en $server_ip, Redirect comando no insertado\n|$stmt|"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No puede encontrar conferencia vacía en $server_ip";} + echo "Cannot find empty vicidial_conference en $server_ip, Redirect No se ingresó el comando\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No puede encontrar una conferencia vacía en $server_ip";} } } @@ -1634,7 +1634,7 @@ if ($ACTION=="RedirectXtraNeW") if ($rowx[0]==0) { $channel_liveX=0; - echo "Channel $channel no está activo en $call_server_ip, Redirect comando no insertado\n"; + echo "Channel $channel no está activo en $call_server_ip, Redirect No se ingresó el comando\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $call_server_ip";} } } @@ -1653,7 +1653,7 @@ if ($ACTION=="RedirectXtraNeW") if ($rowx[0]==0) { $channel_liveY=0; - echo "Channel $channel no está activo en $server_ip, Redirect comando no insertado\n"; + echo "Channel $channel no está activo en $server_ip, Redirect No se ingresó el comando\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel no está activo en $server_ip";} } } @@ -1666,7 +1666,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02057',$user,$server_ip,$session_name,$one_mysql_log);} - echo "RedirectXtra comando enviado a Canal $channel and \nExtraChannel $extrachannel\n to $exten en $server_ip\n"; + echo "RedirectXtra comando enviado para Canal $channel and \nExtraChannel $extrachannel\n to $exten en $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten en $server_ip";} } else @@ -1693,7 +1693,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02059',$user,$server_ip,$session_name,$one_mysql_log);} - echo "RedirectXtra comando enviado a Canal $channel en $call_server_ip and \nExtraChannel $extrachannel\n to $exten en $server_ip\n"; + echo "RedirectXtra comando enviado para Canal $channel en $call_server_ip and \nExtraChannel $extrachannel\n to $exten en $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} } } @@ -1755,12 +1755,12 @@ if ($ACTION=="Redirect") { $channel_live=0; echo "Una de estas variables No es válido:\n"; - echo "Channel $channel debe ser mayor de 2 caracteres\n"; - echo "queryCID $queryCID debe ser mayor de 14 caracteres\n"; - echo "exten $exten debe ser fijado\n"; - echo "ext_context $ext_context debe ser fijado\n"; - echo "ext_priority $ext_priority debe ser fijado\n"; - echo "\nRedirect Action no enviado\n"; + echo "Channel $channel debe ser mayor a 2 caracteres\n"; + echo "queryCID $queryCID debe ser mayor a 14 caracteres\n"; + echo "exten $exten debe ser fijo\n"; + echo "ext_context $ext_context debe ser fijo\n"; + echo "ext_priority $ext_priority debe ser fijo\n"; + echo "\nRedirect Action no se envió\n"; } else { @@ -1780,7 +1780,7 @@ if ($ACTION=="Redirect") if ($rowx[0]==0) { $channel_live=0; - echo "Channel $channel no está activo en $server_ip, Redirect comando no insertado\n"; + echo "Channel $channel no está activo en $server_ip, Redirect No se ingresó el comando\n"; } } if ($channel_live==1) @@ -1790,7 +1790,7 @@ if ($ACTION=="Redirect") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02064',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Redirect comando enviado a Canal $channel en $server_ip\n"; + echo "Redirect comando enviado para Canal $channel en $server_ip\n"; } } } @@ -1812,7 +1812,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<8) ) { $channel_live=0; - echo "Channel $channel No es válido or queryCID $queryCID No es válido or filename: $filename No es válido, $ACTION comando no insertado\n"; + echo "Channel $channel No es válido or queryCID $queryCID No es válido or filename: $filename No es válido, $ACTION No se ingresó el comando\n"; } else { @@ -1831,7 +1831,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) if ($rowx[0]==0) { $channel_live=0; - echo "Channel $channel no está activo en $server_ip, $ACTION comando no insertado\n"; + echo "Channel $channel no está activo en $server_ip, $ACTION No se ingresó el comando\n"; } } if ($channel_live==1) @@ -1877,7 +1877,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02071',$user,$server_ip,$session_name,$one_mysql_log);} } } - echo "$ACTION comando enviado a Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + echo "$ACTION comando enviado para Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; } } } @@ -1899,7 +1899,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<8) ) { $channel_live=0; - echo "Channel $channel No es válido or exten $exten No es válido or filename: $filename No es válido, $ACTION comando no insertado\n"; + echo "Channel $channel No es válido or exten $exten No es válido or filename: $filename No es válido, $ACTION No se ingresó el comando\n"; } else { @@ -2033,7 +2033,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $i++; } } - echo "$ACTION comando enviado a Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n LA GRABACIÓN DURARÁ HASTA 60 MINUTOS\n"; + echo "$ACTION comando enviado para Canal $channel en $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n LA GRABACIÓN DURARÁ HASTA 60 MINUTOS\n"; } } @@ -2048,7 +2048,7 @@ if ($ACTION=="VolumeControl") { if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) { - echo "Conferencia $exten, Stage $stage No es válido or queryCID $queryCID No es válido, Originate comando no insertado\n"; + echo "Conferencia $exten, Stage $stage No es válido or queryCID $queryCID No es válido, Originate No se ingresó el comando\n"; } else { @@ -2065,7 +2065,7 @@ if ($ACTION=="VolumeControl") if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02082',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Volume comando enviado a Conferencia $exten, Stage $stage Canal $channel en $server_ip\n"; + echo "Volume comando enviado para Conferencia $exten, Stage $stage Canal $channel en $server_ip\n"; } } @@ -2082,7 +2082,7 @@ if ($ACTION=="VolumeControl") $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); -if ($format=='debug') {echo "\n<!-- tiempo de ejecución del Script: $RUNtime segundos -->";} +if ($format=='debug') {echo "\n<!-- tiempo de ejecución del guión: $RUNtime segundos -->";} if ($format=='debug') {echo "\n</body>\n</html>\n";} exit; diff --git a/agc_2-X/trunk/LANG_www/agc_es/park_calls_display.php b/agc_2-X/trunk/LANG_www/agc_es/park_calls_display.php index 53d9a015..8a4b8dcc 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/park_calls_display.php +++ b/agc_2-X/trunk/LANG_www/agc_es/park_calls_display.php @@ -98,8 +98,8 @@ if ($format=='debug') { echo "<html>\n"; echo "<head>\n"; -echo "<!-- VERSIÓN: $version CONSTRUCCION: $build EXTEN: $exten server_ip: $server_ip-->\n"; -echo "<title>Mostrar Llamadas Aparcadas"; +echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build EXTEN: $exten server_ip: $server_ip-->\n"; +echo "<title>Despliegue de las llamadas retenidas"; echo "\n"; echo "\n"; echo "\n"; @@ -138,7 +138,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/phone_only.php b/agc_2-X/trunk/LANG_www/agc_es/phone_only.php new file mode 100644 index 00000000..923ebeeb --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_es/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Usted ha cerrado sesión. Gracias\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST en server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link en the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location en the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Teléfono web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Reloj checador
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\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 "\n"; + echo "
\"VICIdial\" Teléfono-Only Inicio de sesión
 
Inicio de sesión del teléfono:
Contraseña del teléfono:
Inicio de sesión del usuario:
Contraseña del usuario:
  \n"; + echo "

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Teléfono web client: Inicio de sesión del teléfono\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Reloj checador
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Teléfono-Only Inicio de sesión
 
Inicio de sesión del teléfono:
Contraseña del teléfono:
  \n"; + echo "

VERSIÓN: $version       CONSTRUCCIÓN: $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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "No se inició sesión correctamente, por favor, inténtelo de nuevo
"; + } + } + if ($VDloginDISPLAY) + { + echo "Teléfono web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Reloj checador
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Teléfono-Only Inicio de sesión
 
Inicio de sesión del usuario:
Contraseña del usuario:
  \n"; + echo "

VERSIÓN: $version       CONSTRUCCIÓN: $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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Teléfono web client: Inicio de sesión del teléfono Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Reloj checador
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Español
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Teléfono-Only Inicio de sesión Error
 
Lo sentimos, el inicio de sesión y la contraseña del teléfono no están activos en este sistema, por favor, inténtelo de nuevo:
 
Inicio de sesión del teléfono:
Contraseña del teléfono:

VERSIÓN: $version       CONSTRUCCIÓN: $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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Teléfono 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call segundos counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - segundos en call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Teléfono: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Teléfono:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_es/timeclock.php b/agc_2-X/trunk/LANG_www/agc_es/timeclock.php index 7edcec9e..e3081812 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_es/timeclock.php @@ -122,10 +122,10 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($valid_user < 1) { ### NOT A VALID USER/PASS - $VDdisplayMESSAGE = "El usuario y la contraseña que ha introducido no son activos en el sistema
Por favor, inténtelo de nuevo:"; + $VDdisplayMESSAGE = "El usuario y la contraseña que ha introducido no están activos en el sistema
Por favor, inténtelo de nuevo:"; echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Reloj checador\n"; echo"\n"; echo"\n"; echo "\n"; @@ -140,15 +140,15 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "
Timeclock Reloj checador
 
Conexión Del Usuario:
Inicio de sesión del usuario:
Contraseña Del Usuario:
Contraseña del usuario:
 

VERSIÓN: $version       CONSTRUCCION: $build
 

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -227,10 +227,10 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($last_action_sec < 30) and ($status != 'START') ) { ### You cannot log in or out within 30 segundos of your last login/logout - $VDdisplayMESSAGE = "No puede iniciar sesión o en un plazo de 30 segundos de su última conexión o desconexión"; + $VDdisplayMESSAGE = "No puede iniciar o cerrar sesión en un plazo de 30 segundos después su último inicio o cierre de sesión"; echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Reloj checador\n"; echo"\n"; echo"\n"; echo "\n"; @@ -245,15 +245,15 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "
Timeclock Reloj checador
 
Conexión Del Usuario:
Inicio de sesión del usuario:
Contraseña Del Usuario:
Contraseña del usuario:
 

VERSIÓN: $version       CONSTRUCCION: $build
 

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -266,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Usted ahora tiene registrados"; + $LOGtimeMESSAGE = "Está conectado a una $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -294,8 +294,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($status=='LOGIN') and ($stage=='logout') ) { - $VDdisplayMESSAGE = "Ya ha iniciado la sesión en"; - $LOGtimeMESSAGE = "Que en la sesión$NOW_TIME
Cantidad de tiempo que se han registrado en:$totTIME_HMS"; + $VDdisplayMESSAGE = "Usted ha cerrado su sesión"; + $LOGtimeMESSAGE = "Usted cerró su sesión en$NOW_TIME
El tiempo durante el cual tuvo su sesión abierta:$totTIME_HMS"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';"; @@ -335,29 +335,29 @@ if ( ($stage == 'login') or ($stage == 'logout') ) } if ( ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) ) - {echo "ERROR: timeclock entrada de registro ya realizados:$status|$stage"; exit;} + {echo "ERROR: ya se había ingresado el registro en el reloj checador:$status|$stage"; exit;} if ($referrer=='agent') - {$BACKlink = "VOLVER a la pantalla de Inicio";} + {$BACKlink = "REGRESAR a la pantalla de inicio de sesión del agente";} if ($referrer=='admin') - {$BACKlink = "VOLVER a la Administración";} + {$BACKlink = "REGRESAR a Administración";} if ($referrer=='welcome') - {$BACKlink = "VOLVER a la pantalla de bienvenida";} + {$BACKlink = "REGRESAR a la pantalla de bienvenida";} echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Reloj checador\n"; echo"\n"; echo"\n"; echo "\n"; echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "
Timeclock Reloj checador
 
$LOGtimeMESSAGE
 
$BACKlink
 

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -370,21 +370,21 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) { - $VDdisplayMESSAGE = "Vez desde que se conectó por última vez en:$totTIME_HMS"; + $VDdisplayMESSAGE = "Tiempo transcurrido desde la última vez que inició sesión:$totTIME_HMS"; $log_action = 'login'; $button_name = 'LOGIN'; - $LOGtimeMESSAGE = "-Usted se conectó por última vez en:$last_action_date

Haga clic en Conectarse a continuación para acceder al sistema"; + $LOGtimeMESSAGE = "Usted cerró sesión por última vez el:$last_action_date

Haga click en INICIAR SESIÓN a continuación para acceder al sistema"; } if ($status=='LOGIN') { - $VDdisplayMESSAGE = "Cantidad de tiempo que se han registrado en:$totTIME_HMS"; + $VDdisplayMESSAGE = "Tiempo transcurrido desde que inició sesión:$totTIME_HMS"; $log_action = 'logout'; $button_name = 'LOGOUT'; - $LOGtimeMESSAGE = "Iniciado la sesión en que usted en: $last_action_date
Cantidad de tiempo que se han registrado en:$totTIME_HMS

Haga clic a continuación para acceder LOGOUT-out"; + $LOGtimeMESSAGE = "Inició sesión en: $last_action_date
Tiempo transcurrido desde que inició sesión:$totTIME_HMS

Haga click en CERRAR SESIÓN a continuación para salir del sistema"; } echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Reloj checador\n"; echo"\n"; echo"\n"; echo "\n"; @@ -402,12 +402,12 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "
Timeclock Reloj checador
 
$LOGtimeMESSAGE
 
 

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -423,7 +423,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) else { echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Reloj checador\n"; echo"\n"; echo"\n"; echo "\n"; @@ -438,15 +438,15 @@ else echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "
Timeclock Reloj checador
 
Conexión Del Usuario:
Inicio de sesión del usuario:
Contraseña Del Usuario:
Contraseña del usuario:
 

VERSIÓN: $version       CONSTRUCCION: $build
 

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; diff --git a/agc_2-X/trunk/LANG_www/agc_es/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_es/vdc_db_query.php index bf5d5ddd..90cf9d5b 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_es/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -90,6 +90,10 @@ # - $date - ('2010-02-19') # - $custom_field_names - ('|start_date|finish_date|favorite_color|') # - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -286,12 +290,26 @@ # 110625-0814 - Added screen_labels and label hide functions # 110626-0127 - Added queuemetrics_pe_phone_append # 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.4-191'; -$build = '110718-1158'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=419; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); @@ -490,6 +508,22 @@ if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -601,7 +635,7 @@ $hangup_cause_dictionary = array( ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -612,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -690,8 +729,8 @@ if ($format=='debug') { echo "\n"; echo "\n"; - echo "\n"; - echo "VICIDiaL Database Query Script"; + echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build USER: $user server_ip: $server_ip-->\n"; + echo "<title>VICIDiaL Guión de las consultas de la base de datos"; echo "\n"; echo "\n"; echo "\n"; @@ -780,7 +819,7 @@ if ($ACTION == 'LogiNCamPaigns') $shift_ok=0; if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) { - $VDdisplayMESSAGE = "ERROR: No hay cambios habilitado para su grupo de usuarios\n"; + $VDdisplayMESSAGE = "ERROR: No hay cambios habilitados para su grupo de usuarios\n"; $VDloginDISPLAY=1; } else @@ -840,15 +879,15 @@ if ($ACTION == 'LogiNCamPaigns') if ($VDloginDISPLAY > 0) { $loginDATE = date("Ymd"); - $VDdisplayMESSAGE.= "

GERENTE DE TRANSFERENCIA:
\n"; + $VDdisplayMESSAGE.= "

TRANSFERENCIA DEL GERENTE:
\n"; $VDdisplayMESSAGE.= "
\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "DirectorConexión:
\n"; + $VDdisplayMESSAGE.= "DirectorInicio de sesión:
\n"; $VDdisplayMESSAGE.= "DirectorContraseña:
\n"; - $VDdisplayMESSAGE.= "




\n"; + $VDdisplayMESSAGE.= "



\n"; echo "$VDdisplayMESSAGE"; exit; } @@ -862,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; } exit; @@ -895,7 +934,7 @@ if ($ACTION == 'regCLOSER') if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) { $channel_live=0; - echo "Opción Del Grupo $closer_choice No es válido\n"; + echo "Opción de Grupo $closer_choice No es válido\n"; exit; } else @@ -982,7 +1021,7 @@ if ($ACTION == 'regCLOSER') { if (strlen($in_groups[$k])>1) { - $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $stmt="SELECT group_weight,calls_today,group_grade FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00013',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -990,15 +1029,17 @@ if ($ACTION == 'regCLOSER') if ($viga_ct > 0) { $row=mysql_fetch_row($rslt); - $group_weight = $row[0]; + $group_weight = $row[0]; $calls_today = $row[1]; + $group_grade = $row[2]; } else { $group_weight = 0; $calls_today = 0; + $group_grade = 1; } - $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME',group_grade='$group_grade';"; 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);} @@ -1032,7 +1073,7 @@ if ($ACTION == 'regCLOSER') } } - echo "Closer In Opción Del Grupo $closer_choice se ha registrado al usuario $user\n"; + echo "Closer In Opción de Grupo $closer_choice se ha registrado al usuario $user\n"; } @@ -1225,7 +1266,7 @@ if ($ACTION == 'manDiaLnextCaLL') if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) { $channel_live=0; - echo "TOLVA VACÍA\n"; + echo "FILA DE MARCACIÓN VACÍO\n"; echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context No es válido\n"; exit; } @@ -1518,7 +1559,7 @@ if ($ACTION == 'manDiaLnextCaLL') else { ##### gather no hopper dialing settings from campaign - $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary,call_count_limit FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00236',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1535,6 +1576,7 @@ if ($ACTION == 'manDiaLnextCaLL') $lead_order = $row[6]; $lead_order_randomize = $row[7]; $lead_order_secondary = $row[8]; + $call_count_limit = $row[9]; } if (eregi("N",$no_hopper_dialing)) { @@ -1871,6 +1913,12 @@ if ($ACTION == 'manDiaLnextCaLL') $DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )"; } + $CCLsql=''; + if ($call_count_limit > 0) + { + $CCLsql = "and (called_count < $call_count_limit)"; + } + $stmt="SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00239',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1994,7 +2042,7 @@ if ($ACTION == 'manDiaLnextCaLL') if (eregi("UP TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now desc, $last_order";} if (eregi("DOWN TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now, $last_order";} - $stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and user NOT LIKE \"QUEUE%\" and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; + $stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and user NOT LIKE \"QUEUE%\" and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00242',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2006,7 +2054,7 @@ if ($ACTION == 'manDiaLnextCaLL') if ($affected_rows > 0) { - $stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id FROM vicidial_list where user='QUEUE$user' order by modify_date desc LIMIT 1;"; + $stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id,vendor_lead_code FROM vicidial_list where user='QUEUE$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";} @@ -2019,8 +2067,9 @@ if ($ACTION == 'manDiaLnextCaLL') $gmt_offset_now = $row[2]; $state = $row[3]; $entry_list_id = $row[4]; + $vendor_lead_code = $row[5]; - $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';"; + $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -2150,9 +2199,9 @@ if ($ACTION == 'manDiaLnextCaLL') { $post_phone_time_diff_alert_message=''; if ($PHONEdialable < 1) - {$post_phone_time_diff_alert_message .= " Teléfono Area Code Outside Dialable Zone $PHONEgmt_offset ";} + {$post_phone_time_diff_alert_message .= " Teléfono código de área fuera de la zona pueda marcar $PHONEgmt_offset ";} if ($POSTdialable < 1) - {$post_phone_time_diff_alert_message .= " Postal Code Outside Dialable Zone $POSTgmt_offset";} + {$post_phone_time_diff_alert_message .= " Código Postal Fuera de la Zona pueda marcar $POSTgmt_offset";} } } if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) @@ -2161,12 +2210,12 @@ if ($ACTION == 'manDiaLnextCaLL') if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) { if ($PHONEdialable < 1) - {$post_phone_time_diff_alert_message .= " Teléfono Area Code Outside Dialable Zone $PHONEgmt_offset ";} + {$post_phone_time_diff_alert_message .= " Teléfono código de área fuera de la zona pueda marcar $PHONEgmt_offset ";} } if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) { if ($POSTdialable < 1) - {$post_phone_time_diff_alert_message .= " Postal Code Outside Dialable Zone $POSTgmt_offset ";} + {$post_phone_time_diff_alert_message .= " Código Postal Fuera de la Zona pueda marcar $POSTgmt_offset ";} } } ##### END check for postal_code and phone time zones if alert enabled @@ -2288,7 +2337,12 @@ if ($ACTION == 'manDiaLnextCaLL') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00032',$user,$server_ip,$session_name,$one_mysql_log);} - + + $stmt="UPDATE vicidial_lists set list_lastcalldate=NOW() where list_id='$list_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);} + $campaign_cid_override=''; $LISTweb_form_address=''; $LISTweb_form_address_two=''; @@ -2327,7 +2381,7 @@ 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';"; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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";} @@ -2336,13 +2390,32 @@ if ($ACTION == 'manDiaLnextCaLL') { $row=mysql_fetch_row($rslt); $use_custom_cid = $row[0]; - } - if ($use_custom_cid > 0) - { - $temp_CID = preg_replace("/\D/",'',$security); + if ($use_custom_cid == 'AREACODE') + { + $temp_ac = substr("$agent_dialed_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00426',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00427',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$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("%010s", $lead_id); @@ -2560,7 +2633,7 @@ if ($ACTION == 'manDiaLnextCaLL') $VDCL_xferconf_c_number=''; $VDCL_xferconf_d_number=''; $VDCL_xferconf_e_number=''; - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00277',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2577,7 +2650,7 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2702,7 +2775,7 @@ if ($ACTION == 'manDiaLnextCaLL') } else { - echo "TOLVA VACÍA\n"; + echo "FILA DE MARCACIÓN VACÍO\n"; } } } @@ -2720,7 +2793,7 @@ if ($ACTION == 'alt_phone_change') if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) || (strlen($phone_number)<1) ) { $channel_live=0; - echo "TELÉFONO ALT NÚMERO ESTADO NOT CHANGED\n"; + echo "TELÉFONO ALTERNATIVO NÚMERO ESTADO NOT CHANGED\n"; echo "$phone_number $stage $lead_id or $called_count No es válido\n"; exit; } @@ -2731,7 +2804,7 @@ if ($ACTION == 'alt_phone_change') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00041',$user,$server_ip,$session_name,$one_mysql_log);} - echo "TELÉFONO ALT NÚMERO ESTADO CHANGED\n"; + echo "TELÉFONO ALTERNATIVO NÚMERO ESTADO CHANGED\n"; } } @@ -2818,6 +2891,20 @@ if ($ACTION == 'manDiaLonly') } else { + ##### clear out last call to same lead if exists ##### + if (strlen($old_CID) > 16) + { + $old_lead_id = substr($old_CID, -10); + $old_lead_id = ($old_lead_id + 0); + if ($lead_id == "$old_lead_id") + { + $stmt="DELETE FROM vicidial_auto_calls where callerid='$old_CID' and lead_id='$old_lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00428',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); @@ -2896,7 +2983,7 @@ 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';"; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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";} @@ -2905,10 +2992,28 @@ if ($ACTION == 'manDiaLonly') { $row=mysql_fetch_row($rslt); $use_custom_cid = $row[0]; - } - if ($use_custom_cid > 0) - { - $temp_CID = preg_replace("/\D/",'',$security); + if ($use_custom_cid == 'AREACODE') + { + $temp_ac = substr("$phone_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00429',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00430',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$temp_CID = preg_replace("/\D/",'',$security);} if (strlen($temp_CID) > 6) {$CCID = "$temp_CID"; $CCID_on++;} } @@ -3223,7 +3328,7 @@ if ($ACTION == 'manDiaLlookCaLL') { $wait_sec=0; $dead_epochSQL = ''; - $stmt = "select wait_epoch,wait_sec,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec,dead_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,'00053',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3282,7 +3387,7 @@ if ($stage == "start") fclose($fp); } - echo "REGISTRO NO ENTRADO\n"; + echo "NO SE INGRESÓ EL REGISTRO\n"; echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign No es válido\n"; exit; } @@ -3350,7 +3455,7 @@ if ($stage == "start") } else { - echo "REGISTRO NO ENTRADO\n"; + echo "NO SE INGRESÓ EL REGISTRO\n"; } $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; @@ -3370,7 +3475,7 @@ if ($stage == "start") # } # else # { - # echo "REGISTRO NO ENTRADO\n"; + # echo "NO SE INGRESÓ EL REGISTRO\n"; # } } } @@ -3402,7 +3507,7 @@ if ($stage == "end") } if ( (strlen($uniqueid)<1) or (strlen($lead_id)<1) ) { - echo "REGISTRO NO ENTRADO\n"; + echo "NO SE INGRESÓ EL REGISTRO\n"; echo "uniqueid $uniqueid or lead_id: $lead_id No es válido\n"; exit; } @@ -3572,7 +3677,7 @@ if ($stage == "end") if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)",$auto_alt_dial)) ) { $alt_dial_skip=0; - $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT alt_phone,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00065',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3584,6 +3689,7 @@ if ($stage == "end") $alt_phone = eregi_replace("[^0-9]","",$alt_phone); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$alt_phone = '';} if (strlen($alt_phone)>5) @@ -3632,7 +3738,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',source='A';"; + $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -3649,7 +3755,7 @@ if ($stage == "end") if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) { $addr3_dial_skip=0; - $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT address3,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00069',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3661,6 +3767,7 @@ if ($stage == "end") $address3 = eregi_replace("[^0-9]","",$address3); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$address3 = '';} if (strlen($address3)>5) @@ -3709,7 +3816,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',source='A';"; + $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -3736,7 +3843,7 @@ if ($stage == "end") {$Xlast=0;} $VD_altdialx=''; - $stmt="SELECT gmt_offset_now,state,list_id,entry_list_id FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT gmt_offset_now,state,list_id,entry_list_id,vendor_lead_code 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";} @@ -3748,6 +3855,7 @@ if ($stage == "end") $EA_state = $row[1]; $EA_list_id = $row[2]; $EA_entry_list_id = $row[3]; + $EA_vendor_lead_code = $row[4]; } $alt_dial_phones_count=0; $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; @@ -3825,7 +3933,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',source='A';"; + $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',vendor_lead_code='$EA_vendor_lead_code';"; 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);} @@ -4093,7 +4201,7 @@ if ($stage == "end") } else { - echo "REGISTRO NO ENTRADO\n"; + echo "NO SE INGRESÓ EL REGISTRO\n"; } } else @@ -4119,7 +4227,7 @@ if ($stage == "end") } else { - echo "REGISTRO NO ENTRADO\n\n"; + echo "NO SE INGRESÓ EL REGISTRO\n\n"; } } else @@ -4406,7 +4514,7 @@ if ($stage == "end") $dead_secSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_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,'00101',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4700,7 +4808,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### update the log status to INCALL $user_group=''; - $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $stmt="SELECT user_group,full_name FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -4709,6 +4817,7 @@ if ($ACTION == 'VDADcheckINCOMING') { $row=mysql_fetch_row($rslt); $user_group = trim("$row[0]"); + $fullname = $row[1]; } $stmt = "SELECT campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; @@ -4848,7 +4957,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00281',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4921,7 +5030,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + $stmt = "SELECT count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00118',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4945,7 +5054,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,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination 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);} @@ -4980,7 +5089,7 @@ if ($ACTION == 'VDADcheckINCOMING') $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,timer_action_destination 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);} @@ -5035,7 +5144,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00188',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5048,7 +5157,7 @@ if ($ACTION == 'VDADcheckINCOMING') if (strlen($VDCL_group_web_vars) < 1) { - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00189',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5070,7 +5179,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,timer_action_destination 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);} @@ -5109,7 +5218,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00190',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5124,7 +5233,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_caller_id_number=''; if (strlen($VDCL_default_group_alias)>1) { - $stmt = "select caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; + $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00187',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5139,7 +5248,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00282',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5339,7 +5448,7 @@ if ($ACTION == 'VDADcheckINCOMING') $wait_sec=0; $StarTtime = date("U"); - $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00123',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5414,7 +5523,7 @@ if ($ACTION == 'VDADcheckINCOMING') { if (eregi('--A--user_custom_',$VDCL_start_call_url)) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five 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,'00283',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5499,6 +5608,7 @@ if ($ACTION == 'VDADcheckINCOMING') $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); + $VDCL_start_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($callerid)),$VDCL_start_call_url); if (strlen($custom_field_names)>2) { @@ -5520,7 +5630,7 @@ if ($ACTION == 'VDADcheckINCOMING') $o=0; while ($custom_field_names_ct > $o) { - $form_field_value = trim("$row[$o]"); + $form_field_value = urlencode(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); @@ -5529,10 +5639,42 @@ if ($ACTION == 'VDADcheckINCOMING') } } + $stmt="UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00420',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$VDCL_start_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='start',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00421',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### grab the call_start_url ### if ($DB > 0) {echo "$VDCL_start_call_url
\n";} $SCUfile = file("$VDCL_start_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00422',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + ##### 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;"; @@ -5724,14 +5866,14 @@ if ($ACTION == 'userLOGout') $vla_delete = mysql_affected_rows($link); ##### Delete the vicidial_live_inbound_agents records for this session - $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + $stmt="DELETE from vicidial_live_inbound_agents where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00131',$user,$server_ip,$session_name,$one_mysql_log);} $vlia_delete = mysql_affected_rows($link); $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00136',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6165,7 +6307,7 @@ if ($ACTION == 'updateDISPO') $insert_into_dnc=0; if ( ($use_internal_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6178,7 +6320,7 @@ if ($ACTION == 'updateDISPO') } if ( ($use_campaign_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6195,7 +6337,7 @@ if ($ACTION == 'updateDISPO') $dispo_epochSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; + $stmt = "SELECT dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00150',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6322,7 +6464,7 @@ if ($ACTION == 'updateDISPO') if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) ) { - $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + $stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00156',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6455,7 +6597,7 @@ if ($ACTION == 'updateDISPO') if ( (ereg('ACCTID',$vtiger_search_category)) or (ereg('ACCOUNT',$vtiger_search_category)) ) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6467,7 +6609,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6838,8 +6980,10 @@ if ($ACTION == 'updateDISPO') if (strlen($stage) < 2) {$stage = $campaign;} - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id';"; + $qm_dispo_codeSQL=''; + if (strlen($qm_dispo_code) > 0) + {$qm_dispo_codeSQL = ",data3='$qm_dispo_code'";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id' $qm_dispo_codeSQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00160',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6930,9 +7074,9 @@ if ($ACTION == 'updateDISPO') $talk_time=0; $talk_time_ms=0; $talk_time_min=0; - if (eregi('--A--user_custom_',$dispo_call_url)) + if ( (eregi('--A--user_custom_',$dispo_call_url)) or (eregi('--A--fullname',$dispo_call_url)) ) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $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,'00288',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6940,17 +7084,18 @@ if ($ACTION == 'updateDISPO') if ($VUC_ct > 0) { $row=mysql_fetch_row($rslt); - $user_custom_one = urlencode(trim($row[0])); - $user_custom_two = urlencode(trim($row[1])); - $user_custom_three = urlencode(trim($row[2])); - $user_custom_four = urlencode(trim($row[3])); - $user_custom_five = urlencode(trim($row[4])); + $user_custom_one = urlencode(trim($row[0])); + $user_custom_two = urlencode(trim($row[1])); + $user_custom_three = urlencode(trim($row[2])); + $user_custom_four = urlencode(trim($row[3])); + $user_custom_five = urlencode(trim($row[4])); + $fullname = urlencode(trim($row[5])); } } if (eregi('--A--talk_time',$dispo_call_url)) { - $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + $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,'00289',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6977,7 +7122,7 @@ if ($ACTION == 'updateDISPO') if (eregi('--A--dispo_name--B--',$dispo_call_url)) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00297',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6985,11 +7130,11 @@ if ($ACTION == 'updateDISPO') if ($vs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00298',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6997,7 +7142,7 @@ if ($ACTION == 'updateDISPO') if ($vcs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } } if (strlen($status_name) < 1) {$status_name = $dispo_choice;} @@ -7053,8 +7198,8 @@ if ($ACTION == 'updateDISPO') if ($VDIDL_ct > 0) { $row=mysql_fetch_row($rslt); - $DID_pattern = $row[0]; - $DID_description = $row[1]; + $DID_pattern = urlencode(trim($row[0])); + $DID_description = urlencode(trim($row[1])); } } } @@ -7192,6 +7337,7 @@ if ($ACTION == 'updateDISPO') $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); + $dispo_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($MDnextCID)),$dispo_call_url); if (strlen($FORMcustom_field_names)>2) { @@ -7213,7 +7359,7 @@ if ($ACTION == 'updateDISPO') $o=0; while ($custom_field_names_ct > $o) { - $form_field_value = trim("$row[$o]"); + $form_field_value = urlencode(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); @@ -7222,10 +7368,43 @@ if ($ACTION == 'updateDISPO') } } + $stmt="UPDATE vicidial_log_extended set dispo_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00423',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$dispo_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='dispo',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00424',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### send dispo_call_url ### if ($DB > 0) {echo "$dispo_call_url
\n";} $SCUfile = file("$dispo_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00425',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00296',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7305,7 +7484,7 @@ if ($ACTION == 'updateDISPO') 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';"; + $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);} @@ -7562,7 +7741,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) } $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7678,7 +7857,7 @@ if ($ACTION == 'UpdatEFavoritEs') } else { - $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + $stmt = "SELECT count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00172',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7729,7 +7908,7 @@ if ($ACTION == 'PauseCodeSubmit') else { $pause_sec=0; - $stmt = "select pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $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,'00306',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8016,7 +8195,7 @@ if ($ACTION == 'AGENTSview') } echo "
\n"; - echo "    -READY      -INCALL      -PAUSED  \n"; + echo "    -LISTO      -INCALL      -PAUSA  \n"; if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) {echo "    -LOGGED-OUT  \n";} @@ -8039,7 +8218,7 @@ if ($ACTION == 'CALLSINQUEUEview') if (eregi('NONE',$view_calls_in_queue)) { - echo "Ver las llamadas en cola de personas de movilidad reducida para esta campaña\n"; + echo "La vista de llamadas en cola se desactivó para esta campaña\n"; exit; } else @@ -8258,11 +8437,11 @@ if ($ACTION == 'CALLLOGview') echo "   ALT   "; echo "   HANGUP   "; echo "   INFO   "; - echo "   DIAL   "; + echo "   MARCAR   "; 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;"; + $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|";} @@ -8296,7 +8475,7 @@ if ($ACTION == 'CALLLOGview') $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;"; + $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|";} @@ -8332,7 +8511,7 @@ if ($ACTION == 'CALLLOGview') if ($g > 0) {sort($ALLsort, SORT_NUMERIC);} else - {echo "No calls en this day";} + {echo "No hay llamadas en este día";} $u=0; while ($g > $u) @@ -8345,13 +8524,16 @@ if ($ACTION == 'CALLLOGview') else {$bgcolor='bgcolor="#9BB9FB"';} + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} $u++; echo ""; echo "$u"; echo "$ALLcall_date[$i]"; echo " $ALLlength_in_sec[$i]\n"; echo " $ALLstatus[$i]\n"; - echo " $ALLphone_code[$i] $ALLphone_number[$i] \n"; + echo " $ALLphone_code[$i] $phone_number_display \n"; echo " $Allfirst_name[$i] $Alllast_name[$i] \n"; echo " $ALLcampaign_id[$i] \n"; echo " $ALLin_out[$i] \n"; @@ -8364,7 +8546,7 @@ if ($ACTION == 'CALLLOGview') echo ""; echo "
"; - echo "Close Call Log"; + echo "Cerca de registro de llamadas"; echo "
"; } @@ -8377,7 +8559,7 @@ if ($ACTION == 'SEARCHRESULTSview') if (strlen($stage) < 3) {$stage = '670';} - $stmt="select agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} $rslt=mysql_query($stmt, $link); $camps_to_print = mysql_num_rows($rslt); @@ -8411,8 +8593,10 @@ if ($ACTION == 'SEARCHRESULTSview') elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) { ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} if (preg_match('/MAIN/',$search)) - {$searchSQL = "phone_number='$phone_number'";} + {$searchSQL .= "phone_number='$phone_number'";} if (preg_match('/ALT/',$search)) { if (strlen($searchSQL) > 10) @@ -8425,6 +8609,8 @@ if ($ACTION == 'SEARCHRESULTSview') {$searchSQL .= " or ";} $searchSQL .= "address3='$phone_number'"; } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} } elseif (strlen($last_name) > 0) { @@ -8459,7 +8645,7 @@ if ($ACTION == 'SEARCHRESULTSview') { echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; echo "

"; - echo "Vaya Detrás"; + echo "Regresar"; echo "
"; exit; } @@ -8573,7 +8759,7 @@ if ($ACTION == 'SEARCHRESULTSview') ##### BEGIN search queries and output ##### - $stmt="select count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; ### LOG INSERTION Search Log Table ### $SQL_log = "$stmt|"; @@ -8604,7 +8790,7 @@ if ($ACTION == 'SEARCHRESULTSview') echo "
\n"; echo ""; - echo "Results Found: $search_result_count"; + echo "Los resultados encontrados: $search_result_count"; echo "\n"; echo "
\n"; echo ""; @@ -8618,12 +8804,12 @@ if ($ACTION == 'SEARCHRESULTSview') echo ""; echo ""; echo ""; - echo ""; + echo ""; echo ""; if ($search_result_count) { - $stmt="select first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} $out_logs_to_print = mysql_num_rows($rslt); @@ -8650,7 +8836,7 @@ if ($ACTION == 'SEARCHRESULTSview') } if ($g < 1) - {echo "";} + {echo "";} $u=0; while ($g > $u) @@ -8687,18 +8873,18 @@ if ($ACTION == 'SEARCHRESULTSview') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} } else - {echo "";} + {echo "";} echo "
  STATE     ZIP     INFO     DIAL     MARCAR  
No results found
No se encontraron resultados
No results found
No se encontraron resultados
"; echo "
"; - echo "Vaya Detrás"; + echo "Regresar"; echo "
"; } else { echo "ERROR: There was a problem with your search terms\n"; echo "

"; - echo "Vaya Detrás"; + echo "Regresar"; echo "
"; exit; } @@ -8708,7 +8894,335 @@ if ($ACTION == 'SEARCHRESULTSview') { echo "ERROR: Campaña not found\n"; echo "

"; - echo "Vaya Detrás"; + echo "Regresar"; + echo "
"; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Regresar"; + echo "
"; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Los resultados encontrados: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set segundos='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
No se encontraron resultados
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
No se encontraron resultados
"; + echo "
"; + echo "Regresar"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Regresar"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campaña not found\n"; + echo "

"; + echo "Regresar"; echo "
"; exit; } @@ -8735,7 +9249,7 @@ if ($ACTION == 'LEADINFOview') $callback_id = preg_replace('/\D/','',$callback_id); if (strlen($callback_id) > 0) { - $stmt="select status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} $cb_to_print = mysql_num_rows($rslt); @@ -8744,11 +9258,11 @@ if ($ACTION == 'LEADINFOview') { $row=mysql_fetch_row($rslt); echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo "
Callback Estado:   $row[0]
Callback Lead Estado:   $row[7]
Callback Entry Time:   $row[1]
Callback Trigger Time:   $row[2]
Callback Comentarios:  $row[6]
Devolución de llamada de estado:   $row[0]
Devolución de llamada Estado de plomo:   $row[7]
Devolución de llamada Hora de entrada:   $row[1]
Devolución de llamada Trigger Time:   $row[2]
Comentarios de devolución de llamada:   $row[6]
"; echo "
"; $hide_dial_links++; @@ -8757,7 +9271,7 @@ if ($ACTION == 'LEADINFOview') ### END Display callback information ### ### find the screen_label for this campaign - $stmt="select screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} $csl_to_print = mysql_num_rows($rslt); @@ -8782,13 +9296,13 @@ if ($ACTION == 'LEADINFOview') $label_state = 'Estado'; $label_province = 'Provincia'; $label_postal_code = 'CódigoPostal'; - $label_vendor_lead_code = 'VendedorID'; + $label_vendor_lead_code = 'ID del vendedor'; $label_gender = 'Gender'; $label_phone_number = 'Teléfono'; - $label_phone_code = 'Código Del Dial'; - $label_alt_phone = 'Teléfono Alt'; - $label_security_phrase = 'Demostración'; - $label_email = 'Email'; + $label_phone_code = 'Código de marcación'; + $label_alt_phone = 'Teléfono alternativo'; + $label_security_phrase = 'Mostrar'; + $label_email = 'Correo electrónico'; $label_comments = 'Comentarios'; $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,label_hide_field_logs from system_settings;"; @@ -8855,7 +9369,7 @@ if ($ACTION == 'LEADINFOview') $INFOout .= ""; - $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;"; + $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); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} $info_to_print = mysql_num_rows($rslt); @@ -8905,9 +9419,9 @@ if ($ACTION == 'LEADINFOview') { $post_phone_time_diff_alert_message=''; if ($PHONEdialable < 1) - {$post_phone_time_diff_alert_message .= " Teléfono Area Code Outside Dialable Zone $PHONEgmt_offset       ";} + {$post_phone_time_diff_alert_message .= " Teléfono código de área fuera de la zona pueda marcar $PHONEgmt_offset       ";} if ($POSTdialable < 1) - {$post_phone_time_diff_alert_message .= " Postal Code Outside Dialable Zone $POSTgmt_offset";} + {$post_phone_time_diff_alert_message .= " Código Postal Fuera de la Zona pueda marcar $POSTgmt_offset";} } } if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) @@ -8916,12 +9430,12 @@ if ($ACTION == 'LEADINFOview') if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) { if ($PHONEdialable < 1) - {$post_phone_time_diff_alert_message .= " Teléfono Area Code Outside Dialable Zone $PHONEgmt_offset       ";} + {$post_phone_time_diff_alert_message .= " Teléfono código de área fuera de la zona pueda marcar $PHONEgmt_offset       ";} } if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) { if ($POSTdialable < 1) - {$post_phone_time_diff_alert_message .= " Postal Code Outside Dialable Zone $POSTgmt_offset ";} + {$post_phone_time_diff_alert_message .= " Código Postal Fuera de la Zona pueda marcar $POSTgmt_offset ";} } if (strlen($post_phone_time_diff_alert_message)>5) @@ -9059,7 +9573,7 @@ if ($ACTION == 'LEADINFOview') ### BEGIN Gather Call Log and notes ### $NOTESout=''; if ($search != 'logfirst') - {$NOTESout .= "
CALL LOG FOR THIS LEAD:
\n";} + {$NOTESout .= "
REGISTRO DE LLAMADAS PARA ESTE CABLE:
\n";} $NOTESout .= "
"; $NOTESout .= ""; $NOTESout .= ""; @@ -9077,7 +9591,7 @@ if ($ACTION == 'LEADINFOview') $NOTESout .= ""; - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $out_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {$NOTESout .= "|$out_logs_to_print|$stmt|";} @@ -9128,7 +9642,7 @@ if ($ACTION == 'LEADINFOview') $u++; } - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $in_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {$NOTESout .= "|$in_logs_to_print|$stmt|";} @@ -9182,7 +9696,7 @@ if ($ACTION == 'LEADINFOview') if ($g > 0) {sort($ALLsort, SORT_NUMERIC);} else - {$NOTESout .= "";} + {$NOTESout .= "";} $u=0; while ($g > $u) @@ -9195,6 +9709,10 @@ if ($ACTION == 'LEADINFOview') else {$bgcolor='bgcolor="#9BB9FB"';} + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $u++; $NOTESout .= ""; $NOTESout .= ""; @@ -9202,7 +9720,7 @@ if ($ACTION == 'LEADINFOview') $NOTESout .= "\n"; $NOTESout .= "\n"; $NOTESout .= "\n"; - $NOTESout .= "\n"; + $NOTESout .= "\n"; $NOTESout .= "\n"; $NOTESout .= "\n"; $NOTESout .= "\n"; @@ -9244,7 +9762,7 @@ if ($ACTION == 'CALLSINQUEUEgrab') if ( (eregi('NONE',$view_calls_in_queue)) or (eregi('N',$grab_calls_in_queue)) ) { - echo "ERROR: Ver las llamadas en cola de personas de movilidad reducida para esta campaña\n"; + echo "ERROR: La vista de llamadas en cola se desactivó para esta campaña\n"; exit; } else @@ -9309,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -9335,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -9353,18 +9893,33 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status IN('LIVE');"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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);} @@ -9398,7 +9953,7 @@ if ($ACTION == 'customer_3way_hangup_process') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -9434,7 +9989,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_es/vdc_form_display.php index 1fa3a965..928fe0ed 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/vdc_form_display.php +++ b/agc_2-X/trunk/LANG_www/agc_es/vdc_form_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell 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 @@ -12,10 +12,14 @@ # 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields # -$version = '2.4-4'; -$build = '100916-1749'; +$version = '2.4-8'; +$build = '120315-1729'; require("dbconnect.php"); require_once("functions.php"); @@ -138,6 +142,8 @@ 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["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} @@ -281,6 +287,8 @@ if ($stage=='SUBMIT') 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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes if ( ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='CHECKBOX') or ($A_field_type[$o]=='RADIO') ) { @@ -306,13 +314,13 @@ if ($stage=='SUBMIT') $A_field_value[$o] = $form_field_value; - if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='READONLY') ) + if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) { $A_field_value[$o]='----IGNORE----'; } else { - if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + if (preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) { $VL_update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; } diff --git a/agc_2-X/trunk/LANG_www/agc_es/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_es/vdc_script_display.php index 91fd21e7..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_es/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -15,10 +15,12 @@ # 100823-1644 - Added DID variables # 100902-1344 - Added closecallid, xfercallid, agent_log_id variables # 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.4-9'; -$build = '110420-1201'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -186,6 +188,8 @@ if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_u 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} @@ -475,6 +479,7 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); $script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$script_text); if ($CF_uses_custom_fields=='Y') @@ -505,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
  #  
No calls found
No hay llamadas encontrado
$u $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i]
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_es/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_es/vdc_script_notes.php index afeae2fb..42865030 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/vdc_script_notes.php +++ b/agc_2-X/trunk/LANG_www/agc_es/vdc_script_notes.php @@ -258,13 +258,13 @@ $label_city = 'Ciudad'; $label_state = 'Estado'; $label_province = 'Provincia'; $label_postal_code = 'CódigoPostal'; -$label_vendor_lead_code = 'VendedorID'; +$label_vendor_lead_code = 'ID del vendedor'; $label_gender = 'Gender'; $label_phone_number = 'Teléfono'; -$label_phone_code = 'Código Del Dial'; -$label_alt_phone = 'Teléfono Alt'; -$label_security_phrase = 'Demostración'; -$label_email = 'Email'; +$label_phone_code = 'Código de marcación'; +$label_alt_phone = 'Teléfono alternativo'; +$label_security_phrase = 'Mostrar'; +$label_email = 'Correo electrónico'; $label_comments = 'Comentarios'; $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;"; @@ -316,7 +316,7 @@ else echo "\n"; echo "\n"; -echo "\n"; +echo "\n"; echo "ViciDial Notas"; echo "\n"; echo "\n"; @@ -391,7 +391,7 @@ $URLsubmit = $URLarray[0]; \n"; +echo "\n"; echo "\n"; if ($campaign_login_list > 0) @@ -665,7 +686,7 @@ if ($campaign_login_list > 0) $SQL_log = "$stmt|"; $SQL_log = ereg_replace(';','',$SQL_log); $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='GERENTE DE TRANSFERENCIA OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';"; + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='TRANSFERENCIA DEL GERENTE OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01060',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -786,7 +807,7 @@ if ($LogiNAJAX > 0) // alert(logincampaign_query); // alert(xmlhttp.responseText); document.getElementById("LogiNCamPaigns").innerHTML = Nactiveext; - document.getElementById("LogiNReseT").innerHTML = ""; + document.getElementById("LogiNReseT").innerHTML = ""; document.getElementById("VD_campaign").focus(); } } @@ -819,11 +840,11 @@ else if ($relogin == 'YES') { - echo "Agent web client: Conexión Otra Vez\n"; + echo "Agent web client: Volver a iniciar sesión\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -833,22 +854,22 @@ echo "\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "
\"VICIdial\" Conexión Otra Vez Volver a iniciar sesión
 
Conexión Del Teléfono:
Inicio de sesión del teléfono:
Contraseña Del Teléfono:
Contraseña del teléfono:
Conexión Del Usuario:
Inicio de sesión del usuario:
Contraseña Del Usuario:
Contraseña del usuario:
Campaña: $camp_form_code
  \n"; - echo "

VERSIÓN: $version       CONSTRUCCION: $build
  \n"; + echo "

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -860,11 +881,11 @@ if ($user_login_first == 1) { if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) { - echo "Agent web client: Conexión en la Campaña\n"; + echo "Agent web client: Inicio de sesión de la campaña\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "
Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -874,21 +895,21 @@ echo "\n"; #echo "\n"; #echo "\n"; - echo "

Conexión Del Usuario

"; + echo "

Inicio de sesión del usuario

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; echo "
\"VICIdial\" Conexión en la Campaña Inicio de sesión de la campaña
 
Conexión Del Usuario:
Inicio de sesión del usuario:
Contraseña Del Usuario:
Contraseña del usuario:
Campaña: $camp_form_code
  \n"; + echo "
  \n"; echo "

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -913,7 +934,7 @@ echo "
\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -923,22 +944,22 @@ echo "\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; echo "
\"VICIdial\" Conexión Inicio de sesión
 
Conexión Del Teléfono:
Inicio de sesión del teléfono:
Contraseña Del Teléfono:
Contraseña del teléfono:
Conexión Del Usuario:
Inicio de sesión del usuario: /
Contraseña Del Usuario:
Contraseña del usuario:
Campaña: $camp_form_code
\"   \n"; + echo "
\"   \n"; echo "

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -951,11 +972,11 @@ echo "
Agent web client: Conexión Del Teléfono\n"; + echo "Agent web client: Inicio de sesión del teléfono\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -968,13 +989,13 @@ echo " phone login "; echo "\n"; echo "   \n"; - echo "Conexión Del Teléfono: "; + echo "Inicio de sesión del teléfono: "; echo "\n"; - echo "Contraseña Del Teléfono: "; + echo "Contraseña del teléfono: "; echo "\n"; - echo "   \n"; + echo "   \n"; echo "\n"; - echo "
VERSIÓN: $version       CONSTRUCCION: $build
\n"; + echo "
VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "
\n"; echo "\n\n"; echo "\n\n"; @@ -1005,7 +1026,7 @@ else $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,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $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,agent_lead_search_override,preset_contact_search from vicidial_users where user='$VD_login' and pass='$VD_pass'"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); @@ -1036,6 +1057,7 @@ else $VU_agent_call_log_view_override = $row[24]; $VU_agent_choose_blended = $row[25]; $VU_agent_lead_search_override = $row[26]; + $VU_preset_contact_search = $row[27]; if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';} @@ -1116,7 +1138,7 @@ else if ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) ) { $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "USTED DEBE ENTRAR A LA PRIMERA TIMECLOCK
"; + $VDdisplayMESSAGE = "USTED DEBE INGRESAR PRIMERO AL RELOJ CHECADOR
"; } } ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR @@ -1128,7 +1150,7 @@ else if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) { $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "ERROR: No hay cambios habilitado para su grupo de usuarios
"; + $VDdisplayMESSAGE = "ERROR: No hay cambios habilitados para su grupo de usuarios
"; } else { @@ -1186,7 +1208,7 @@ else } if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) ) { - $VDdisplayMESSAGE.= "

GERENTE DE TRANSFERENCIA:
\n"; + $VDdisplayMESSAGE.= "

TRANSFERENCIA DEL GERENTE:
\n"; $VDdisplayMESSAGE.= "
\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; @@ -1195,18 +1217,17 @@ else $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "DirectorConexión:
\n"; + $VDdisplayMESSAGE.= "DirectorInicio de sesión:
\n"; $VDdisplayMESSAGE.= "DirectorContraseña:
\n"; $VDdisplayMESSAGE.= "
\n"; } } - ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR - + ### 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"); + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } $user_abb = "$VD_login$VD_login$VD_login$VD_login"; @@ -1221,11 +1242,11 @@ else if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) ) { - echo "Agent web client: Conexión en la Campaña\n"; + echo "Agent web client: Inicio de sesión de la campaña\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "
Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -1236,10 +1257,10 @@ echo "\n"; echo "\n"; echo "\n"; - echo "Conexión: \n
"; + echo "Inicio de sesión: \n
"; echo "Contraseña:
\n"; echo "Campaña: $camp_form_code
\n"; - echo "   \n"; + echo "   \n"; echo "\n"; echo "\n\n"; echo "\n\n"; @@ -1353,7 +1374,7 @@ echo "
0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1457,6 +1478,8 @@ echo " 0) and (strlen($qm_phone_environment)>0) ) {$qm_phone_environment .= "-$qm_extension";} @@ -1506,8 +1529,11 @@ echo "\n"; + echo "\n"; } else { $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "La campaña no está activa, intentelo otra vez, por favor
"; + $VDdisplayMESSAGE = "La campaña no está activa, por favor, inténtelo de nuevo
"; } } else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); fclose($fp); } $VDloginDISPLAY=1; - $VDdisplayMESSAGE = "La conexión incorrecta, intentelo otra vez, por favor
"; + $VDdisplayMESSAGE = "No se inició sesión correctamente, por favor, inténtelo de nuevo
"; } } if ($VDloginDISPLAY) { - echo "Agent web client: Conexión en la Campaña\n"; + echo "Agent web client: Inicio de sesión de la campaña\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "
Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -1854,18 +1886,18 @@ echo "
$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; echo "
\"VICIdial\" Conexión en la Campaña Inicio de sesión de la campaña
 
Conexión Del Usuario:
Inicio de sesión del usuario:
Contraseña Del Usuario:
Contraseña del usuario:
Campaña: $camp_form_code
  \n"; + echo "
  \n"; echo "

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -1887,7 +1919,7 @@ echo "
0) { $row=mysql_fetch_row($rslt); - $alias_found = "$row[0]"; + $alias_found = $row[0]; } if ($alias_found > 0) { @@ -1898,8 +1930,8 @@ echo " 0) { $row=mysql_fetch_row($rslt); - $alias_name = "$row[0]"; - $phone_login = "$row[1]"; + $alias_name = $row[0]; + $phone_login = $row[1]; } } @@ -1931,11 +1963,11 @@ echo "Agent web client: Conexión Del Teléfono Error\n"; + echo "Agent web client: Inicio de sesión del teléfono Error\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -1948,15 +1980,15 @@ echo "\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo ""; + echo "\n"; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo "
\"VICIdial\" Conexión Error Inicio de sesión Error
 
Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor:
 
Conexión Del Teléfono:
 
Lo sentimos, el inicio de sesión y la contraseña del teléfono no están activos en este sistema, por favor, inténtelo de nuevo:
 
Inicio de sesión del teléfono:
Contraseña Del Teléfono:
Contraseña del teléfono:

VERSIÓN: $version       CONSTRUCCION: $build

VERSIÓN: $version       CONSTRUCCIÓN: $build
\n"; echo "\n\n"; echo "\n\n"; @@ -1965,8 +1997,9 @@ echo "
0) { $pb=0; @@ -1974,7 +2007,9 @@ echo " 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01022',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2027,22 +2062,75 @@ echo " 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) { - if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + if ( ($pllb_grouping == 'ONE_SERVER_ONLY') or ($pllb_grouping == 'CASCADING') ) { - $pb_count=$row[0]; - $pb_server_ip=$rowx[0]; - $phone_login=$phones_auto[$pb]; + if ($pllb_grouping == 'ONE_SERVER_ONLY') + { + ### one-server-only plib check + ### get number of agents logged in to each server + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01074',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowG=mysql_fetch_row($rslt); + + if ($rowG[0] > 0) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + $pb_force_set++; + echo "\n"; + } + } + else + { + ### cascading plib check + ### get number of agents logged in to each server + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01075',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowG=mysql_fetch_row($rslt); + + echo "\n"; + if ( ($rowG[0] > 0) and ($rowG[0] < $pllb_grouping_limit) and ($row[0] < $SSpllb_grouping_limit) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + $pb_force_set++; + echo "\n"; + } + } + } + if ($pb_force_set < 1) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } } } $pb++; } + + + + + + echo "\n"; } + ##### END phone login load balancing functions ##### + 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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);} + 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]; @@ -2141,11 +2229,29 @@ echo " 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 ($protocol == 'EXTERNAL') { $protocol = 'Local'; $extension = "$dialplan_number$AT$ext_context"; } + if (preg_match("/Zap/i",$protocol)) + { + if (preg_match("/^1\.0|^1\.2|^1\.4\.1|^1\.4\.20|^1\.4\.21/i",$asterisk_version)) + {$do_nothing=1;} + else + { + $protocol = 'DAHDI'; + } + } + $SIP_user = "$protocol/$extension"; $SIP_user_DiaL = "$protocol/$extension"; $qm_extension = "$extension"; @@ -2155,21 +2261,14 @@ echo " 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"; } - echo "\n"; + echo "\n"; # If a web form address is not set, use the default one if (strlen($web_form_address)>0) @@ -2180,7 +2279,7 @@ echo "\n"; + print "\n"; $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); } $VICIDiaL_web_form_address_enc = rawurlencode($VICIDiaL_web_form_address); @@ -2194,7 +2293,7 @@ echo "\n"; + 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); @@ -2203,12 +2302,12 @@ echo "\n"; + echo "\n"; } else { $VICIDiaL_allow_closers = 0; - echo "\n"; + echo "\n"; } @@ -2248,7 +2347,7 @@ echo " 0) - {echo "\n";} + {echo "\n";} else { ##### grab the next available vicidial_conference room and reserve it @@ -2271,7 +2370,7 @@ echo "\n"; + echo "\n"; } ### mark leads that were not dispositioned during previous calls as ERI @@ -2280,21 +2379,21 @@ echo " 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"; + 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"; + 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"; + echo "\n"; $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; if ($DB) {echo "$stmt\n";} @@ -2443,7 +2542,7 @@ echo " 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01042',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2453,13 +2552,15 @@ echo " 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01043',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2469,15 +2570,15 @@ echo " 0) { - echo "\n"; + 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,on_hook_ring_time,on_hook_agent,last_inbound_call_time,last_inbound_call_finish) 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','$phone_ring_timeout','$on_hook_agent','$NOW_TIME','$NOW_TIME');"; + $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,on_hook_ring_time,on_hook_agent,last_inbound_call_time,last_inbound_call_finish,campaign_grade) 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','$phone_ring_timeout','$on_hook_agent','$NOW_TIME','$NOW_TIME','$campaign_grade');"; 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"; + echo "\n"; if ($enable_queuemetrics_logging > 0) { @@ -2533,14 +2634,14 @@ echo "\n"; + 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,on_hook_ring_time,on_hook_agent) 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','$phone_ring_timeout','$on_hook_agent');"; + $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,on_hook_ring_time,on_hook_agent,campaign_grade) 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','$phone_ring_timeout','$on_hook_agent','$campaign_grade');"; 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"; + echo "\n"; if ($enable_queuemetrics_logging > 0) { @@ -2588,25 +2689,25 @@ echo "Agent web client: Conexión en la Campaña\n"; + echo "Agent web client: Inicio de sesión de la campaña\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; - echo "Lo siento, no hay leads en el hopper de esta campaña\n"; + echo "Lo sentimos, no hay contactos en la fila de marcación de esta campaña\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "Conexión: \n
"; + echo "Inicio de sesión: \n
"; echo "Contraseña:
\n"; echo "Campaña: $camp_form_code
\n"; - echo "   \n"; + echo "   \n"; echo "\n"; echo "
\n\n"; echo "\n\n"; @@ -2615,11 +2716,11 @@ echo "Agent web client: Conexión en la Campaña\n"; + echo "Agent web client: Inicio de sesión de la campaña\n"; echo "\n"; echo "\n"; if ($hide_timeclock_link < 1) - {echo "Timeclock
\n";} + {echo " Reloj checador
\n";} echo "\n"; echo "\n"; echo "\n";echo "\n"; echo "
English Español
\n"; @@ -2630,10 +2731,10 @@ echo "\n"; echo "\n"; echo "\n"; - echo "Conexión: \n
"; + echo "Inicio de sesión: \n
"; echo "Contraseña:
\n"; echo "Campaña: $camp_form_code
\n"; - echo "   \n"; + echo "   \n"; echo "\n"; echo "\n\n"; echo "\n\n"; @@ -2760,6 +2861,10 @@ $MASTERwidth=($BROWSER_WIDTH - 340); $MASTERheight=($BROWSER_HEIGHT - 200); if ($MASTERwidth < 430) {$MASTERwidth = '430';} if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($per_call_notes == 'ENABLED') + { + if ($MASTERheight < 340) {$MASTERheight = '340';} + } if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} $CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) @@ -2822,7 +2927,7 @@ $limit_days=999; if ($callback_days_limit > 0) {$limit_days=$callback_days_limit;} -$Cmonths = Array('Enero','February','Marcha','Abril','Puede','Junio', +$Cmonths = Array('Enero','February','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'); $Cdays = Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); @@ -2984,6 +3089,7 @@ $CCAL_OUT .= ""; var CallBackrecipient = ''; var CallBackCommenTs = ''; var CallBackLeadEstado = ''; + var DispoQMcsCODE = ''; var scheduled_callbacks = ''; var dispo_check_all_pause = ''; var api_check_all_pause = ''; @@ -3289,6 +3395,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var alert_enabled = ''; var allow_alerts = ''; var shift_logout_flag = 0; + var api_logout_flag = 0; var vtiger_callback_id = 0; var agent_status_view = ''; var agent_status_view_time = ''; @@ -3429,6 +3536,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var custom_3way_button_transfer=''; var custom_3way_button_transfer_enabled=''; var custom_3way_button_transfer_park=''; + var custom_3way_button_transfer_view=''; + var custom_3way_button_transfer_contacts=''; var waiting_on_dispo=0; var disable_dispo_screen=''; var disable_dispo_status=''; @@ -3436,10 +3545,16 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var status_display_LEADID=''; var status_display_LISTID=''; var qm_extension=''; - var DiaLControl_auto_HTML = "\"
\"Comienzo\""; - var DiaLControl_auto_HTML_ready = "\"\"Comienzo\""; - var DiaLControl_auto_HTML_OFF = "\"\"Comienzo\""; - var DiaLControl_manual_HTML = "\"Marcar"; + var hide_dispo_list=''; + var external_transferconf_count=0; + var consult_custom_delay=''; + var consult_custom_wait=0; + var consult_custom_go=0; + var consult_custom_sent=0; + var DiaLControl_auto_HTML = "\"\"Retomar\""; + var DiaLControl_auto_HTML_ready = "\"\"Retomar\""; + var DiaLControl_auto_HTML_OFF = "\"\"Retomar\""; + var DiaLControl_manual_HTML = "\"Marcar"; var image_loading = new Image(); image_loading.src="../agc/images/loading.gif"; var image_blank = new Image(); @@ -3665,45 +3780,58 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} function custom_button_transfer() { ShoWTransferMain('ON'); - - if ( (custom_3way_button_transfer == 'PRESET_1') || (custom_3way_button_transfer == 'PARKING_PRESET_1') ) - {document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; document.vicidial_form.xfername.value='D1';} - if ( (custom_3way_button_transfer == 'PRESET_2') || (custom_3way_button_transfer == 'PARKING_PRESET_2') ) - {document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; document.vicidial_form.xfername.value='D2';} - if ( (custom_3way_button_transfer == 'PRESET_3') || (custom_3way_button_transfer == 'PARKING_PRESET_3') ) - {document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber; document.vicidial_form.xfername.value='D3';} - if ( (custom_3way_button_transfer == 'PRESET_4') || (custom_3way_button_transfer == 'PARKING_PRESET_4') ) - {document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber; document.vicidial_form.xfername.value='D4';} - if ( (custom_3way_button_transfer == 'PRESET_5') || (custom_3way_button_transfer == 'PARKING_PRESET_5') ) - {document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber; document.vicidial_form.xfername.value='D5';} - if ( (custom_3way_button_transfer == 'FIELD_address3') || (custom_3way_button_transfer == 'PARKING_FIELD_address3') ) - {document.vicidial_form.xfernumber.value = document.vicidial_form.address3.value;} - if ( (custom_3way_button_transfer == 'FIELD_province') || (custom_3way_button_transfer == 'PARKING_FIELD_province') ) - {document.vicidial_form.xfernumber.value = document.vicidial_form.province.value;} - if ( (custom_3way_button_transfer == 'FIELD_security_phrase') || (custom_3way_button_transfer == 'PARKING_FIELD_security_phrase') ) - {document.vicidial_form.xfernumber.value = document.vicidial_form.security_phrase.value;} - if ( (custom_3way_button_transfer == 'FIELD_vendor_lead_code') || (custom_3way_button_transfer == 'PARKING_FIELD_vendor_lead_code') ) - {document.vicidial_form.xfernumber.value = document.vicidial_form.vendor_lead_code.value;} - if ( (custom_3way_button_transfer == 'FIELD_email') || (custom_3way_button_transfer == 'PARKING_FIELD_email') ) - {document.vicidial_form.xfernumber.value = document.vicidial_form.email.value;} - if ( (custom_3way_button_transfer == 'FIELD_owner') || (custom_3way_button_transfer == 'PARKING_FIELD_owner') ) - {document.vicidial_form.xfernumber.value = document.vicidial_form.owner.value;} - - var temp_xfernumber = document.vicidial_form.xfernumber.value; - if (temp_xfernumber.length < 3) + if (custom_3way_button_transfer_contacts > 0) { - alert_box("Number to Dial invalid: " + temp_xfernumber); - ShoWTransferMain('OFF','YES'); + generate_contacts_search(); } else { - if (custom_3way_button_transfer_park > 0) + if (custom_3way_button_transfer_view > 0) { - xfer_park_dial(); + generate_presets_pulldown(); } else { - SendManualDial('YES'); + if ( (custom_3way_button_transfer == 'PRESET_1') || (custom_3way_button_transfer == 'RETENER_PRESET_1') ) + {document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; document.vicidial_form.xfername.value='D1';} + if ( (custom_3way_button_transfer == 'PRESET_2') || (custom_3way_button_transfer == 'RETENER_PRESET_2') ) + {document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; document.vicidial_form.xfername.value='D2';} + if ( (custom_3way_button_transfer == 'PRESET_3') || (custom_3way_button_transfer == 'RETENER_PRESET_3') ) + {document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber; document.vicidial_form.xfername.value='D3';} + if ( (custom_3way_button_transfer == 'PRESET_4') || (custom_3way_button_transfer == 'RETENER_PRESET_4') ) + {document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber; document.vicidial_form.xfername.value='D4';} + if ( (custom_3way_button_transfer == 'PRESET_5') || (custom_3way_button_transfer == 'RETENER_PRESET_5') ) + {document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber; document.vicidial_form.xfername.value='D5';} + if ( (custom_3way_button_transfer == 'FIELD_address3') || (custom_3way_button_transfer == 'RETENER_FIELD_address3') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.address3.value;} + if ( (custom_3way_button_transfer == 'FIELD_province') || (custom_3way_button_transfer == 'RETENER_FIELD_province') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.province.value;} + if ( (custom_3way_button_transfer == 'FIELD_security_phrase') || (custom_3way_button_transfer == 'RETENER_FIELD_security_phrase') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.security_phrase.value;} + if ( (custom_3way_button_transfer == 'FIELD_vendor_lead_code') || (custom_3way_button_transfer == 'RETENER_FIELD_vendor_lead_code') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.vendor_lead_code.value;} + if ( (custom_3way_button_transfer == 'FIELD_email') || (custom_3way_button_transfer == 'RETENER_FIELD_email') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.email.value;} + if ( (custom_3way_button_transfer == 'FIELD_owner') || (custom_3way_button_transfer == 'RETENER_FIELD_owner') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.owner.value;} + + var temp_xfernumber = document.vicidial_form.xfernumber.value; + if (temp_xfernumber.length < 3) + { + alert_box("Number to Dial invalid: " + temp_xfernumber); + ShoWTransferMain('OFF','YES'); + } + else + { + if (custom_3way_button_transfer_park > 0) + { + xfer_park_dial(); + } + else + { + SendManualDial('YES'); + } + } } } } @@ -3752,16 +3880,16 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { conf_dialed=1; var sending_group_alias = 0; - // Marcar Con El Cliente button + // Marcar con el cliente button if (taskFromConf == 'YES') { xfer_in_call=1; agent_dialed_number='1'; agent_dialed_type='XFER_3WAY'; - document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; + document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; - document.getElementById("ParkCustomerDial").innerHTML ="\"Dial"; + document.getElementById("ParkCustomerDial").innerHTML ="\"Marcar"; var manual_number = document.vicidial_form.xfernumber.value; var manual_number_hidden = document.vicidial_form.xfernumhidden.value; @@ -3817,7 +3945,33 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } var sending_preset_name = document.vicidial_form.xfername.value; if (taskFromConf == 'YES') - {basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid,sending_group_alias,'',sending_preset_name,call_variables);} + { + // give extra time for custom fields to commit before consultative transfers + if ( (document.vicidial_form.consultativexfer.checked==true) && (custom_fields_enabled > 0) && (consult_custom_delay > 0) ) + { + if (consult_custom_wait >= consult_custom_delay) + { + consult_custom_go = 1; + consult_custom_wait = 0; + } + else + { + CustomerData_update(); + consult_custom_wait++; + consult_custom_sent++; + } + } + else + { + consult_custom_go = 1; + consult_custom_wait = 0; + } + + if (consult_custom_go > 0) + { + basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid,sending_group_alias,'',sending_preset_name,call_variables); + } + } else {basic_originate_call(manual_string,'NO','NO','','','',threeway_cid,sending_group_alias,sending_preset_name,call_variables);} @@ -3863,7 +4017,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {var XfeR_GrouP = API_selected_xfergroup;} tasknum = Ctasknum + "*" + XfeR_GrouP + '*CXFER*' + document.vicidial_form.lead_id.value + '**' + dialed_number + '*' + user + '*' + agentdirect + '*' + VD_live_call_secondS + '*'; - CustomerData_update(); + if (consult_custom_sent < 1) + {CustomerData_update();} } var regAXFvars = new RegExp("AXFER","g"); if (tasknum_string.match(regAXFvars)) @@ -3876,8 +4031,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {closerxfercamptail = 'IVR';} tasknum = Ctasknum + '*' + document.vicidial_form.phone_number.value + '*' + document.vicidial_form.lead_id.value + '*' + campaign + '*' + closerxfercamptail + '*' + user + '**' + VD_live_call_secondS + '*'; - CustomerData_update(); - + if (consult_custom_sent < 1) + {CustomerData_update();} } @@ -3992,7 +4147,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} MD_channel_look=1; XDcheck = 'YES'; - // document.getElementById("HangupXferLine").innerHTML ="\"Colgar"; + // document.getElementById("HangupXferLine").innerHTML ="\"Colgar"; } } } @@ -4187,6 +4342,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { shift_logout_flag=1; } + if (AGLogiN == 'API_LOGOUT') + { + api_logout_flag=1; + if ( (MD_channel_look < 1) && (VD_live_customer_call < 1) && (alt_dial_status_display < 1) ) + {LogouT('API');} + } } var VLAStatuS_array = check_time_array[4].split("Estado: "); var VLAStatuS = VLAStatuS_array[1]; @@ -4258,43 +4419,47 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.xfernumber.value = api_transferconf_number; mainxfer_send_redirect('XfeRBLIND',lastcustchannel,lastcustserverip); } - if (api_transferconf_function == 'LOCAL_CLOSER') + if (external_transferconf_count < 1) { - API_selected_xfergroup = api_transferconf_group; - document.vicidial_form.xfernumber.value = api_transferconf_number; - mainxfer_send_redirect('XfeRLOCAL',lastcustchannel,lastcustserverip); - } - if (api_transferconf_function == 'DIAL_WITH_CUSTOMER') - { - if (api_transferconf_consultative=='YES') - {document.vicidial_form.consultativexfer.checked=true;} - if (api_transferconf_consultative=='NO') - {document.vicidial_form.consultativexfer.checked=false;} - if (api_transferconf_override=='YES') - {document.vicidial_form.xferoverride.checked=true;} - API_selected_xfergroup = api_transferconf_group; - document.vicidial_form.xfernumber.value = api_transferconf_number; - SendManualDial('YES'); - } - if (api_transferconf_function == 'PARKING_CUSTOMER_DIAL') - { - if (api_transferconf_consultative=='YES') - {document.vicidial_form.consultativexfer.checked=true;} - if (api_transferconf_consultative=='NO') - {document.vicidial_form.consultativexfer.checked=false;} - if (api_transferconf_override=='YES') - {document.vicidial_form.xferoverride.checked=true;} - API_selected_xfergroup = api_transferconf_group; - document.vicidial_form.xfernumber.value = api_transferconf_number; - xfer_park_dial(); + if (api_transferconf_function == 'LOCAL_CLOSER') + { + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + mainxfer_send_redirect('XfeRLOCAL',lastcustchannel,lastcustserverip); + } + if (api_transferconf_function == 'DIAL_WITH_CUSTOMER') + { + if (api_transferconf_consultative=='YES') + {document.vicidial_form.consultativexfer.checked=true;} + if (api_transferconf_consultative=='NO') + {document.vicidial_form.consultativexfer.checked=false;} + if (api_transferconf_override=='YES') + {document.vicidial_form.xferoverride.checked=true;} + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + SendManualDial('YES'); + } + if (api_transferconf_function == 'RETENER_CUSTOMER_DIAL') + { + if (api_transferconf_consultative=='YES') + {document.vicidial_form.consultativexfer.checked=true;} + if (api_transferconf_consultative=='NO') + {document.vicidial_form.consultativexfer.checked=false;} + if (api_transferconf_override=='YES') + {document.vicidial_form.xferoverride.checked=true;} + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + xfer_park_dial(); + } + external_transferconf_count=3; } Clear_API_Field('external_transferconf'); } - if (api_parkcustomer == 'PARKING_CUSTOMER') + if (api_parkcustomer == 'RETENER_CUSTOMER') {mainxfer_send_redirect('ParK',lastcustchannel,lastcustserverip);} if (api_parkcustomer == 'GRAB_CUSTOMER') {mainxfer_send_redirect('FROMParK',lastcustchannel,lastcustserverip);} - if (api_parkcustomer == 'PARKING_IVR_CUSTOMER') + if (api_parkcustomer == 'RETENER_IVR_CUSTOMER') {mainxfer_send_redirect('ParKivr',lastcustchannel,lastcustserverip);} if (api_parkcustomer == 'GRAB_IVR_CUSTOMER') {mainxfer_send_redirect('FROMParKivr',lastcustchannel,lastcustserverip);} @@ -4326,10 +4491,42 @@ function set_length(SLnumber,SLlength_goal,SLdirection) dialedcall_send_hangup(); } - if ( (APIStatuS.length < 10) && (APIStatuS.length > 0) && (AgentDispoing > 1) ) + if ( (APIStatuS.length < 1000) && (APIStatuS.length > 0) && (AgentDispoing > 1) && (APIStatuS != '::::::::::') ) { - document.vicidial_form.DispoSelection.value = APIStatuS; - DispoSelect_submit(); + var regCBmatch = new RegExp('!',"g"); + if (APIStatuS.match(regCBmatch)) + { + var APIcbSTATUS_array = APIStatuS.split("!"); + var APIcbSTATUS = APIcbSTATUS_array[0]; + var APIcbDATETIME = APIcbSTATUS_array[1]; + var APIcbTYPE = APIcbSTATUS_array[2]; + var APIcbCOMMENTS = APIcbSTATUS_array[3]; + var APIqmCScode = APIcbSTATUS_array[4]; + + if ( (APIcbDATETIME.length > 10) && (APIcbTYPE.length > 5) ) + { + CallBackDatETimE = APIcbDATETIME; + CallBackrecipient = APIcbTYPE; + CallBackLeadEstado = APIcbSTATUS; + CallBackCommenTs = APIcbCOMMENTS; + hideDiv('CallBackSelectBox'); + document.vicidial_form.DispoSelection.value = 'CBHOLD'; + } + else + {document.vicidial_form.DispoSelection.value = APIcbSTATUS;} + if (APIqmCScode.length > 0) + { + DispoQMcsCODE = APIqmCScode; + } + // ZZZZZZZZZZZZZZZZZZZZZZZ API callback + // alert("CBdata: " + CallBackDatETimE + "|" + CallBackrecipient + "|" + CallBackLeadEstado + "|" + CallBackCommenTs + "|" + DispoQMcsCODE + "|"); + DispoSelect_submit(); + } + else + { + document.vicidial_form.DispoSelection.value = APIStatuS; + DispoSelect_submit(); + } } if (APIPausE.length > 4) { @@ -4376,7 +4573,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (APIManualDialQueue != APIManualDialQueue_last) { APIManualDialQueue_last = APIManualDialQueue; - document.getElementById("ManualQueueNotice").innerHTML = "Manual Queue: " + APIManualDialQueue + "
"; + document.getElementById("ManualQueueNotice").innerHTML = "Manual de la cola: " + APIManualDialQueue + "
"; } if ( (APIDiaL.length > 9) && (WaitingForNextStep == '0') && (AllowManualQueueCalls == '1') && (check_n > 2) ) { @@ -4712,11 +4909,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // filename = filedate + "_" + user_abb; var query_recording_exten = recording_exten; var channelrec = "Local/" + conf_silent_prefix + '' + taskconfrec + "@" + ext_context; - var conf_rec_start_html = "\"Parar"; + var conf_rec_start_html = "\"Detener"; if (LIVE_campaign_recording == 'ALLFORCE') { - document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; + document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; } else { @@ -4728,10 +4925,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) filename = taskconffile; var query_recording_exten = session_id; var channelrec = "Local/" + conf_silent_prefix + '' + taskconfrec + "@" + ext_context; - var conf_rec_start_html = "\"Comenzar"; + var conf_rec_start_html = "\"Comenzar"; if (LIVE_campaign_recording == 'ALLFORCE') { - document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; + document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; } else { @@ -4783,13 +4980,15 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // ################################################################################ // Send Redirect command for live call to Directorsends phone name where call is going to -// Covers the following types: XFER, VMAIL, ENTRY, CONF, PARKING, FROMPARKING, XfeRLOCAL, XfeRINTERNAL, XfeRBLIND, VfeRVMAIL +// Covers the following types: XFER, VMAIL, ENTRY, CONF, RETENER, FROMRETENER, XfeRLOCAL, XfeRINTERNAL, XfeRBLIND, VfeRVMAIL function mainxfer_send_redirect(taskvar,taskxferconf,taskserverip,taskdebugnote,taskdispowindow,tasklockedquick) { blind_transfer=1; var consultativexfer_checked = 0; if (document.vicidial_form.consultativexfer.checked==true) {consultativexfer_checked = 1;} + if (taskvar == 'XfeRLOCAL') + {consultativexfer_checked = 0;} // conf_dialed=1; if (auto_dial_level == 0) {RedirecTxFEr = 1;} @@ -4890,7 +5089,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (taskvar == 'XfeRLOCAL') { - CustomerData_update(); + if (consult_custom_sent < 1) + {CustomerData_update();} document.vicidial_form.xfername.value=''; var XfeRSelecT = document.getElementById("XfeRGrouP"); @@ -4967,8 +5167,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var parkedby = protocol + "/" + extension; xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=RedirectToPark&format=text&channel=" + redirectdestination + "&call_server_ip=" + redirectdestserverip + "&queryCID=" + queryCID + "&exten=" + park_on_extension + "&ext_context=" + ext_context + "&ext_priority=1&extenName=park&parkedby=" + parkedby + "&session_id=" + session_id + "&CalLCID=" + CalLCID + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign; - document.getElementById("ParkControl").innerHTML ="\"Capturar"; - if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARKING_ONLY') ) + document.getElementById("ParkControl").innerHTML ="\"Capturar"; + if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_RETENER_ONLY') ) { document.getElementById("ivrParkControl").innerHTML ="\"Grab"; } @@ -4994,10 +5194,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=RedirectFromPark&format=text&channel=" + redirectdestination + "&call_server_ip=" + redirectdestserverip + "&queryCID=" + queryCID + "&exten=" + dest_dialstring + "&ext_context=" + ext_context + "&ext_priority=1" + "&session_id=" + session_id + "&CalLCID=" + CalLCID + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign; - document.getElementById("ParkControl").innerHTML ="\"Aparcar"; - if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARKING_ONLY') ) + document.getElementById("ParkControl").innerHTML ="\"Retener"; + if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_RETENER_ONLY') ) { - document.getElementById("ivrParkControl").innerHTML ="\"IVR"; + document.getElementById("ivrParkControl").innerHTML ="\"IVR"; } customerparked=0; customerparkedcounter=0; @@ -5015,8 +5215,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var parkedby = protocol + "/" + extension; xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=RedirectToParkIVR&format=text&channel=" + redirectdestination + "&call_server_ip=" + redirectdestserverip + "&queryCID=" + queryCID + "&exten=" + park_on_extension + "&ext_context=" + ext_context + "&ext_priority=1&extenName=park&parkedby=" + parkedby + "&session_id=" + session_id + "&CalLCID=" + CalLCID + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign; - document.getElementById("ParkControl").innerHTML ="\"Capturar"; - if (ivr_park_call=='ENABLED_PARKING_ONLY') + document.getElementById("ParkControl").innerHTML ="\"Capturar"; + if (ivr_park_call=='ENABLED_RETENER_ONLY') { document.getElementById("ivrParkControl").innerHTML ="\"Grab"; } @@ -5046,10 +5246,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=RedirectFromParkIVR&format=text&channel=" + redirectdestination + "&call_server_ip=" + redirectdestserverip + "&queryCID=" + queryCID + "&exten=" + dest_dialstring + "&ext_context=" + ext_context + "&ext_priority=1" + "&session_id=" + session_id + "&CalLCID=" + CalLCID + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign; - document.getElementById("ParkControl").innerHTML ="\"Aparcar"; - if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARKING_ONLY') ) + document.getElementById("ParkControl").innerHTML ="\"Retener"; + if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_RETENER_ONLY') ) { - document.getElementById("ivrParkControl").innerHTML ="\"IVR"; + document.getElementById("ivrParkControl").innerHTML ="\"IVR"; } customerparked=0; customerparkedcounter=0; @@ -5150,7 +5350,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) alt_dial_active = 0; alt_dial_status_display = 0; open_dispo_screen=1; - document.getElementById("MainStatuSSpan").innerHTML = "Marcar el Siguiente Número"; + document.getElementById("MainStatuSSpan").innerHTML = "Marcar al siguiente número"; } // ################################################################################ // Insert or update the vicidial_log entry for a customer call @@ -5181,7 +5381,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) reselect_alt_dial = 1; alt_dial_active = 1; alt_dial_status_display = 1; - var man_status = "Marcar Número de teléfono Alt: TELÉFONO PRINCIPAL or TELÉFONO ALT or DIRECCIÓN3 or ACABAR LEAD" + status_display_content; + var man_status = "Marcar al número telefónico alternativo: TELÉFONO PRINCIPAL or TELÉFONO ALTERNATIVO or DIRECCIÓN3 or TERMINAR EL CONTACTO" + status_display_content; document.getElementById("MainStatuSSpan").innerHTML = man_status; } } @@ -5227,7 +5427,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) MDlogResponse = xmlhttp.responseText; var MDlogResponse_array=MDlogResponse.split("\n"); MDlogLINE = MDlogResponse_array[0]; - if ( (MDlogLINE == "REGISTRO NO ENTRADO") && (VDstop_rec_after_each_call != 1) ) + if ( (MDlogLINE == "NO SE INGRESÓ EL REGISTRO") && (VDstop_rec_after_each_call != 1) ) { // alert("error: log not entered\n"); } @@ -5237,10 +5437,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // alert("VICIDIAL Call log entered:\n" + document.vicidial_form.uniqueid.value); if ( (taskMDstage != "start") && (VDstop_rec_after_each_call == 1) ) { - var conf_rec_start_html = "\"Comenzar"; + var conf_rec_start_html = "\"Comenzar"; if ( (LIVE_campaign_recording == 'NEVER') || (LIVE_campaign_recording == 'ALLFORCE') ) { - document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; + document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; } else {document.getElementById("RecorDControl").innerHTML = conf_rec_start_html;} @@ -5307,7 +5507,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { // alert(xmlhttp.responseText); var DLcounT = xmlhttp.responseText; - document.getElementById("dialableleadsspan").innerHTML ="Dialable Leads:
" + DLcounT; + document.getElementById("dialableleadsspan").innerHTML ="Pueda Marcar Perspectiva:
" + DLcounT; } } @@ -5393,7 +5593,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } } } - CBlinkCONTENT ="" + CBpre + '' + CBprint + '' + " SERVICIOS REPETIDOS ACTIVOS" + CBpost + ""; + CBlinkCONTENT ="" + CBpre + '' + CBprint + '' + " SERVICIOS DE DEVOLVER LLAMADAS ACTIVOS" + CBpost + ""; document.getElementById("CBstatusSpan").innerHTML = CBlinkCONTENT; } } @@ -5416,7 +5616,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else { move_on=0; - alert_box("USTED DEBE SER DETENIDO BREVEMENTE PARA COMPROBAR SERVICIOS REPETIDOS EN MODO DE AUTO-DIAL"); + alert_box("USTED DEBE PAUSAR EL SISTEMA PARA REVISAR LA DEVOLUCIÓN DE LLAMADAS EN EL MODO DE MARCACIÓN AUTOMÁTICA"); } } if (move_on == 1) @@ -5461,7 +5661,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var CB_calls = all_CBs_array[0]; var loop_ct=0; var conv_start=0; - var CB_HTML = "px\">\">" + var CB_HTML = "
# LLAMADABACK DATE/TIMENÚMEROINFONAME ESTADOCAMPAIGNLAST FECHA/HORA DE LA LLAMADA DIAL ALT
px\">\">" while (loop_ct < CB_calls) { loop_ct++; @@ -5481,13 +5681,21 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var CB_lastcall_time = call_array[7]; var CB_callback_time = call_array[8]; var CB_comments = call_array[9]; + var CB_dialable = call_array[10]; var CB_comments_ten = CB_comments; if (CB_comments_ten.length > 10) { CB_comments_ten = CB_comments_ten.substr(0,10); CB_comments_ten = CB_comments_ten + '...'; } - CB_HTML = CB_HTML + ""; + if (CB_dialable > 0) + { + CB_HTML = CB_HTML + ""; + } + else + { + CB_HTML = CB_HTML + ""; + } } CB_HTML = CB_HTML + "
# LLAMADABACK DATE/TIMENÚMEROINFONAME ESTADOCAMPAIGNLAST FECHA/HORA DE LA LLAMADA MARCAR ALT
" + loop_ct + "" + CB_callback_time + "" + CB_phone + "" + CB_comments_ten + " - INFO" + CB_name + "" + CB_status + "" + CB_campaign + "" + CB_lastcall_time + " DIAL ALT 
" + loop_ct + "" + CB_callback_time + "" + CB_phone + "" + CB_comments_ten + " - INFO" + CB_name + "" + CB_status + "" + CB_campaign + "" + CB_lastcall_time + " DIAL ALT 
" + loop_ct + "" + CB_callback_time + "" + CB_phone + "" + CB_comments_ten + " - INFO" + CB_name + "" + CB_status + "" + CB_campaign + "" + CB_lastcall_time + " NON-DIALABLE 
"; document.getElementById("CallBacKsLisT").innerHTML = CB_HTML; @@ -5544,17 +5752,27 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { AutoDial_ReSume_PauSe("VDADready"); } + ShoWGenDerPulldown(); hideDiv('SearcHForMDisplaYBox'); } +// ################################################################################ +// closes contacts search screen + function ContactSearcHVieWClose() + { + ShoWGenDerPulldown(); + hideDiv('SearcHContactsDisplaYBox'); + } + + // ################################################################################ // Open up a callback customer record as manual dial preview mode function new_callback_call(taskCBid,taskLEADid,taskCBalt) { if (waiting_on_dispo > 0) { - alert_box("System Delay, Por favor, inténtelo de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); + alert_box("Retraso en el sistema, por favor intente de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); } else { @@ -5601,7 +5819,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else { move_on=0; - alert_box("USTED DEBE SER DETENIDO BREVEMENTE Al DIAL MANUAL Un NUEVO PLOMO EN MODO De AUTO-DIAL"); + alert_box("USTED DEBE PAUSAR EL SISTEMA PARA MARCAR DE FORMA MANUAL UN NUEVO CONTACTO EN EL MODO DE MARCACIÓN AUTOMÁTICA"); } } if (move_on == 1) @@ -5620,8 +5838,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) hideDiv('LeaDInfOBox'); document.vicidial_form.MDDiaLCodE.value = TVphone_code; document.vicidial_form.MDPhonENumbeR.value = TVphone_number; + document.vicidial_form.MDPhonENumbeRHiddeN.value = TVphone_number; document.vicidial_form.MDLeadID.value = TVlead_id; document.vicidial_form.MDType.value = TVtype; + if (disable_alter_custphone == 'HIDE') + {document.vicidial_form.MDPhonENumbeR.value = 'XXXXXXXXXX';} } if (TVfast=='LEADSEARCH') { @@ -5635,8 +5856,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (agent_allow_group_alias == 'Y') { - document.getElementById("ManuaLDiaLGrouPSelecteD").innerHTML = "Grupo de Alias: " + active_group_alias + ""; - document.getElementById("ManuaLDiaLGrouP").innerHTML = "Haga clic aquí para escoger un grupo de alias"; + document.getElementById("ManuaLDiaLGrouPSelecteD").innerHTML = "Alias de grupo: " + active_group_alias + ""; + document.getElementById("ManuaLDiaLGrouP").innerHTML = "Haga click aquí para escoger un alias de grupo"; } showDiv('NeWManuaLDiaLBox'); @@ -5659,12 +5880,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (waiting_on_dispo > 0) { - alert_box("System Delay, Por favor, inténtelo de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); + alert_box("Retraso en el sistema, por favor intente de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); } else { hideDiv('NeWManuaLDiaLBox'); - document.getElementById("debugbottomspan").innerHTML = "DEBUG OUTPUT" + document.vicidial_form.MDPhonENumbeR.value + "|" + active_group_alias; + // document.getElementById("debugbottomspan").innerHTML = "DEBUG OUTPUT" + document.vicidial_form.MDPhonENumbeR.value + "|" + active_group_alias; var sending_group_alias = 0; var MDDiaLCodEform = document.vicidial_form.MDDiaLCodE.value; @@ -5677,6 +5898,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (document.vicidial_form.LeadLookuP.checked==true) {MDLookuPLeaD = 'lookup';} + if (MDPhonENumbeRform == 'XXXXXXXXXX') + {MDPhonENumbeRform = document.vicidial_form.MDPhonENumbeRHiddeN.value;} + if (MDDiaLCodEform.length < 1) {MDDiaLCodEform = document.vicidial_form.phone_code.value;} @@ -5719,6 +5943,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.MDDiaLOverridE.value = ''; document.vicidial_form.MDLeadID.value = ''; document.vicidial_form.MDType.value = ''; + document.vicidial_form.MDPhonENumbeRHiddeN.value = ''; } } @@ -5732,13 +5957,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if ( (MDDiaLCodEform.length < 1) || (MDPhonENumbeRform.length < 5) ) { - alert_box("USTED DEBE INTRODUCIR Un NÚMERO De TELÉFONO Y Un CÓDIGO Del DIALPARA UTILIZAR El DIAL RÁPIDO"); + alert_box("USTED DEBE INGRESAR UN NÚMERO TELEFÓNICO Y UN CÓDIGO DE MARCACIÓN PARA UTILIZAR LA MARCACIÓN RÁPIDA"); } else { if (waiting_on_dispo > 0) { - alert_box("System Delay, Por favor, inténtelo de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); + alert_box("Retraso en el sistema, por favor intente de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); } else { @@ -5824,7 +6049,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} // alert(document.getElementById("MainStatuSSpan").innerHTML); - document.getElementById("MainStatuSSpan").innerHTML = " Llamando: " + status_display_number + " " + status_display_content + "   Espeerar al Ring... " + MD_ring_secondS + " segundos"; + document.getElementById("MainStatuSSpan").innerHTML = " Llamando: " + status_display_number + " " + status_display_content + "   Esperando el timbrado... " + MD_ring_secondS + " segundos"; // alert("channel not found yet:\n" + campaign); } } @@ -5866,17 +6091,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} - document.getElementById("MainStatuSSpan").innerHTML = " Terceros llamados: " + called3rdparty + " " + status_display_content; + document.getElementById("MainStatuSSpan").innerHTML = " Terceros que recibieron la llamada: " + called3rdparty + " " + status_display_content; - document.getElementById("Leave3WayCall").innerHTML ="\"ABANDONAR"; + document.getElementById("Leave3WayCall").innerHTML ="\"ABANDONAR"; - document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; + document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; - document.getElementById("ParkCustomerDial").innerHTML ="\"Dial"; + document.getElementById("ParkCustomerDial").innerHTML ="\"Marcar"; - document.getElementById("HangupXferLine").innerHTML ="\"Colgar"; + document.getElementById("HangupXferLine").innerHTML ="\"Colgar"; - document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; + document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; xferchannellive=1; XDcheck = ''; @@ -5923,19 +6148,19 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("MainStatuSSpan").innerHTML = " Llamado: " + status_display_number + " " + status_display_content + "  "; - document.getElementById("ParkControl").innerHTML ="\"Aparcar"; - if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARKING_ONLY') ) + document.getElementById("ParkControl").innerHTML ="\"Retener"; + if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_RETENER_ONLY') ) { - document.getElementById("ivrParkControl").innerHTML ="\"IVR"; + document.getElementById("ivrParkControl").innerHTML ="\"IVR"; } - document.getElementById("HangupControl").innerHTML = "\"Colgar"; + document.getElementById("HangupControl").innerHTML = "\"Colgar"; - document.getElementById("XferControl").innerHTML = "\"Transferencia"; + document.getElementById("XferControl").innerHTML = "\"Transferir"; - document.getElementById("LocalCloser").innerHTML = "\"CLOSER"; + document.getElementById("LocalCloser").innerHTML = "\"VERIFICADOR"; - document.getElementById("DialBlindTransfer").innerHTML = "\"Marcar"; + document.getElementById("DialBlindTransfer").innerHTML = "\"Enviar"; document.getElementById("DialBlindVMail").innerHTML = "\"Blind"; @@ -5984,7 +6209,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (custom_3way_button_transfer_enabled > 0) { - document.getElementById("CustomXfer").innerHTML = "\"Custom"; + document.getElementById("CustomXfer").innerHTML = "\"Custom"; } if (call_requeue_button > 0) @@ -6027,11 +6252,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) delete xmlhttp; } - if (MD_ring_secondS > 49) + if ( (MD_ring_secondS > 49) && (MD_ring_secondS > dial_timeout) ) { MD_channel_look=0; MD_ring_secondS=0; - alert_box("Tiempo de espera superado, pongase en contacto con su administrador de sistema\n"); + alert_box("Tiempo de espera superado, contacte al administrador del sistema\n"); } } @@ -6230,12 +6455,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // ################################################################################ -// Send the Manual Marcar el Siguiente Número request +// Send the Manual Marcar al siguiente número request function ManualDialNext(mdnCBid,mdnBDleadid,mdnDiaLCodE,mdnPhonENumbeR,mdnStagE,mdVendorid,mdgroupalias,mdtype) { if (waiting_on_dispo > 0) { - alert_box("System Delay, Por favor, inténtelo de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); + alert_box("Retraso en el sistema, por favor intente de nuevo
code:" + agent_log_id + " - " + waiting_on_dispo + ""); } else { @@ -6255,11 +6480,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else {auto_dial_level=starting_dial_level;} - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { - document.getElementById("DiaLControl").innerHTML = "\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"Marcar"; } var manual_dial_only_type_flag = ''; if ( (mdtype == 'ALT') || (mdtype == 'ADDR3') ) @@ -6276,17 +6501,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) reselect_preview_dial = 1; in_lead_preview_state = 1; var man_preview = 'YES'; - var man_status = "Mostrar el Lead entonces MARCAR LEAD or SALTAR LEAD"; + var man_status = "Visualizar el contacto, después MARCAR AL CONTACTO or SALTARSE EL CONTACTO"; if (manual_preview_dial=='PREVIEW_ONLY') { - var man_status = "Mostrar el Lead entonces MARCAR LEAD"; + var man_status = "Visualizar el contacto, después MARCAR AL CONTACTO"; } } else { reselect_preview_dial = 0; var man_preview = 'NO'; - var man_status = "Espeerar al Ring..."; + var man_status = "Esperando el timbrado..."; } var xmlhttp=false; @@ -6341,7 +6566,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) MDnextCID = MDnextResponse_array[0]; ÚltimoCallCID = MDnextResponse_array[0]; - var regMNCvar = new RegExp("TOLVA VACÍA","ig"); + var regMNCvar = new RegExp("FILA DE MARCACIÓN VACÍO","ig"); var regMDFvarDNC = new RegExp("DNC","ig"); var regMDFvarCAMP = new RegExp("CAMPLISTS","ig"); var regMDFvarTIME = new RegExp("OUTSIDE","ig"); @@ -6355,19 +6580,19 @@ function set_length(SLnumber,SLlength_goal,SLdirection) CalLBacKsCounTCheck(); if (MDnextCID.match(regMNCvar)) - {alert_box("No más Leads en el hopper de la campaña:\n" + campaign); alert_displayed=1;} + {alert_box("No hay más contactos en la fila de marcación de la campaña:\n" + campaign); alert_displayed=1;} if (MDnextCID.match(regMDFvarDNC)) {alert_box("This phone number is in the DNC list:\n" + mdnPhonENumbeR); alert_displayed=1;} if (MDnextCID.match(regMDFvarCAMP)) - {alert_box("Este número de teléfono no está en la campaña de las listas:\n" + mdnPhonENumbeR); alert_displayed=1;} + {alert_box("Este número telefónico no está en las listas de la campaña:\n" + mdnPhonENumbeR); alert_displayed=1;} if (MDnextCID.match(regMDFvarTIME)) - {alert_box("This phone number is outside of the local call time:\n" + mdnPhonENumbeR); alert_displayed=1;} + {alert_box("Este número de teléfono se encuentra fuera del tiempo de las llamadas locales:\n" + mdnPhonENumbeR); alert_displayed=1;} if (alert_displayed==0) {alert_box("Error no especificado:\n" + mdnPhonENumbeR + "|" + MDnextCID); alert_displayed=1;} if (starting_dial_level == 0) { - document.getElementById("DiaLControl").innerHTML = "\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"Marcar"; } else { @@ -6375,7 +6600,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { @@ -6520,8 +6745,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { document.getElementById("CusTInfOSpaN").innerHTML = " PREVIOUS LLAMADABACK "; document.getElementById("CusTInfOSpaN").style.background = CusTCB_bgcolor; - document.getElementById("CBcommentsBoxA").innerHTML = "Llamada Pasada:" + CBentry_time; - document.getElementById("CBcommentsBoxB").innerHTML = "Servicio repetido:" + CBcallback_time; + document.getElementById("CBcommentsBoxA").innerHTML = "Última llamada:" + CBentry_time; + document.getElementById("CBcommentsBoxB").innerHTML = "Servicio de devolución de llamada:" + CBcallback_time; document.getElementById("CBcommentsBoxC").innerHTML = "Agente:" + CBuser; document.getElementById("CBcommentsBoxD").innerHTML = "Comentarios:
" + CBcomments; showDiv('CBcommentsBox'); @@ -6539,7 +6764,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) MD_channel_look=1; custchannellive=1; - document.getElementById("HangupControl").innerHTML = "\"Colgar"; + document.getElementById("HangupControl").innerHTML = "\"Colgar"; if ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) {all_record = 'YES';} @@ -6618,7 +6843,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (manual_dial_in_progress==1) { - alert_box('USTED NO PUEDE SALTAR Un SERVICIO REPETIDO O DIAL MANUAL, USTED DEBE MARCAR EL PLOMO'); + alert_box('USTED NO PUEDE SALTARSE EL DEVOLVER UNA LLAMADA O UNA MARCACIÓN MANUAL, DEBE MARCAR AL CONTACTO'); } else { @@ -6627,11 +6852,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { - document.getElementById("DiaLControl").innerHTML = "\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"Marcar"; } var xmlhttp=false; @@ -6672,7 +6897,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) MDSnextCID = MDSnextResponse_array[0]; if (MDSnextCID == "LEAD NOT REVERTED") { - alert_box("El Lead no fue invertido, hubo un error:\n" + MDSnextResponse); + alert_box("El contacto no se invirtió, hubo un error:\n" + MDSnextResponse); } else { @@ -6725,11 +6950,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { - document.getElementById("DiaLControl").innerHTML = "\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"Marcar"; } } } @@ -6784,23 +7009,23 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } } if (dialed_label == 'ALT') - {document.getElementById("CusTInfOSpaN").innerHTML = " ALT DIAL NÚMERO: ALT ";} + {document.getElementById("CusTInfOSpaN").innerHTML = " NÚMERO DE MARCACIÓN ALTERNATIVA: ALT ";} if (dialed_label == 'ADDR3') - {document.getElementById("CusTInfOSpaN").innerHTML = " ALT DIAL NÚMERO: DIRECCIÓN3 ";} + {document.getElementById("CusTInfOSpaN").innerHTML = " NÚMERO DE MARCACIÓN ALTERNATIVA: DIRECCIÓN3 ";} var REGalt_dial = new RegExp("X","g"); if (dialed_label.match(REGalt_dial)) { - document.getElementById("CusTInfOSpaN").innerHTML = " ALT DIAL NÚMERO: " + dialed_label + ""; - document.getElementById("EAcommentsBoxA").innerHTML = "Código y número de teléfono: " + EAphone_code + " " + EAphone_number; + document.getElementById("CusTInfOSpaN").innerHTML = " NÚMERO DE MARCACIÓN ALTERNATIVA: " + dialed_label + ""; + document.getElementById("EAcommentsBoxA").innerHTML = "Código y número telefónicos: " + EAphone_code + " " + EAphone_number; var EAactive_link = ''; if (EAalt_phone_active == 'Y') - {EAactive_link = "Cambiar este número de teléfono a INACTIVAS";} + {EAactive_link = "Cambiar este número telefónico a INACTIVOS";} else - {EAactive_link = "Cambiar este número de teléfono a ACTIVO";} + {EAactive_link = "Cambiar este número telefónico a ACTIVOS";} document.getElementById("EAcommentsBoxB").innerHTML = "Activo:" + EAalt_phone_active + "
" + EAactive_link; - document.getElementById("EAcommentsBoxC").innerHTML = "Alt Cuenta:" + EAalt_phone_count; + document.getElementById("EAcommentsBoxC").innerHTML = "Cuenta alternativa: " + EAalt_phone_count; document.getElementById("EAcommentsBoxD").innerHTML = "Notas:
" + EAalt_phone_notes; showDiv('EAcommentsBox'); } @@ -6842,7 +7067,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else {var call_prefix = manual_dial_prefix;} - manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id + "&security=" + document.vicidial_form.security_phrase.value + "&qm_extension=" + qm_extension; + manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id + "&security=" + document.vicidial_form.security_phrase.value + "&qm_extension=" + qm_extension + "&old_CID=" + ÚltimoCallCID; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(manDiaLonly_query); @@ -6879,9 +7104,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} - document.getElementById("MainStatuSSpan").innerHTML = " Llamando: " + status_display_number + " " + status_display_content + "   Espeerar al Ring..."; + document.getElementById("MainStatuSSpan").innerHTML = " Llamando: " + status_display_number + " " + status_display_content + "   Esperando el timbrado..."; - document.getElementById("HangupControl").innerHTML = "\"Colgar"; + document.getElementById("HangupControl").innerHTML = "\"Colgar"; } if ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) {all_record = 'YES';} @@ -6961,7 +7186,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { @@ -6978,7 +7203,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { auto_dial_level=starting_dial_level; - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { @@ -7151,9 +7376,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var EAactive_link = ''; if (APCactive == 'Y') - {EAactive_link = "Cambiar este número de teléfono a INACTIVAS";} + {EAactive_link = "Cambiar este número telefónico a INACTIVOS";} else - {EAactive_link = "Cambiar este número de teléfono a ACTIVO";} + {EAactive_link = "Cambiar este número telefónico a ACTIVOS";} document.getElementById("EAcommentsBoxB").innerHTML = "Activo:" + EAalt_phone_active + "
" + EAactive_link; @@ -7445,30 +7670,30 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { document.getElementById("CusTInfOSpaN").innerHTML = " PREVIOUS LLAMADABACK "; document.getElementById("CusTInfOSpaN").style.background = CusTCB_bgcolor; - document.getElementById("CBcommentsBoxA").innerHTML = "Llamada Pasada:" + CBentry_time; - document.getElementById("CBcommentsBoxB").innerHTML = "Servicio repetido:" + CBcallback_time; + document.getElementById("CBcommentsBoxA").innerHTML = "Última llamada:" + CBentry_time; + document.getElementById("CBcommentsBoxB").innerHTML = "Servicio de devolución de llamada:" + CBcallback_time; document.getElementById("CBcommentsBoxC").innerHTML = "Agente:" + CBuser; document.getElementById("CBcommentsBoxD").innerHTML = "Comentarios:
" + CBcomments; showDiv('CBcommentsBox'); } if (dialed_label == 'ALT') - {document.getElementById("CusTInfOSpaN").innerHTML = " ALT DIAL NÚMERO: ALT ";} + {document.getElementById("CusTInfOSpaN").innerHTML = " NÚMERO DE MARCACIÓN ALTERNATIVA: ALT ";} if (dialed_label == 'ADDR3') - {document.getElementById("CusTInfOSpaN").innerHTML = " ALT DIAL NÚMERO: DIRECCIÓN3 ";} + {document.getElementById("CusTInfOSpaN").innerHTML = " NÚMERO DE MARCACIÓN ALTERNATIVA: DIRECCIÓN3 ";} var REGalt_dial = new RegExp("X","g"); if (dialed_label.match(REGalt_dial)) { - document.getElementById("CusTInfOSpaN").innerHTML = " ALT DIAL NÚMERO: " + dialed_label + ""; - document.getElementById("EAcommentsBoxA").innerHTML = "Código y número de teléfono: " + EAphone_code + " " + EAphone_number; + document.getElementById("CusTInfOSpaN").innerHTML = " NÚMERO DE MARCACIÓN ALTERNATIVA: " + dialed_label + ""; + document.getElementById("EAcommentsBoxA").innerHTML = "Código y número telefónicos: " + EAphone_code + " " + EAphone_number; var EAactive_link = ''; if (EAalt_phone_active == 'Y') - {EAactive_link = "Cambiar este número de teléfono a INACTIVAS";} + {EAactive_link = "Cambiar este número telefónico a INACTIVOS";} else - {EAactive_link = "Cambiar este número de teléfono a ACTIVO";} + {EAactive_link = "Cambiar este número telefónico a ACTIVOS";} document.getElementById("EAcommentsBoxB").innerHTML = "Activo:" + EAalt_phone_active + "
" + EAactive_link; - document.getElementById("EAcommentsBoxC").innerHTML = "Alt Cuenta:" + EAalt_phone_count; + document.getElementById("EAcommentsBoxC").innerHTML = "Cuenta alternativa: " + EAalt_phone_count; document.getElementById("EAcommentsBoxD").innerHTML = "Notas:" + EAalt_phone_notes; showDiv('EAcommentsBox'); } @@ -7493,19 +7718,19 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("MainStatuSSpan").innerHTML = " Entrante: " + dial_display_number + " " + custom_call_id + " Group- " + VDIC_data_VDIG[1] + "   " + VDIC_fronter + " " + status_display_content; } - document.getElementById("ParkControl").innerHTML ="\"Aparcar"; - if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARKING_ONLY') ) + document.getElementById("ParkControl").innerHTML ="\"Retener"; + if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_RETENER_ONLY') ) { - document.getElementById("ivrParkControl").innerHTML ="\"IVR"; + document.getElementById("ivrParkControl").innerHTML ="\"IVR"; } - document.getElementById("HangupControl").innerHTML = "\"Colgar"; + document.getElementById("HangupControl").innerHTML = "\"Colgar"; - document.getElementById("XferControl").innerHTML = "\"Transferencia"; + document.getElementById("XferControl").innerHTML = "\"Transferir"; - document.getElementById("LocalCloser").innerHTML = "\"CLOSER"; + document.getElementById("LocalCloser").innerHTML = "\"VERIFICADOR"; - document.getElementById("DialBlindTransfer").innerHTML = "\"Marcar"; + document.getElementById("DialBlindTransfer").innerHTML = "\"Enviar"; document.getElementById("DialBlindVMail").innerHTML = "\"Blind"; @@ -7549,7 +7774,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (custom_3way_button_transfer_enabled > 0) { - document.getElementById("CustomXfer").innerHTML = "\"Custom"; + document.getElementById("CustomXfer").innerHTML = "\"Custom"; } @@ -7589,7 +7814,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { @@ -8018,15 +8243,15 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { document.getElementById("WebFormSpanTwo").innerHTML = "\"Formulario"; } - document.getElementById("ParkControl").innerHTML = "\"Aparcar"; - if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARKING_ONLY') ) + document.getElementById("ParkControl").innerHTML = "\"Retener"; + if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_RETENER_ONLY') ) { - document.getElementById("ivrParkControl").innerHTML = "\"IVR"; + document.getElementById("ivrParkControl").innerHTML = "\"IVR"; } - document.getElementById("HangupControl").innerHTML = "\"Colgar"; - document.getElementById("XferControl").innerHTML = "\"Transferencia"; - document.getElementById("LocalCloser").innerHTML = "\"CLOSER"; - document.getElementById("DialBlindTransfer").innerHTML = "\"Marcar"; + document.getElementById("HangupControl").innerHTML = "\"Colgar"; + document.getElementById("XferControl").innerHTML = "\"Transferir"; + document.getElementById("LocalCloser").innerHTML = "\"VERIFICADOR"; + document.getElementById("DialBlindTransfer").innerHTML = "\"Enviar"; document.getElementById("DialBlindVMail").innerHTML = "\"Blind"; document.getElementById("VolumeUpSpan").innerHTML = ""; document.getElementById("VolumeDownSpan").innerHTML = ""; @@ -8035,7 +8260,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) {document.getElementById("QuickXfer").innerHTML = "\"TRANSFERENCIA";} if (custom_3way_button_transfer_enabled > 0) - {document.getElementById("CustomXfer").innerHTML = "\"Custom";} + {document.getElementById("CustomXfer").innerHTML = "\"Custom";} if (call_requeue_button > 0) { @@ -8066,7 +8291,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) alt_dial_active = 0; alt_dial_status_display = 0; reselect_alt_dial = 0; - manual_auto_hotkey = 1; + manual_auto_hotkey = 2; } } } @@ -8077,11 +8302,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { alt_dial_active = 0; alt_dial_status_display = 0; - manual_auto_hotkey = 1; + manual_auto_hotkey = 2; } else { - document.getElementById("DiaLControl").innerHTML = "\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"Marcar"; } reselect_alt_dial = 0; } @@ -8105,7 +8330,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (hotkeysused == 'YES') { - manual_auto_hotkey = 1; + manual_auto_hotkey = 2; alt_dial_active=0; alt_dial_status_display = 0; @@ -8113,7 +8338,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("MainStatuSSpan").innerHTML = ''; if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { @@ -8129,7 +8354,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; } else { @@ -8211,20 +8436,24 @@ function set_length(SLnumber,SLlength_goal,SLdirection) XDnextCID = ''; XDcheck = ''; xferchannellive=0; + consult_custom_wait=0; + consult_custom_go=0; + consult_custom_sent=0; + // DEACTIVATE CHANNEL-DEPENDANT BUTTONS AND VARIABLES document.vicidial_form.xferchannel.value = ""; lastxferchannel=''; - // document.getElementById("Leave3WayCall").innerHTML ="\"ABANDONAR"; + // document.getElementById("Leave3WayCall").innerHTML ="\"ABANDONAR"; - document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; + document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; - document.getElementById("ParkCustomerDial").innerHTML ="\"Dial"; + document.getElementById("ParkCustomerDial").innerHTML ="\"Marcar"; - document.getElementById("HangupXferLine").innerHTML ="\"Colgar"; + document.getElementById("HangupXferLine").innerHTML ="\"Colgar"; - document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; + document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; } } @@ -8281,7 +8510,6 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Update vicidial_list lead record with all altered values from form function CustomerData_update() { - var REGcommentsAMP = new RegExp('&',"g"); var REGcommentsQUES = new RegExp("\\?","g"); var REGcommentsPOUND = new RegExp("\\#","g"); @@ -8371,14 +8599,14 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (APIManualDialQueue > 0) { - document.getElementById("DispoManualQueueMessage").innerHTML = "
Manual Dial Queue Calls Waiting: " + APIManualDialQueue + "
"; + document.getElementById("DispoManualQueueMessage").innerHTML = "
Cola de llamadas en espera Marcación manual: " + APIManualDialQueue + "
"; } if (per_call_notes == 'ENABLED') { var test_notes = document.vicidial_form.call_notes_dispo.value; if (test_notes.length > 0) {document.vicidial_form.call_notes.value = document.vicidial_form.call_notes_dispo.value} - document.getElementById("PerCallNotasContent").innerHTML = "
Call Notas:
"; + document.getElementById("PerCallNotasContent").innerHTML = "
Notas de la llamada:
"; } else { @@ -8389,30 +8617,37 @@ function set_length(SLnumber,SLlength_goal,SLdirection) AgentDispoing = 1; var CBflag = ''; var VD_statuses_ct_half = parseInt(VARSELstatuses_ct / 2); - var dispo_HTML = "
LLAMADA DISPOSITION
"; + var dispo_HTML = "
LLAME AL DESTINO
"; var loop_ct = 0; var print_ct = 0; - while (loop_ct < VD_statuses_ct) + if (hide_dispo_list < 1) { - if (VARSELstatuses[loop_ct] == 'Y') + while (loop_ct < VD_statuses_ct) { - if (VARCBstatuses[loop_ct] == 'Y') - {CBflag = '*';} - else - {CBflag = '';} - if (taskDSgrp == VARstatuses[loop_ct]) + if (VARSELstatuses[loop_ct] == 'Y') { - dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; + if (VARCBstatuses[loop_ct] == 'Y') + {CBflag = '*';} + else + {CBflag = '';} + if (taskDSgrp == VARstatuses[loop_ct]) + { + dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; + } + else + { + dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; + } + if (print_ct == VD_statuses_ct_half) + {dispo_HTML = dispo_HTML + "
";} + print_ct++; } - else - { - dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; - } - if (print_ct == VD_statuses_ct_half) - {dispo_HTML = dispo_HTML + "
";} - print_ct++; + loop_ct++; } - loop_ct++; + } + else + { + dispo_HTML = dispo_HTML + "Lista de Disposición estado oculto

"; } dispo_HTML = dispo_HTML + "
"; @@ -8444,7 +8679,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else { move_on=0; - alert_box("USTED DEBE SER DETENIDO BREVEMENTE PARA INTRODUCIR Un CÓDIGO De la PAUSA EN AUTO-DIAL MODE"); + alert_box("USTED DEBE PAUSAR EL SISTEMA PARA INGRESAR UN CÓDIGO DE PAUSA EN EL MODO DE MARCACIÓN AUTOMÁTICA"); } } if (move_on == 1) @@ -8474,7 +8709,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (agent_pause_codes_active=='FORCE') {var Go_BacK_LinK = '';} else - {var Go_BacK_LinK = "Vaya Detrás";} + {var Go_BacK_LinK = "Regresar";} PauseCode_HTML = PauseCode_HTML + "


" + Go_BacK_LinK; document.getElementById("PauseCodeSelectContent").innerHTML = PauseCode_HTML; @@ -8501,7 +8736,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else { move_on=0; - alert_box("YOU MUST BE PAUSED TO SEARCH FOR A LEAD"); + alert_box("USTED DEBE SER DETENIDO PARA BUSCAR A PLOMO"); } } if (move_on == 1) @@ -8512,6 +8747,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } } + +// ################################################################################ +// Generate the Contacts Search span content + function generate_contacts_search() + { + HidEGenDerPulldown(); + showDiv('SearcHContactsDisplaYBox'); + } + + // ################################################################################ // Generate the Presets Chooser span content function generate_presets_pulldown() @@ -8523,7 +8768,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var loop_ct = 0; while (loop_ct < VD_preset_names_ct) { - Presets_HTML = Presets_HTML + "" + VARpreset_names[loop_ct]; + Presets_HTML = Presets_HTML + "" + VARpreset_names[loop_ct]; if (VARpreset_hide_numbers[loop_ct]=='N') {Presets_HTML = Presets_HTML + " - " + VARpreset_numbers[loop_ct];} Presets_HTML = Presets_HTML + "
"; @@ -8532,35 +8777,35 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if ( (CalL_XC_a_NuMber.length > 0) || (CalL_XC_a_Dtmf.length > 0) ) { - Presets_HTML = Presets_HTML + "D1"; + Presets_HTML = Presets_HTML + "D1"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_a_NuMber;} Presets_HTML = Presets_HTML + "
"; } if ( (CalL_XC_b_NuMber.length > 0) || (CalL_XC_b_Dtmf.length > 0) ) { - Presets_HTML = Presets_HTML + "D2"; + Presets_HTML = Presets_HTML + "D2"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_b_NuMber;} Presets_HTML = Presets_HTML + "
"; } if (CalL_XC_c_NuMber.length > 0) { - Presets_HTML = Presets_HTML + "D3"; + Presets_HTML = Presets_HTML + "D3"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_c_NuMber;} Presets_HTML = Presets_HTML + "
"; } if (CalL_XC_d_NuMber.length > 0) { - Presets_HTML = Presets_HTML + "D4"; + Presets_HTML = Presets_HTML + "D4"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_d_NuMber;} Presets_HTML = Presets_HTML + "
"; } if (CalL_XC_e_NuMber.length > 0) { - Presets_HTML = Presets_HTML + "D5"; + Presets_HTML = Presets_HTML + "D5"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_e_NuMber;} Presets_HTML = Presets_HTML + "
"; @@ -8573,8 +8818,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // ################################################################################ // Submit chosen Preset - function PresetSelect_submit(taskpresetname,taskpresetnumber,taskpresetdtmf,taskhidenumber) + function PresetSelect_submit(taskpresetname,taskpresetnumber,taskpresetdtmf,taskhidenumber,taskclosesearch) { + if (taskclosesearch=='Y') + { + hideDiv('SearcHResultSContactsBox'); + hideDiv('SearcHContactsDisplaYBox'); + } hideDiv('PresetsSelectBox'); document.vicidial_form.conf_dtmf.value = taskpresetdtmf; document.vicidial_form.xfername.value = taskpresetname; @@ -8593,7 +8843,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // ################################################################################ -// Generate the Grupo de Alias Chooser panel +// Generate the Alias de grupo Chooser panel function GroupAliasSelectContent_create(task3way) { HidEGenDerPulldown(); @@ -8619,7 +8869,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) {GroupAlias_HTML = GroupAlias_HTML + "
";} } - var Go_BacK_LinK = "Vaya Detrás"; + var Go_BacK_LinK = "Regresar"; GroupAlias_HTML = GroupAlias_HTML + "

" + Go_BacK_LinK; document.getElementById("GroupAliasSelectContent").innerHTML = GroupAlias_HTML; @@ -8639,9 +8889,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; document.vicidial_form.xferchannel.value = ''; - document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; - document.getElementById("ParkCustomerDial").innerHTML ="\"Dial"; - document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; + document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; + document.getElementById("ParkCustomerDial").innerHTML ="\"Marcar"; + document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; var DispoChoice = document.vicidial_form.DispoSelection.value; @@ -8684,9 +8934,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; document.vicidial_form.xferchannel.value = ''; - document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; - document.getElementById("ParkCustomerDial").innerHTML ="\"Dial"; - document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; + document.getElementById("DialWithCustomer").innerHTML ="\"Marcar"; + document.getElementById("ParkCustomerDial").innerHTML ="\"Marcar"; + document.getElementById("HangupBothLines").innerHTML ="\"Colgar"; var DispoChoice = document.vicidial_form.DispoSelection.value; @@ -8726,7 +8976,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&CallBackLeadEstado=" + CallBackLeadEstado + "&comments=" + CallBackCommenTs + "&custom_field_names=" + custom_field_names + "&call_notes=" + document.vicidial_form.call_notes_dispo.value; + DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&CallBackLeadEstado=" + CallBackLeadEstado + "&comments=" + CallBackCommenTs + "&custom_field_names=" + custom_field_names + "&call_notes=" + document.vicidial_form.call_notes_dispo.value + "&qm_dispo_code=" + DispoQMcsCODE; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(DSupdate_query); @@ -8829,6 +9079,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) custom_field_types=''; customerparked=0; customerparkedcounter=0; + consult_custom_wait=0; + consult_custom_go=0; + consult_custom_sent=0; document.getElementById("ParkCounterSpan").innerHTML = ''; document.vicidial_form.xfername.value=''; document.vicidial_form.xfernumhidden.value=''; @@ -8840,6 +9093,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) APIManualDialQueue_last=0; document.vicidial_form.FORM_LOADED.value = '0'; CallBackLeadEstado = ''; + CallBackDatETimE=''; + CallBackrecipient=''; + CallBackCommenTs=''; + DispoQMcsCODE=''; + document.vicidial_form.CallBackDatESelectioN.value = ''; + document.vicidial_form.CallBackCommenTsField.value = ''; + document.vicidial_form.search_phone_number.value=''; document.vicidial_form.search_lead_id.value=''; document.vicidial_form.search_vendor_lead_code.value=''; @@ -8852,6 +9112,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.MDDiaLOverridE.value = ''; document.vicidial_form.MDLeadID.value = ''; document.vicidial_form.MDType.value = ''; + document.vicidial_form.MDPhonENumbeRHiddeN.value = ''; if (post_phone_time_diff_alert_message.length > 10) { @@ -8874,15 +9135,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection) hideDiv('DispoButtonHideB'); hideDiv('DispoButtonHideC'); document.getElementById("DispoSelectBox").style.top = '1px'; // Firefox error en this line for some reason - document.getElementById("DispoSelectMaxMin").innerHTML = " reduzca al mínimo "; - document.getElementById("DispoSelectHAspan").innerHTML = "Retraso Otra vez"; + document.getElementById("DispoSelectMaxMin").innerHTML = " minimizar "; + document.getElementById("DispoSelectHAspan").innerHTML = "Colgar de nuevo"; CBcommentsBoxhide(); EAcommentsBoxhide(); + ContactSearchReset(); AgentDispoing = 0; - if (shift_logout_flag < 1) + if ( (shift_logout_flag < 1) && (api_logout_flag < 1) ) { if (wrapup_waiting == 0) { @@ -8909,18 +9171,21 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else { // trigger HotKeys manual dial automatically go to next lead - if (manual_auto_hotkey == '1') - { - manual_auto_hotkey = 0; - ManualDialNext('','','','','','0'); - } + // if (manual_auto_hotkey > 0) + // { + // manual_auto_hotkey = 0; + // ManualDialNext('','','','','','0'); + // } } } } } else { - LogouT('SHIFT'); + if (shift_logout_flag > 0) + {LogouT('SHIFT');} + else + {LogouT('API');} } if (focus_blur_enabled==1) { @@ -8991,7 +9256,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // ################################################################################ -// Submit the Grupo de Alias +// Submit the Alias de grupo function GroupAliasSelect_submit(newgroupalias,newgroupcid,newusegroup) { hideDiv('GroupAliasSelectBox'); @@ -9001,8 +9266,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (newusegroup > 0) { active_group_alias = newgroupalias; - document.getElementById("ManuaLDiaLGrouPSelecteD").innerHTML = "Grupo de Alias: " + active_group_alias + ""; - document.getElementById("XfeRDiaLGrouPSelecteD").innerHTML = "Grupo de Alias: " + active_group_alias + ""; + document.getElementById("ManuaLDiaLGrouPSelecteD").innerHTML = "Alias de grupo: " + active_group_alias + ""; + document.getElementById("XfeRDiaLGrouPSelecteD").innerHTML = "Alias de grupo: " + active_group_alias + ""; } cid_choice = newgroupcid; scroll(0,0); @@ -9039,32 +9304,47 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.xfername.value = 'D5'; } - function DtMf_PreSet_a_DiaL() + function DtMf_PreSet_a_DiaL(taskquiet) { document.vicidial_form.conf_dtmf.value = CalL_XC_a_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; - basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_b_DiaL() + function DtMf_PreSet_b_DiaL(taskquiet) { document.vicidial_form.conf_dtmf.value = CalL_XC_b_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; - basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_c_DiaL() + function DtMf_PreSet_c_DiaL(taskquiet) { document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber; - basic_originate_call(CalL_XC_c_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_c_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_d_DiaL() + function DtMf_PreSet_d_DiaL(taskquiet) { document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber; - basic_originate_call(CalL_XC_d_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_d_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_e_DiaL() + function DtMf_PreSet_e_DiaL(taskquiet) { document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber; - basic_originate_call(CalL_XC_e_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_e_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } function hangup_timer_xfer() { @@ -9093,7 +9373,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } // ################################################################################ -// Demostración message that customer has hungup the call before agent has +// Mostrar message that customer has hungup the call before agent has function CustomerChanneLGone() { showDiv('CustomerGoneBox'); @@ -9119,7 +9399,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) dialedcall_send_hangup(); } // ################################################################################ -// Demostración message that there are no voice channels in the VICIDIAL session +// Mostrar message that there are no voice channels in the VICIDIAL session function NoneInSession() { showDiv('NoneInSessionBox'); @@ -9359,7 +9639,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) HidEGenDerPulldown(); if (agent_choose_territories > 0) { - var live_TERR_HTML = "\n";} ?> - +
TERRITORIES NOT SELECTEDSELECTED TERRITORIES
  --- ADD ALL ---
"; + var live_TERR_HTML = "
TERRITORIOS NO SELECCIONADOTERRITORIOS SELECCIONADOS
  --- ADD ALL ---
"; var loop_ct = 0; while (loop_ct < territoryCOUNT) { @@ -9450,9 +9730,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var TerritorySelectChoices = document.vicidial_form.TerritorySelectList.value; if (AllowManualQueueCalls == '0') - {document.getElementById("ManualQueueChoice").innerHTML = "
Manual Queue is Off
";} + {document.getElementById("ManualQueueChoice").innerHTML = "Manual de la cola está Desactivado
";} else - {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue in On
";} + {document.getElementById("ManualQueueChoice").innerHTML = "Manual de la cola in On
";} } // ################################################################################ @@ -9583,18 +9863,18 @@ function set_length(SLnumber,SLlength_goal,SLdirection) function LogouT(tempreason) { if (MD_channel_look==1) - {alert("Usted no puede salir durante un intento de marcado. \nEsperar 50 segundos para que el marcado falle si no es respondido");} + {alert("Usted no puede cerrar sesión durante un intento de marcación. \nEsperar 50 segundos a que la marcación falle, si no se contesta");} else { if (VD_live_customer_call==1) { - alert("TODAVÍA UNA LLAMADA ACTIVA! Colgar y luego salir.\n" + VD_live_customer_call); + alert("¡TODAVÍA TIENE UNA LLAMADA ACTIVA! Cuelgue y luego podrá cerrar sesión.\n" + VD_live_customer_call); } else { if (alt_dial_status_display==1) { - alert("You are in ALT dial mode, you must finish the lead before logging out.\n" + reselect_alt_dial); + alert("Usted está en el modo de marcación ALT, debe terminar el cable antes de salir.\n" + reselect_alt_dial); } else { @@ -9637,9 +9917,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) showDiv('LogouTBox'); var logout_content=''; if (tempreason=='SHIFT') - {logout_content='Su cambio es de más o ha cambiado, se le ha cerrado la sesión de su período de sesiones

';} + {logout_content='Su turno se terminó o cambió, se ha cerrado su sesión

';} + if (tempreason=='API') + {logout_content='El sistema ha recibido una orden para cerrar la sesión, se le ha cerrado la sesión de su período de sesiones

';} - document.getElementById("LogouTBoxLink").innerHTML = logout_content + "PINCHA AQUÍ PARA ENTRAR OTRA VEZ\n"; + document.getElementById("LogouTBoxLink").innerHTML = logout_content + "HAGA CLICK AQUÍ PARA INICIAR SESIÓN OTRA VEZ\n"; logout_stop_timeouts = 1; @@ -9879,6 +10161,7 @@ else "&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + '' + "&entry_list_id=" + document.vicidial_form.entry_list_id.value + '' + + "&call_id=" + LasTCID + '' + "&web_vars=" + LIVE_web_vars + '' + webform_session; @@ -10013,7 +10296,7 @@ else } CFN_tick++; } - document.getElementById("debugbottomspan").innerHTML = CFN_debug; +// document.getElementById("debugbottomspan").innerHTML = CFN_debug; } if (webformnumber == '1') @@ -10092,6 +10375,7 @@ else var SCdid_description = did_description; var SCclosecallid = closecallid; var SCxfercallid = xfercallid; + var SCcall_id = LasTCID; var SCagent_log_id = agent_log_id; var SCweb_vars = LIVE_web_vars; @@ -10164,6 +10448,7 @@ else SCdid_extension = SCdid_extension.replace(RGplus,'+'); SCdid_pattern = SCdid_pattern.replace(RGplus,'+'); SCdid_description = SCdid_description.replace(RGplus,'+'); + SCcall_id = SCcall_id.replace(RGplus,'+'); SCweb_vars = SCweb_vars.replace(RGplus,'+'); } @@ -10239,6 +10524,7 @@ else var RGclosecallid = new RegExp("--A--closecallid--B--","g"); var RGxfercallid = new RegExp("--A--xfercallid--B--","g"); var RGagent_log_id = new RegExp("--A--agent_log_id--B--","g"); + var RGcall_id = new RegExp("--A--call_id--B--","g"); var RGweb_vars = new RegExp("--A--web_vars--B--","g"); encoded = encoded.replace(RGvendor_lead_code, SCvendor_lead_code); @@ -10313,6 +10599,7 @@ else encoded = encoded.replace(RGclosecallid, SCclosecallid); encoded = encoded.replace(RGxfercallid, SCxfercallid); encoded = encoded.replace(RGagent_log_id, SCagent_log_id); + encoded = encoded.replace(RGcall_id, SCcall_id); encoded = encoded.replace(RGweb_vars, SCweb_vars); } decoded=encoded; // simple no ? @@ -10503,7 +10790,7 @@ function phone_number_format(formatphone) { else { move_on=0; - alert_box("USTED DEBE SER DETENIDO GRAB a las llamadas en cola"); + alert_box("USTED DEBE PAUSAR EL SISTEMA PARA CAPTURAR LAS LLAMADAS EN LA COLA"); } } if (move_on == 1) @@ -10619,7 +10906,7 @@ function phone_number_format(formatphone) { } else { - document.getElementById("callsinqueuelink").innerHTML = "Pide Mostrar la cola"; + document.getElementById("callsinqueuelink").innerHTML = "Mostrar las llamadas en la cola"; view_calls_in_queue_active=0; hideDiv('callsinqueuedisplay'); } @@ -10634,7 +10921,7 @@ function phone_number_format(formatphone) { { if (AVlocation=='AgentViewSpan') { - document.getElementById("AgentViewLink").innerHTML = "Agents View -"; + document.getElementById("AgentViewLink").innerHTML = "Ver Agentes -"; agent_status_view_active=1; } showDiv(AVlocation); @@ -10643,7 +10930,7 @@ function phone_number_format(formatphone) { { if (AVlocation=='AgentViewSpan') { - document.getElementById("AgentViewLink").innerHTML = "Agents View +"; + document.getElementById("AgentViewLink").innerHTML = "Ver Agentes +"; agent_status_view_active=0; } hideDiv(AVlocation); @@ -10772,7 +11059,7 @@ function phone_number_format(formatphone) { } if (xmlhttp) { - RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=LEADINFOview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&lead_id=" + VLI_lead_id + "&campaign=" + campaign + "&callback_id=" + VLI_cb_id + "&stage="; + RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=LEADINFOview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&lead_id=" + VLI_lead_id + "&disable_alter_custphone=" + disable_alter_custphone + "&campaign=" + campaign + "&callback_id=" + VLI_cb_id + "&stage="; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(RAview_query); @@ -10790,7 +11077,7 @@ function phone_number_format(formatphone) { // ################################################################################ -// Recarga the call log display +// Recargar the call log display function VieWCalLLoG(logdate,formdate) { var move_on=1; @@ -10803,7 +11090,7 @@ function phone_number_format(formatphone) { else { move_on=0; - alert_box("YOU MUST BE PAUSED TO VIEW YOUR LLAMADA LOG"); + alert_box("USTED DEBE SER se detuvo para ver el registro de llamadas"); // alert("debug: " + AutoDialWaiting + "|" + VD_live_customer_call + "|" + alt_dial_active + "|" + MD_channel_look + "|" + in_lead_preview_state); } } @@ -10835,7 +11122,7 @@ function phone_number_format(formatphone) { } if (xmlhttp) { - RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=CALLLOGview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&date=" + logdate + "&campaign=" + campaign + "&stage="; + RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=CALLLOGview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&date=" + logdate + "&disable_alter_custphone=" + disable_alter_custphone +"&campaign=" + campaign + "&stage="; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(RAview_query); @@ -10853,6 +11140,67 @@ function phone_number_format(formatphone) { } +// ################################################################################ +// Gather and display contacts search data + function ContactSearchSubmit() + { + showDiv('SearcHResultSContactsBox'); + + document.getElementById('SearcHResultSContactsSpan').innerHTML = "Searching...\n"; + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + LSview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=SEARCHCONTACTSRESULTSview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&phone_number=" + document.vicidial_form.contacts_phone_number.value + "&first_name=" + document.vicidial_form.contacts_first_name.value + "&last_name=" + document.vicidial_form.contacts_last_name.value + "&bu_name=" + document.vicidial_form.contacts_bu_name.value + "&department=" + document.vicidial_form.contacts_department.value + "&group_name=" + document.vicidial_form.contacts_group_name.value + "&job_title=" + document.vicidial_form.contacts_job_title.value + "&location=" + document.vicidial_form.contacts_location.value + "&campaign=" + campaign + "&stage="; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(LSview_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + // alert(xmlhttp.responseText); + document.getElementById('SearcHResultSContactsSpan').innerHTML = xmlhttp.responseText + "\n"; + } + } + delete xmlhttp; + } + } + + + +// ################################################################################ +// Reset contact search form + function ContactSearchReset() + { + document.vicidial_form.contacts_phone_number.value=''; + document.vicidial_form.contacts_first_name.value=''; + document.vicidial_form.contacts_last_name.value=''; + document.vicidial_form.contacts_bu_name.value=''; + document.vicidial_form.contacts_department.value=''; + document.vicidial_form.contacts_group_name.value=''; + document.vicidial_form.contacts_job_title.value=''; + document.vicidial_form.contacts_location.value=''; + } + // ################################################################################ // Gather and display lead search data @@ -10860,7 +11208,7 @@ function phone_number_format(formatphone) { { if ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) || (in_lead_preview_state==1) ) { - alert_box("YOU MUST BE PAUSED TO SEARCH FOR A LEAD"); + alert_box("USTED DEBE SER DETENIDO PARA BUSCAR A PLOMO"); } else { @@ -10943,11 +11291,12 @@ function phone_number_format(formatphone) { document.vicidial_form.MDDiaLOverridE.value = ''; document.vicidial_form.MDLeadID.value = ''; document.vicidial_form.MDType.value = ''; + document.vicidial_form.MDPhonENumbeRHiddeN.value = ''; } // ################################################################################ -// Recarga the lead notes display +// Recargar the lead notes display function VieWNotesLoG(logframe) { showDiv('CalLNotasDisplaYBox'); @@ -11034,14 +11383,14 @@ function phone_number_format(formatphone) { // ################################################################################ -// Recarga the FORM content +// Recargar the FORM content function FormContentsLoad() { var form_list_id = document.vicidial_form.list_id.value; var form_entry_list_id = document.vicidial_form.entry_list_id.value; if (form_entry_list_id.length > 2) {form_list_id = form_entry_list_id} - document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' +"&agent_log_id=" + agent_log_id + '' +"&web_vars=" + LIVE_web_vars + ''; + document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + "&call_id=" + LasTCID + '' +"&web_vars=" + LIVE_web_vars + ''; form_list_id = ''; form_entry_list_id = ''; } @@ -11054,7 +11403,7 @@ function phone_number_format(formatphone) { showDiv('DispoButtonHideB'); showDiv('DispoButtonHideC'); document.getElementById("DispoSelectBox").style.top = '340px'; - document.getElementById("DispoSelectMaxMin").innerHTML = " maximice "; + document.getElementById("DispoSelectMaxMin").innerHTML = " maximizar "; } @@ -11063,7 +11412,7 @@ function phone_number_format(formatphone) { function DispoMaximize() { document.getElementById("DispoSelectBox").style.top = '1px'; - document.getElementById("DispoSelectMaxMin").innerHTML = " reduzca al mínimo "; + document.getElementById("DispoSelectMaxMin").innerHTML = " minimizar "; hideDiv('DispoButtonHideA'); hideDiv('DispoButtonHideB'); hideDiv('DispoButtonHideC'); @@ -11071,7 +11420,7 @@ function phone_number_format(formatphone) { // ################################################################################ -// Demostración the groups selection span +// Mostrar the groups selection span function OpeNGrouPSelectioN() { var move_on=1; @@ -11084,14 +11433,14 @@ function phone_number_format(formatphone) { else { move_on=0; - alert_box("USTED DEBE CAMBIAR pausa GRUPOS"); + alert_box("USTED DEBE PAUSAR EL SISTEMA PARA CAMBIAR LOS GRUPOS"); } } if (move_on == 1) { if (manager_ingroups_set > 0) { - alert_box("Director" + external_igb_set_name + " ha seleccionado en las opciones de su grupo"); + alert_box("Director" + external_igb_set_name + " ha seleccionado las opciones de su grupo"); } else { @@ -11103,7 +11452,7 @@ function phone_number_format(formatphone) { // ################################################################################ -// Demostración the territories selection span +// Mostrar the territories selection span function OpeNTerritorYSelectioN() { var move_on=1; @@ -11155,7 +11504,7 @@ function phone_number_format(formatphone) { // ################################################################################ -// Demostración the EAcommentsBox span upon click +// Mostrar the EAcommentsBox span upon click function EAcommentsBoxshow() { showDiv('EAcommentsBox'); @@ -11251,7 +11600,7 @@ function phone_number_format(formatphone) { { CallBackrecipient = 'ANYONE'; } - document.getElementById("CallBackDatEPrinT").innerHTML = "Seleccione una fecha abajo"; + document.getElementById("CallBackDatEPrinT").innerHTML = "Seleccione una fecha a continuación"; document.vicidial_form.CallBackOnlyMe.checked=false; if (my_callback_option == 'CHECKED') {document.vicidial_form.CallBackOnlyMe.checked=true;} @@ -11282,7 +11631,7 @@ function phone_number_format(formatphone) { { if ( (timer_action_message.length > 0) || (timer_action == 'MESSAGE_ONLY') ) { - document.getElementById("TimerContentSpan").innerHTML = "NOTIFICACIÓN TIMER: " + timer_action_seconds + " segundos

" + timer_action_message + "
"; + document.getElementById("TimerContentSpan").innerHTML = "NOTIFICACIÓN DEL TEMPORIZADOR: " + timer_action_seconds + " segundos

" + timer_action_message + "
"; showDiv('TimerSpan'); } @@ -11317,6 +11666,26 @@ function phone_number_format(formatphone) { { DtMf_PreSet_e_DiaL(); } + if (timer_action == 'D1_DIAL_QUIET') + { + DtMf_PreSet_a_DiaL('YES'); + } + if (timer_action == 'D2_DIAL_QUIET') + { + DtMf_PreSet_b_DiaL('YES'); + } + if (timer_action == 'D3_DIAL_QUIET') + { + DtMf_PreSet_c_DiaL('YES'); + } + if (timer_action == 'D4_DIAL_QUIET') + { + DtMf_PreSet_d_DiaL('YES'); + } + if (timer_action == 'D5_DIAL_QUIET') + { + DtMf_PreSet_e_DiaL('YES'); + } if ( (timer_action == 'HANGUP') && (VD_live_customer_call==1) ) { hangup_timer_xfer(); @@ -11414,6 +11783,8 @@ function phone_number_format(formatphone) { hideDiv('CalLNotasDisplaYBox'); hideDiv('SearcHForMDisplaYBox'); hideDiv('SearcHResultSDisplaYBox'); + hideDiv('SearcHContactsDisplaYBox'); + hideDiv('SearcHResultSContactsBox'); hideDiv('LeaDInfOBox'); hideDiv('agentdirectlink'); hideDiv('blind_monitor_notice_span'); @@ -11464,13 +11835,13 @@ function phone_number_format(formatphone) { if (agent_xfer_park_customer_dial < 1) {hideDiv('ParkCustomerDial');} if (AllowManualQueueCallsChoice == '1') - {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue is Off
";} + {document.getElementById("ManualQueueChoice").innerHTML = "Manual de la cola está Desactivado
";} document.vicidial_form.LeadLookuP.checked=true; if ( (agent_pause_codes_active=='Y') || (agent_pause_codes_active=='FORCE') ) { - document.getElementById("PauseCodeLinkSpan").innerHTML = "INTRODUZCA Un CÓDIGO De la PAUSA"; + document.getElementById("PauseCodeLinkSpan").innerHTML = "INTRODUZCA UN CÓDIGO DE PAUSA"; } if (VICIDiaL_allow_closers < 1) { @@ -11479,7 +11850,7 @@ function phone_number_format(formatphone) { document.getElementById("sessionIDspan").innerHTML = session_id; if ( (LIVE_campaign_recording == 'NEVER') || (LIVE_campaign_recording == 'ALLFORCE') ) { - document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; + document.getElementById("RecorDControl").innerHTML = "\"Comenzar"; } if (INgroupCOUNT > 0) { @@ -11554,7 +11925,7 @@ function phone_number_format(formatphone) { // WebPhonEwin.blur(); } - if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_PARKING_ONLY') ) + if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_RETENER_ONLY') ) { showDiv('ivrParkControl'); } @@ -11563,7 +11934,6 @@ function phone_number_format(formatphone) { } else { - var WaitingForNextStep=0; if ( (CloserSelecting==1) || (TerritorySelecting==1) ) {WaitingForNextStep=1;} if (open_dispo_screen==1) @@ -11597,7 +11967,7 @@ function phone_number_format(formatphone) { if (document.vicidial_form.DiaLAltPhonE.checked==true) { reselect_alt_dial = 1; - document.getElementById("DiaLControl").innerHTML = "\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"Marcar"; document.getElementById("MainStatuSSpan").innerHTML = "Dial Next Call"; } @@ -11624,6 +11994,14 @@ function phone_number_format(formatphone) { if ( (custchannellive < -30) && (lastcustchannel.length > 3) && (no_empty_session_warnings < 1) ) {CustomerChanneLGone();} if ( (custchannellive < -10) && (lastcustchannel.length > 3) ) {ReChecKCustoMerChaN();} if ( (nochannelinsession > 16) && (check_n > 15) && (no_empty_session_warnings < 1) ) {NoneInSession();} + if (external_transferconf_count > 0) {external_transferconf_count = (external_transferconf_count - 1);} + if (manual_auto_hotkey == "1") + { + manual_auto_hotkey = 0; + ManualDialNext('','','','','','0'); + } + if (manual_auto_hotkey > 1) {manual_auto_hotkey = (manual_auto_hotkey - 1);} + if (WaitingForNextStep==0) { if (trigger_ready > 0) @@ -11701,7 +12079,7 @@ function phone_number_format(formatphone) { if (customer_3way_hangup_action=='DISPO') { - customer_3way_hangup_dispo_message='Customer Hung-up, 3-way Call Ended Automatically'; + customer_3way_hangup_dispo_message='Cliente Hung-up, de 3 vías llamadas terminaron automáticamente'; bothcall_send_hangup(); } } @@ -11829,6 +12207,15 @@ function phone_number_format(formatphone) { } } } + if (consult_custom_wait > 0) + { + if (consult_custom_wait == '1') + {vcFormIFrame.document.form_custom_fields.submit();} + if (consult_custom_wait >= consult_custom_delay) + {SendManualDial('YES');} + else + {consult_custom_wait++;} + } } setTimeout("all_refresh()", refresh_interval); } @@ -11980,7 +12367,7 @@ function phone_number_format(formatphone) { } } function pause() // Pauses the refreshing of the lists - {active_display=2; display_message=" - DISPLAY ACTIVO PAUSADO - ";} + {active_display=2; display_message=" - DESPLIEGUE ACTIVO PAUSADO - ";} function start() // resumes the refreshing of the lists {active_display=1; display_message='';} function faster() // lowers by 1000 milliseconds the time until the next refresh @@ -12070,12 +12457,12 @@ function phone_number_format(formatphone) { document.getElementById(divvar).innerHTML = ''; if (divvar == 'DiaLLeaDPrevieW') { - var buildDivHTML = " MOSTRAR LEAD
"; + var buildDivHTML = " VISUALIZAR EL CONTACTO
"; document.getElementById("DiaLLeaDPrevieWHide").innerHTML = buildDivHTML; } if (divvar == 'DiaLDiaLAltPhonE') { - var buildDivHTML = " TELÉFONO DEL ALT
"; + var buildDivHTML = " MARCAR AL TELÉFONO ALTERNATIVO
"; document.getElementById("DiaLDiaLAltPhonEHide").innerHTML = buildDivHTML; } if (DefaulTAlTDiaL == '1') @@ -12090,7 +12477,7 @@ function phone_number_format(formatphone) { if (divvar == 'DiaLLeaDPrevieW') { document.getElementById("DiaLLeaDPrevieWHide").innerHTML = ''; - var buildDivHTML = " MOSTRAR LEAD
"; + var buildDivHTML = " VISUALIZAR EL CONTACTO
"; document.getElementById(divvar).innerHTML = buildDivHTML; if (reselect_preview_dial==1) {document.vicidial_form.LeadPreview.checked=true} @@ -12098,7 +12485,7 @@ function phone_number_format(formatphone) { if (divvar == 'DiaLDiaLAltPhonE') { document.getElementById("DiaLDiaLAltPhonEHide").innerHTML = ''; - var buildDivHTML = " TELÉFONO DEL ALT
"; + var buildDivHTML = " MARCAR AL TELÉFONO ALTERNATIVO
"; document.getElementById(divvar).innerHTML = buildDivHTML; if (reselect_alt_dial==1) {document.vicidial_form.DiaLAltPhonE.checked=true} @@ -12113,14 +12500,14 @@ function phone_number_format(formatphone) { if (divvar == 'SHOW') { conf_channels_xtra_display = 1; - document.getElementById("busycallsdisplay").innerHTML = "Ocultar la información del canal Conferencia"; + document.getElementById("busycallsdisplay").innerHTML = "Ocultar la información del canal de conferencia"; LMAe[0]=''; LMAe[1]=''; LMAe[2]=''; LMAe[3]=''; LMAe[4]=''; LMAe[5]=''; LMAcount=0; } else { conf_channels_xtra_display = 0; - document.getElementById("busycallsdisplay").innerHTML = "Mostrar la información del canal Conferencia

 "; + document.getElementById("busycallsdisplay").innerHTML = "Mostrar la información del canal de conferencia

 "; document.getElementById("outboundcallsspan").innerHTML = ''; LMAe[0]=''; LMAe[1]=''; LMAe[2]=''; LMAe[3]=''; LMAe[4]=''; LMAe[5]=''; LMAcount=0; @@ -12159,11 +12546,11 @@ function phone_number_format(formatphone) { document.getElementById("TransferMain").style.top = temp_xfer_height; HKbutton_allowed = 0; showDiv('TransferMain'); - document.getElementById("XferControl").innerHTML = "\"Transferencia"; + document.getElementById("XferControl").innerHTML = "\"Transferir"; if ( (quick_transfer_button_enabled > 0) && (quick_transfer_button_locked < 1) ) {document.getElementById("QuickXfer").innerHTML = "\"TRANSFERENCIA";} if (custom_3way_button_transfer_enabled > 0) - {document.getElementById("CustomXfer").innerHTML = "\"Custom";} + {document.getElementById("CustomXfer").innerHTML = "\"Custom";} } else { @@ -12172,7 +12559,7 @@ function phone_number_format(formatphone) { hideDiv('agentdirectlink'); if (showoffvar == 'YES') { - document.getElementById("XferControl").innerHTML = "\"Transferencia"; + document.getElementById("XferControl").innerHTML = "\"Transferir"; if ( (quick_transfer_button == 'IN_GROUP') || (quick_transfer_button == 'LOCKED_IN_GROUP') ) { @@ -12184,7 +12571,7 @@ function phone_number_format(formatphone) { } if (custom_3way_button_transfer_enabled > 0) { - document.getElementById("CustomXfer").innerHTML = "\"Custom"; + document.getElementById("CustomXfer").innerHTML = "\"Custom"; } } } @@ -12195,8 +12582,8 @@ function phone_number_format(formatphone) { active_group_alias = LIVE_default_group_alias; cid_choice = LIVE_caller_id_number; } - document.getElementById("XfeRDiaLGrouPSelecteD").innerHTML = "Grupo de Alias: " + active_group_alias + ""; - document.getElementById("XfeRCID").innerHTML = "Haga clic aquí para escoger un grupo de alias"; + document.getElementById("XfeRDiaLGrouPSelecteD").innerHTML = "Alias de grupo: " + active_group_alias + ""; + document.getElementById("XfeRCID").innerHTML = "Haga click aquí para escoger un alias de grupo"; } else { @@ -12208,7 +12595,7 @@ function phone_number_format(formatphone) { { if (showxfervar != 'OFF') { - alert_box('USTED NO TIENE PERMISOS DE TRANSFERIR LLAMADAS'); + alert_box('USTED NO CUENTA CON EL PERMISO DE TRANSFERIR LLAMADAS'); } } } @@ -12251,7 +12638,7 @@ function phone_number_format(formatphone) { { if (dial_method == "INBOUND_MAN") { - document.getElementById("DiaLControl").innerHTML = "\"\"Comienzo\"
\"Marcar"; + document.getElementById("DiaLControl").innerHTML = "\"\"Retomar\"
\"Marcar"; if (manual_dial_preview == 1) {buildDiv('DiaLLeaDPrevieW');} } @@ -12278,7 +12665,7 @@ function phone_number_format(formatphone) { document.getElementById("MainTable").style.backgroundColor=""; document.getElementById("MaiNfooter").style.backgroundColor=""; panel_bgcolor=''; - document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; HidEGenDerPulldown(); } @@ -12293,7 +12680,7 @@ function phone_number_format(formatphone) { document.getElementById("MainTable").style.backgroundColor=""; document.getElementById("MaiNfooter").style.backgroundColor=""; panel_bgcolor=''; - document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; HidEGenDerPulldown(); } @@ -12371,7 +12758,7 @@ $zi=2; - Usuario + Inició sesión como usuario
0) {echo "TERRITORIES     \n";} ?> 0) {echo "GROUPS     \n";} ?> - SALIR\n"; ?> + CERRAR SESIÓN\n"; ?>
@@ -12396,7 +12783,7 @@ $zi=2; {echo "
\"FORM\"  LIVE   session ID:    Llamada ActivaLlamada activa
@@ -12421,25 +12808,25 @@ $zi=2;
- Marcar el Siguiente Número
+ Marcar al siguiente número
- MOSTRAR LEAD
- TELÉFONO DEL ALT
+ VISUALIZAR EL CONTACTO
+ MARCAR AL TELÉFONO ALTERNATIVO
- GRABANDO ARCHIVO:
+ ARCHIVO DE GRABACIÓN:

- GRABACIÓN ID:
+ GRABAR ID:
- Comenzar La Grabación
+ Comenzar la Grabación

Formulario Web
\"Formulario
\n";} ?>  
- Aparcar llamada
+ Retener la llamada
\"IVR
\n";} + if ( ($ivr_park_call=='ENABLED') or ($ivr_park_call=='ENABLED_RETENER_ONLY') ) + {echo "\"IVR
\n";} else {echo "\n";} ?> - Transferencia - Conferencia
+ Transferir - Conferencia
0) {echo "\"Quick
\n";} if ($custom_3way_button_transfer_enabled > 0) - {echo "\"Custom
\n";} + {echo "\"Custom
\n";} ?> @@ -12471,7 +12858,7 @@ $zi=2; ?>
- Colgar al Cliente
+ Colgar al cliente

Enviar DTMF

@@ -12494,12 +12881,12 @@ $zi=2; - + - @@ -12662,9 +13049,9 @@ $zi=2; if ($per_call_notes == 'ENABLED') { - echo "Call Notas:"; + echo "Notas de la llamada: "; if ($agent_call_log_view == '1') - {echo "
view notes ";} + {echo "
ver las notas ";} echo " +
  Customer Time:                         Canal:   Tiempo al Cliente:                         Canal:
Información Del Cliente:         + Información del cliente:         LEAD SEARCH";} + {echo "PERSPECTIVA BUSCAR";} ?>
"; echo "\n"; } @@ -12699,7 +13086,7 @@ $zi=2; -MARCADO MANUAL       DIAL RÁPIDO
+MARCACIÓN MANUAL       MARCACIÓN RÁPIDA
@@ -12707,14 +13094,14 @@ $zi=2; -VIEW LLAMADA LOG
+VER REGISTRO DE LLAMADAS
    -
VERSIÓN:   CONSTRUCCION:     Servidor:              
+ @@ -12751,9 +13138,9 @@ Su Estado:
Calls Dialing: D1 - DIAL\n"; + echo "D1 - MARCAR\n"; echo "   \n"; - echo "D2 - DIAL\n"; + echo "D2 - MARCAR\n"; } else {echo "
\n";} ?> @@ -12769,17 +13156,17 @@ if ($view_calls_in_queue > 0) if ($view_calls_in_queue_launch > 0) {echo "Ocultar las llamadas en cola\n";} else - {echo "Pide Mostrar la cola\n";} + {echo "Mostrar las llamadas en la cola\n";} } ?>
-X SERVICIOS REPETIDOS ACTIVOS
+X SERVICIOS DE DEVOLVER LLAMADAS ACTIVOS
VERSIÓN:   CONSTRUCCIÓN:     Servidor:              
- Mostrar la información del canal Conferencia + Mostrar la información del canal de conferencia

 
  -Otros agentes de Estado:  
 
+Estado de otros agentes:  
 
-
Agents View +
+
Ver Agentes +
0) { - echo "Dialable Leads:
 \n"; + echo "Pueda Marcar Perspectiva:
 \n"; } ?>
@@ -12850,17 +13237,17 @@ if ($agent_display_dialable_leads > 0)
- Transferencia - Conferencia            
+ Transferir - Conferencia            
@@ -12874,7 +13261,7 @@ if ($agent_display_dialable_leads > 0) CONSULTIVO   @@ -12902,20 +13289,20 @@ if ($agent_display_dialable_leads > 0) +
- CLOSER LOCAL     + VERIFICADOR LOCAL     - Colgar Línea Xfer + Colgar la línea en transferencia
- Colgar Ambas Líneas + Colgar ambas líneas
- INVALIDACIÓN DEL MARCADO + INVALIDAR Y SOBREESCRIBIR LA MARCACIÓN - ABANDONAR LLAMADA 3-WAY + ABANDONAR LA LLAMADA TRIPARTITA
- Marcar Blind Transfer + Enviar una transferencia desatendida   - Marcar Con El Cliente + Marcar con el cliente   - Dial Del Cliente Del Parque + Marcar al cliente retenido   0) } else { - ?> - - D1 - D2 - D3 - D4 - D5 - - + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + +   @@ -12951,12 +13347,12 @@ if ($agent_display_dialable_leads > 0)
-Agentes disponibles de transferencia:
+Transferencia a los agentes disponibles: -
Lead Dispositioned Como:

+
El contacto se dispuso como:

-
@@ -12964,8 +13360,8 @@ Agentes disponibles de transferencia: - + @@ -12981,7 +13377,7 @@ Agentes disponibles de transferencia:
Teclas de acceso rápido a la Disposición: - Cuando esté activo, presione simplemente la tecla para la disposición deseada para esta llamada. La llamada después será colgada y dispositioned automáticamente:
Teclas de acceso rápido para la disposición: + Cuando esté activa, tan sólo presione una tecla del teclado para la disposición deseada para esta llamada. Entonces, se colgará y se dispondrá la llamada de manera automática:
- + +
Información Anterior Del Servicio repetido: Información del servicio de devolución de llamada anterior: close
@@ -12998,8 +13394,8 @@ Agentes disponibles de transferencia: - - + + + + +
Teléfono de Información ampliado Alt: reduzca al mínimo Información extendida del teléfono alternativo: minimizar

@@ -13015,53 +13411,53 @@ Agentes disponibles de transferencia: - +
maximice
Alt Teléfono Info
maximizar
Alt Teléfono Info
Nadie está en su sesión:
- Vaya Detrás + Regresar

- Agente De la Llamada Otra vez + Llamar de nuevo al agente
El cliente ha colgado:
- Vaya Detrás + Regresar

- Final y llamada de la disposición + Terminar y disponer de la llamada
- +
Llamada Wrapup: segundos restantes en wrapup

+
Conclusión de la llamada: segundos restantes de la conclusión



- Final Wrapup y movimiento encendido + Terminar con la conclusión y proseguir



- Cerrar Mensaje + Cerrar el mensaje
- +
Se ha inhabilitado su sesión
SALIR

Vaya Detrás +
Se ha inhabilitado su sesión
CERRAR SESIÓN

Regresar
- +
Hay un problema de sincronización de tiempo con su sistema, por favor, dígale a su administrador del sistema


Vaya Detrás +
Hay un problema de sincronización de horario en su sistema, por favor, infórmeselo al administrador de su sistema


Regresar
-

SALIR
+

CERRAR SESIÓN
@@ -13073,11 +13469,11 @@ Agentes disponibles de transferencia: -
Cualquier cambio realizado al cliente que no será la información abajo en este tiempo comitted, usted debe cambiar la información del cliente antes de usted retraso la llamada.
+
Cualquier cambio que se realice a la siguiente información del cliente no se aplicará, debe cambiar la información del cliente antes de colgar la llamada.
- +
DISPOSITION LLAMADA :       Retraso Otra vez       reduzca al mínimo
+
DISPOSICIÓN DEL ESTADO DE LA LLAMADA :       Colgar de nuevo       minimizar

\n";} @@ -13085,26 +13481,26 @@ Agentes disponibles de transferencia: - selección de la disposición del End-of-call + Selección de la disposición de fin de llamada
- PARAR LA LLAMADA
- REINICIAR | - ENVIAR + PAUSAR LA MARCACIÓN DEL AGENTE
+ ELIMINAR EL FORMULARIO | + INGRESAR

- WEB FORM ENVIAR + WEB FORM INGRESAR

 
-
Seleccione una fecha del servicio repetido :
+
Seleccione una fecha para devolver la llamada :

\n";} ?> - Seleccione una fecha abajo   + Seleccione una fecha a continuación       Hour: SÓLO MI SERVICIO DE DEVOLVER LLAMADAS
";} ?> - Comentarios de los CBES:

+ Comentarios de los CB:

- ENVIAR

+ INGRESAR



 
- "; + + if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) + {$CCAL_OUT .= "";} + $CINC++; + } $CCAL_OUT .= "
SERVICIOS REPETIDOS PARA EL AGENTE :
To see information en one of the callbacks below, click en the INFO link. To call the customer back now, click en the DIAL link. If you click en a record below to dial it, it will be removed from the list. +
SERVICIOS DE DEVOLVER LLAMADAS PARA AGENTES :
Para ver la información en una de las devoluciones de llamada a continuación, haga clic en el enlace INFORMACIÓN. Para llamar al cliente hacia atrás ahora, haga clic en el vínculo de acceso telefónico. Si hace clic en un registro de abajo para marcar, éste será removido de la lista.

  - Recarga + Recargar                 - Vaya Detrás + Regresar
- "; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "
NUEVO PLOMO MANUAL DEL DIAL PARA :

Incorpore la información abajo para el nuevo plomo que usted desea llamar. +
NUEVO CONTACTO DE MARCACIÓN MANUAL PARA :

Ingrese la información del nuevo contacto al que desea llamar a continuación.
\n"; + echo "Nota: un prefijo de marcación de $manual_dial_prefix será agregado al inicio de este número
\n"; } ?> Note: all new manual dial leads will go into list

- - + + - - + + +

Si usted desea marcar un número y NO desea agregarlo como nuevo contacto, captúrelo en la cadena de marcación a la que desea llamar del campo de invalidación de marcación siguiente. Para colgar esta llamada, tendrá que abrir el enlace de LLAMADAS EN ESTA SESIÓN en la parte inferior de la pantalla y colgarla al hacer click en el enlace del canal que se encuentra ahí.
  - - +
Dial Código:   (Éste es generalmente un 1 en los U.S.A. y el Canadá) Código de marcación:   (Éste, por lo general, es un 1 en EE.UU. y Canadá)
Teléfono Number:   (digits only) + - +
Plomos Existentes De la Búsqueda:   (Esta opción si está comprobada procurará encontrar el número de teléfono en el sistema antes de insertarlo como nuevo plomo) Buscar en los contactos existentes:   (Si se selecciona esta opción, ésta intentará encontrar el número telefónico en el sistema antes de ingresarlo como un nuevo contacto)


   
-

Si usted desea marcar un número y hacerlo no agregar como nuevo plomo, entre en dialstring exacto ese usted desean llamar en el campo de la invalidación del dial abajo. Al retraso esta llamada usted tendrá que abrir las LLAMADAS EN ESTE acoplamiento de la SESIÓN en el fondo de la pantalla y colgarlas para arriba chascando en su acoplamiento del canal allí.
 
Inválidoación Del Dial:   (los dígitos satisfacen solamente) + Inválidoar y sobreescribir la marcación:   (sólo dígitos por favor)

- Dial Ahora + Marcar ahora                 - Vista previa de llamada + Vista previa de la llamada                 - Vaya Detrás + Regresar
- "; - $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;"; + $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|";} @@ -8165,7 +8475,7 @@ if ($ACTION == 'CALLLOGview') $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;"; + $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|";} @@ -8201,7 +8511,7 @@ if ($ACTION == 'CALLLOGview') if ($g > 0) {sort($ALLsort, SORT_NUMERIC);} else - {echo "";} + {echo "";} $u=0; while ($g > $u) @@ -8214,13 +8524,16 @@ if ($ACTION == 'CALLLOGview') else {$bgcolor='bgcolor="#9BB9FB"';} + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} $u++; echo ""; echo ""; echo ""; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -8233,7 +8546,7 @@ if ($ACTION == 'CALLLOGview') echo "
SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER
+
SELECCIÓN DEL GRUPO DE VERIFICADORES ENTRANTES

\n";} ?> - SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER + Selección del grupo de verificadores entrantes
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - BLENDED LLAMADAING(Salientes activdas)
+ MEZCLA DE LLAMADAS ENTRANTES Y SALIENTES(Salientes activdas)
REINICIAR | - ENVIAR + INGRESAR



 
-
TERRITORY SELECTION
+
TERRITORIO DE SELECCIÓN

\n";} @@ -13243,7 +13640,7 @@ Agentes disponibles de transferencia: Territory Selection
REINICIAR | - ENVIAR + INGRESAR



 
@@ -13253,9 +13650,9 @@ Agentes disponibles de transferencia: Canal MI SERVICIO REPETIDO SOLAMENTE
";} + {echo " SÓLO MI SERVICIO DE DEVOLVER LLAMADAS
";} if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) - {echo " BLENDED LLAMADAING
";} + {echo " MEZCLA DE LLAMADAS ENTRANTES Y SALIENTES
";} ?> @@ -13270,14 +13667,68 @@ Agentes disponibles de transferencia:
- -
      SEARCH FOR A LEAD:             close [X]
+ +
      Buscar un contacto:             close [X]

\n";} ?>

- Notas:when doing a search for a lead, the phone number, lead ID or are the best fields to use.
Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms.
Lead search requests are all logged in the system. + Notas: al hacer una búsqueda de un contacto, los términos de búsqueda comodín o parcial no se les permite.
Solicitudes de contacto de búsqueda están registra en el sistema de. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Primero Name:
Último Name:
BU Name:
Department:
Group Name:
Job Título:
Location:

INGRESAR SEARCH             Nueva búsqueda
+

  +
+
+ + +
      CONTACTOS RESULTADOS DE LA BÚSQUEDA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      BUSCAR UN PLOMO:             close [X]
+
\n";} + ?> +

+ Notas: cuando se hace una búsqueda de una ventaja, el número de teléfono, llevar DNI o son los mejores campos de usar.
Utilizando los otros campos puede ser más lenta. La búsqueda de plomo no permite términos de búsqueda comodín o parcial.
Las solicitudes de búsqueda de plomo están registra en el sistema de.

@@ -13287,9 +13738,9 @@ Agentes disponibles de transferencia: @@ -13314,7 +13765,7 @@ Agentes disponibles de transferencia: : - +
Teléfono Number Fields: - Main Teléfono Number - Alternate Teléfono Number - Dirección3 Teléfono Number + Número de teléfono Principal + Número de teléfono alternativo + Dirección3 Teléfono

ENVIAR SEARCH             reset form

INGRESAR SEARCH             Nueva búsqueda


  @@ -13322,7 +13773,7 @@ Agentes disponibles de transferencia: - +
      SEARCH RESULTS:             close [X]
+ +
      RESULTADOS DE LA BÚSQUEDA:             close [X]

\n";} @@ -13333,19 +13784,19 @@ Agentes disponibles de transferencia: -
      LLAMADA NOTES LOG:             close [X]
+
      Notas de la llamada LOG:             close [X]

\n";} ?> -
Call Notas List
+
Lista de llamadas Notas


  - Close Info Box + Cerrar cuadro de información
- -
      Información Del Cliente:             close [X] +
      Información del cliente:             close [X]
Lead Info

  - Close Info Box + Cerrar cuadro de información
-
SELECCIONE Un CÓDIGO De la PAUSA :
+ + + +
SELECCIONE UN CÓDIGO DE PAUSA :

\n";} @@ -13370,7 +13821,7 @@ Agentes disponibles de transferencia: - "; - 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 ""; + $screen_labels = $row[0]; } - echo "
SELECT A PRESET :
+ "; echo ""; echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -7058,7 +8441,7 @@ if ($ACTION == 'CALLLOGview') 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;"; + $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|";} @@ -7081,11 +8464,18 @@ if ($ACTION == 'CALLLOGview') $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;"; + $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|";} @@ -7107,6 +8497,13 @@ if ($ACTION == 'CALLLOGview') $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++; } @@ -7114,7 +8511,7 @@ if ($ACTION == 'CALLLOGview') if ($g > 0) {sort($ALLsort, SORT_NUMERIC);} else - {echo "";} + {echo "";} $u=0; while ($g > $u) @@ -7127,31 +8524,714 @@ if ($ACTION == 'CALLLOGview') else {$bgcolor='bgcolor="#9BB9FB"';} + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} $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 "\n"; echo "\n"; } echo "
Elija un preset :

\n";} @@ -13381,12 +13832,12 @@ Agentes disponibles de transferencia: -
SELECCIONAR UN GRUPO DE ALIAS :
+
SELECCIONAR UN ALIAS DE GRUPO :

\n";} ?> - Grupo de Selección de Alias + Selección del alias de grupo

 
@@ -13395,7 +13846,7 @@ Agentes disponibles de transferencia:
ALERT :
    -

Vaya Detrás +

Regresar
diff --git a/agc_2-X/trunk/LANG_www/agc_es/voicemail_check.php b/agc_2-X/trunk/LANG_www/agc_es/voicemail_check.php index 9d0b97d6..2aa600b3 100644 --- a/agc_2-X/trunk/LANG_www/agc_es/voicemail_check.php +++ b/agc_2-X/trunk/LANG_www/agc_es/voicemail_check.php @@ -96,8 +96,8 @@ if ($format=='debug') { echo "\n"; echo "\n"; -echo "\n"; -echo "Comprobar el buzón de voz"; +echo "<!-- VERSIÓN: $version CONSTRUCCIÓN: $build VMBOX: $vmail_box server_ip: $server_ip-->\n"; +echo "<title>Revisar el buzón de voz"; echo "\n"; echo "\n"; echo "\n"; @@ -108,7 +108,7 @@ echo " if (strlen($vmail_box)<1) { $channel_live=0; - echo "caja del buzón de voz $vmail_box No es válido\n"; + echo "buzón de voz $vmail_box No es válido\n"; exit; } else @@ -132,7 +132,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_fr/active_list_refresh.php b/agc_2-X/trunk/LANG_www/agc_fr/active_list_refresh.php index 0d81835a..2e9c0760 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/active_list_refresh.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/active_list_refresh.php @@ -126,7 +126,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/agc_2-X/trunk/LANG_www/agc_fr/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_fr/astguiclient.php index fdfb77f3..1fd4ee69 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -145,7 +146,7 @@ if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) { header ("Content-type: text/html; charset=utf-8"); - echo "astGUIclient Client Web: Ouverture de Session\n"; + echo "astGUIclient Client Web: Login\n"; echo "\n"; echo "\n"; echo "\n"; @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_fr/calendar.css b/agc_2-X/trunk/LANG_www/agc_fr/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_fr/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/agc_2-X/trunk/LANG_www/agc_fr/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_fr/calendar_db.js new file mode 100644 index 00000000..5d29a875 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_fr/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' : ['Janvier', 'February', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], + '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 ("Invalide 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 ("Invalide 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("Invalide 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/agc_2-X/trunk/LANG_www/agc_fr/call_log_display.php b/agc_2-X/trunk/LANG_www/agc_fr/call_log_display.php index b31579b9..8a52cf2b 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/call_log_display.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/call_log_display.php @@ -74,7 +74,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/agc_2-X/trunk/LANG_www/agc_fr/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_fr/conf_exten_check.php index 8c09a0ce..89358bdc 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -137,12 +150,11 @@ $auth=$row[0]; if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ else } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Vérification de l'extension de la Conférence"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Vérification de l'extension de la Conférence"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten est invalide\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check sur calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Appels dans la file d'attente: $RingCalls";} + else {$RingCalls = "Appels dans la file d'attente: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check sur calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Appels dans la file d'attente: $RingCalls";} - else {$RingCalls = "Appels dans la file d'attente: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Statut: ' . $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 . '|Statut: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten est invalide or Exten $exten est invalide\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Conférence $conf_exten a été attribué à $exten\n"; + echo "Conférence $conf_exten a été attribué à $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_fr/functions.php b/agc_2-X/trunk/LANG_www/agc_fr/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_fr/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_fr/inbound_popup.php b/agc_2-X/trunk/LANG_www/agc_fr/inbound_popup.php index f5c0101a..1b734c3b 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/inbound_popup.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/inbound_popup.php @@ -86,7 +86,7 @@ if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/agc_2-X/trunk/LANG_www/agc_fr/live_exten_check.php b/agc_2-X/trunk/LANG_www/agc_fr/live_exten_check.php index a20eefa0..85224fc3 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/live_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/live_exten_check.php @@ -75,7 +75,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/agc_2-X/trunk/LANG_www/agc_fr/manager_send.php b/agc_2-X/trunk/LANG_www/agc_fr/manager_send.php index 51a8de0e..3e5c6e11 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -95,11 +100,20 @@ # 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-47'; -$build = '100327-0846'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -239,7 +264,7 @@ $auth=$row[0]; if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else @@ -289,6 +314,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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten est invalide or queryCID $queryCID est invalide, Originate commande non insérée\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,6 +815,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 +869,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='MISE EN ATTED',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='MISE EN ATT',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 +959,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='MISE EN ATT',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 "Une de ces variables est invalide:\n"; + echo "Channel $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "extenName $extenName est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "parkedby $parkedby est obligatoire\n"; + echo "\nRedirectToPark Action pas envoyé\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='MISE EN ATT_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='IVRMISE EN ATTED',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='IVRMISE EN ATT',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 "Une de ces variables est invalide:\n"; + echo "Channel $channel doit avoir plus de 2 caractères \n"; + echo "queryCID $queryCID doit avoir plus de 14 caractères \n"; + echo "exten $exten est obligatoire\n"; + echo "ext_context $ext_context est obligatoire\n"; + echo "ext_priority $ext_priority est obligatoire\n"; + echo "\nRedirectFromPark Action pas envoyé\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='IVRMISE EN ATT',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) ) @@ -998,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel n'est pas en ligne sur $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1105,7 +1547,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); } } @@ -1182,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1201,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1215,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel n'est pas en ligne sur $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1650,7 +2092,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/agc_2-X/trunk/LANG_www/agc_fr/park_calls_display.php b/agc_2-X/trunk/LANG_www/agc_fr/park_calls_display.php index 64c8dc1a..bc20d026 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/park_calls_display.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/park_calls_display.php @@ -65,7 +65,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) ) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/agc_2-X/trunk/LANG_www/agc_fr/phone_only.php b/agc_2-X/trunk/LANG_www/agc_fr/phone_only.php new file mode 100644 index 00000000..8f3a09af --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_fr/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Vous êtes maintenant déconnecté.\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST sur server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link sur the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location sur the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Téléphone 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 Français
\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 "\n"; + echo "
\"VICIdial\" Téléphone-Only Ouverture de Session
 
Ouverture de Session téléphonique:
Mot de passe du Téléphone:
Ouverture de Session:
Mot de passe Utilisateur:
  \n"; + echo "

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


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

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "L'ouverture de session a èchoué, réessayez
"; + } + } + if ($VDloginDISPLAY) + { + echo "Téléphone 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 Français
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Téléphone-Only Ouverture de Session
 
Ouverture de Session:
Mot de passe Utilisateur:
  \n"; + echo "

VERSION: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Téléphone web client: Ouverture de Session téléphonique Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Français
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


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

VERSION: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ### go through the entered phones to figure out which server has fewest agents + ### logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + while($pb < $phones_auto_ct) + { + ### find the server_ip of each phone_login + $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; + if ($DB) {echo "|$stmtx|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmtx, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Téléphone 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call secondes counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - secondes sur call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Téléphone: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Téléphone:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_fr/timeclock.php b/agc_2-X/trunk/LANG_www/agc_fr/timeclock.php index 0913900b..20a6c8dd 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/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 ##### @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Vous avez maintenant connecté"; + $LOGtimeMESSAGE = "Vous connecté à $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -338,7 +340,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($referrer=='agent') {$BACKlink = "RETOUR à l'Agent Ouverture de Session Screen";} if ($referrer=='admin') - {$BACKlink = "RETOUR à l'administration";} + {$BACKlink = "RETOUR à l'administration";} if ($referrer=='welcome') {$BACKlink = "RETOUR à l'écran de bienvenue";} diff --git a/agc_2-X/trunk/LANG_www/agc_fr/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_fr/vdc_db_query.php index c592b38b..def3a337 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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','CALLLOGview','LEADINFOview') +# - $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',...) @@ -88,6 +88,12 @@ # - $alt_num_status - ('0','1') # - $DiaL_SecondS - ('0','1','2',...) # - $date - ('2010-02-19') +# - $custom_field_names - ('|start_date|finish_date|favorite_color|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -245,15 +251,69 @@ # 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.4-152'; -$build = '100420-1006'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=332; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -432,6 +492,38 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStatut"])) {$CallBackLeadStatut=$_GET["CallBackLeadStatut"];} + elseif (isset($_POST["CallBackLeadStatut"])) {$CallBackLeadStatut=$_POST["CallBackLeadStatut"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -447,7 +539,45 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; ##### Hangup Cause Dictionary ##### $hangup_cause_dictionary = array( @@ -505,7 +635,7 @@ $hangup_cause_dictionary = array( ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -516,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -534,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -557,7 +694,7 @@ else if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else @@ -764,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo "

\n"; - echo "    -READY      -INCALL      -PAUSED  \n"; + echo "    -PRÊT      -INCALL      -PAUSE  \n"; if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) {echo "    -LOGGED-OUT  \n";} @@ -7049,6 +8431,7 @@ if ($ACTION == 'CALLLOGview') echo "
  LENGTH     STATUT     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT  
No calls sur this day
Pas d'appels pour ce jour
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL DIAL
"; echo "
"; - echo "Close Call Log"; + echo "Fermer journal des appels"; echo ""; } ################################################################################ -### LEADINFOview - display the information for a lead +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Retour"; + echo ""; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Résultats trouvés: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set secondes='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STATUT     LAST APPEL     CITY     STATE     ZIP     INFO     COMPOSER  
Aucun résultat trouvé
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Aucun résultat trouvé
"; + echo "
"; + echo "Retour"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Retour"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campagne not found\n"; + echo "

"; + echo "Retour"; + echo ""; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Retour"; + echo ""; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Résultats trouvés: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set secondes='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Aucun résultat trouvé
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Aucun résultat trouvé
"; + echo "
"; + echo "Retour"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Retour"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campagne not found\n"; + echo "

"; + echo "Retour"; + echo ""; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead ################################################################################ if ($ACTION == 'LEADINFOview') { @@ -7159,55 +9239,514 @@ if ($ACTION == 'LEADINFOview') {echo "ERROR: no Lead ID";} else { + $hide_dial_links=0; echo "
\n"; - echo ""; - $stmt="select status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where lead_id='$lead_id'limit 1;"; + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo "
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Statut de rappel:   $row[0]
Callback d'état plomb:   $row[7]
Heure d'entrée de rappel:   $row[1]
Temps de déclenchement de rappel:   $row[2]
Commentaires de rappel:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; $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) + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) { $row=mysql_fetch_row($rslt); - echo "
Statut:   $row[0]
CodeVendeur:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Appelé SInce Nom Reset:   $row[4]
Téléphone Code:   $row[5]
Téléphone Number:   $row[6] -         DIAL
Titre:   $row[7]
Prenom Name:   $row[8]
Mi:  $row[9]
Nom Name:   $row[10]
Adresse 1:   $row[11]
Adresse 2:   $row[12]
Adresse 3:   $row[13]
Ville:   $row[14]
État:   $row[15]
Province:   $row[16]
Postal Code:   $row[17]
Country:   $row[18]
Sexe:  $row[19]
Tel. 2nd:   $row[20] -         DIAL
Email:   $row[21]
Visualiser:   $row[22]
Commentaires:  $row[23]
Appelé Count:   $row[24]
Nom Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
"; - echo "
"; - echo "Close Info Box"; + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Titre'; + $label_first_name = 'Prenom'; + $label_middle_initial = 'MI'; + $label_last_name = 'Nom'; + $label_address1 = 'Adresse1'; + $label_address2 = 'Adresse2'; + $label_address3 = 'Adresse3'; + $label_city = 'Ville'; + $label_state = 'État'; + $label_province = 'Province'; + $label_postal_code = 'CodePostal'; + $label_vendor_lead_code = 'CodeVendeur'; + $label_gender = 'Gender'; + $label_phone_number = 'Téléphone'; + $label_phone_code = 'DialCode'; + $label_alt_phone = 'Tel. 2nd'; + $label_security_phrase = 'Visualiser'; + $label_email = 'Email'; + $label_comments = 'Commentaires'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Téléphone and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Indicatif régional Téléphone dehors de la zone composable $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Code postal dehors de la zone composable $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Indicatif régional Téléphone dehors de la zone composable $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Code postal dehors de la zone composable $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Statut:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Appelé Since Nom Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Appelé Count:   $row[24]
Nom Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
APPELS POUR CE FIL:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STATUT     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Pas d'appels trouvé
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + echo "
"; } } + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -7288,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7314,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -7332,18 +9893,33 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status IN('LIVE');"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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);} @@ -7356,12 +9932,28 @@ if ($ACTION == 'CalLBacKCounT') +################################################################################ +### 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"; + } + + + + ################################################################################ ### DiaLableLeaDsCounT - send the count of the dialable leads in this campaign ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7376,47 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; ##### Hangup Cause Description Map ##### function hangup_cause_description($code) -{ -global $hangup_cause_dictionary; -if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } -else { return "Unidentified Hangup Cause Code."; } -} - - -##### MySQL Error Logging ##### -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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_fr/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_fr/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_fr/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_fr/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_fr/vdc_script_display.php index 9af96d86..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -12,10 +12,15 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-6'; -$build = '100127-1611'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -161,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -363,6 +391,11 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text); @@ -438,6 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -445,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_fr/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_fr/vdc_script_notes.php new file mode 100644 index 00000000..c84714c7 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_fr/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 = 'Titre'; +$label_first_name = 'Prenom'; +$label_middle_initial = 'MI'; +$label_last_name = 'Nom'; +$label_address1 = 'Adresse1'; +$label_address2 = 'Adresse2'; +$label_address3 = 'Adresse3'; +$label_city = 'Ville'; +$label_state = 'État'; +$label_province = 'Province'; +$label_postal_code = 'CodePostal'; +$label_vendor_lead_code = 'CodeVendeur'; +$label_gender = 'Gender'; +$label_phone_number = 'Téléphone'; +$label_phone_code = 'DialCode'; +$label_alt_phone = 'Tel. 2nd'; +$label_security_phrase = 'Visualiser'; +$label_email = 'Email'; +$label_comments = 'Commentaires'; + +$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 "Invalide Username/Mot de passe: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Notes"; +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 Notes:

+
Please click VALIDER to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + + +
+ + + + diff --git a/agc_2-X/trunk/LANG_www/agc_fr/vicidial.php b/agc_2-X/trunk/LANG_www/agc_fr/vicidial.php index 1e8ded52..19847d72 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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 @@ -290,15 +291,102 @@ # 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.4-268'; -$build = '100420-1009'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -369,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,static_agent_url 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,pllb_grouping_limit 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";} @@ -395,6 +485,8 @@ if ($qm_conf_ct > 0) $enable_second_webform = $row[9]; $user_territories_active = $row[10]; $static_agent_url = $row[11]; + $custom_fields_enabled = $row[12]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -403,50 +495,108 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### +# set defaults for hard-coded variables +$conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording +$dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently +$HKuser_level = '5'; # minimum vicidial user_level for HotKeys +$campaign_login_list = '1'; # show drop-down list of campaigns at login +$manual_dial_preview = '1'; # allow preview lead option when manual dial +$multi_line_comments = '1'; # set to 1 to allow multi-line comment box +$user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login +$view_scripts = '1'; # set to 1 to show the SCRIPTS tab +$dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo +$callholdstatus = '1'; # set to 1 to show calls sur hold count +$agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count + $campagentstatctmax = '3'; # Number of secondes for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name sur login pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST sur server for agent time +$no_delete_sessions = '1'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '0'; # set to 1 to show a COMPOSER link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups sur campaigns for login +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" +$hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Raccrocher +$LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$DefaulTAlTDiaL = '0'; # set to 1 to enable ALT COMPOSER by default if enabled for the campaign +$AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option +$disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link sur the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of secondes to delay consultative transfers when customfields are active + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY + +$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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location sur the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information if (file_exists('options.php')) { require('options.php'); } -else - { - $conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording - $dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently - $HKuser_level = '5'; # minimum vicidial user_level for HotKeys - $campaign_login_list = '1'; # show drop-down list of campaigns at login - $manual_dial_preview = '1'; # allow preview lead option when manual dial - $multi_line_comments = '1'; # set to 1 to allow multi-line comment box - $user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login - $view_scripts = '1'; # set to 1 to show the SCRIPTS tab - $dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo - $callholdstatus = '1'; # set to 1 to show calls sur hold count - $agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count - $campagentstatctmax = '3'; # Number of secondes for campaign call and agent stats - $show_campname_pulldown = '1'; # set to 1 to show campaign name sur login pulldown - $webform_sessionname = '1'; # set to 1 to include the session_name in webform URL - $local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server - $clientDST = '1'; # set to 1 to check for DST sur server for agent time - $no_delete_sessions = '1'; # set to 1 to not delete sessions at logout - $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels - $PreseT_DiaL_LinKs = '0'; # set to 1 to show a COMPOSER link for Dial Presets - $LogiNAJAX = '1'; # set to 1 to do lookups sur campaigns for login - $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" - $hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Raccrocher - $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout - $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login - $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT COMPOSER by default if enabled for the campaign - $AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option - $disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen - $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +### BEGIN find any custom field labels ### +$label_title = 'Titre'; +$label_first_name = 'Prenom'; +$label_middle_initial = 'MI'; +$label_last_name = 'Nom'; +$label_address1 = 'Adresse1'; +$label_address2 = 'Adresse2'; +$label_address3 = 'Adresse3'; +$label_city = 'Ville'; +$label_state = 'État'; +$label_province = 'Province'; +$label_postal_code = 'CodePostal'; +$label_vendor_lead_code = 'CodeVendeur'; +$label_gender = 'Gender'; +$label_phone_number = 'Téléphone'; +$label_phone_code = 'DialCode'; +$label_alt_phone = 'Tel. 2nd'; +$label_security_phrase = 'Visualiser'; +$label_email = 'Email'; +$label_comments = 'Commentaires'; - $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'; - } +$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 ### +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -471,14 +621,20 @@ if (strlen($static_agent_url) > 5) 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 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -555,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -573,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -581,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10899,298 +12722,434 @@ else \n"; -$zi=1; +$zi=2; ?> - -
+ + + + + +
+
+
+
+
+
+
+           Loading +
+
+
+
+ - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> - +
- + + -
+ + + - -     - + Utilisateur + ring)";} + echo "  Campagne:: $VD_campaign  \n"; + ?> +     + 0) {echo "TERRITORIES     \n";} ?> 0) {echo "GROUPS     \n";} ?> DÉCONNEXION\n"; ?> -
+
- height=30> - - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Appel en cours
+ + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Appel en cours
- height=>

Agent Screen
+

Agent Screen
- id="MainTable"> - - - - - - -
STATUT:
+ + + + - +
+
\n"; + } + ?> + + STATUT:
- Appel Numéro Suivant
- Prévisualisation
- APPEL NUM. 2nd.
+ Appel Numéro Suivant
+ + + Prévisualisation
+ APPEL NUM. 2nd.
- ENREGISTREMENT:
+ ENREGISTREMENT:
-
- IDENTIFIANT:
+
+ IDENTIFIANT:
- Enregistrer
-
- Formulaire Web
+ Enregistrer
+
+ Formulaire Web
0) - {echo "\"Formulaire
\n";} + {echo "\"Formulaire
\n";} ?> -
- Mettre en Attente
- Transfert - Conférence
+  
+ Mettre en Attente
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Transfert - Conférence
0) - {echo "\"Quick
\n";} + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Transfert
\n";} ?> 0) - {echo "
\n";} + {echo "
\n";} ?> -
- Raccrocher
-
-
Envoyez DTMF

+
+ Raccrocher
+
+
Envoyez DTMF

align=left valign=top> - - - - - - - - - - - - + + + + + + + + + + + + + + - - - +
  Customer Time:                         Canal:
+ + - - -
  temps à la clientèle:                         Canal:
Informations Client:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + -
Titre:   Prenom:   Mi:  Nom:
Adresse1:
Adresse2: Adresse3:
Ville: État: CodePostal:
Province: CodeVendeur: Sexe:
Téléphone: -                     "; - echo ""; - } - else - { - echo ""; - } - ?> - - DialCode: Tel. 2nd:
Visualiser: Email:
Commentaires: - + Informations Client:         \n";} + if ($agent_lead_search == 'ENABLED') + {echo "LEAD RECHERCHE";} + ?> +
+ + + -
+ ";} else - {echo "\n";} + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Notes d'appel: "; + if ($agent_call_log_view == '1') + {echo "
visualiser les notes ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + ?>
+
+
> +
 
+
 
+
+
+ -APPEL MANUEL       CADRAN RAPIDE
-
- - -X RAPPELS EN COURS
+APPEL MANUEL       CADRAN RAPIDE
-
+
-VIEW APPEL LOG
+VOIR JOURNAL DES APPELS
- - >
Agent web-client version:     BUILD:               Serveur:              
+ +     + - - + - +
VERSION:   BUILD:     Serveur:              
Montrez les informations sur la conférence -

 
+

 
+
0) ) {echo "Alert is ON";} else {echo "Alert is OFF";} ?> -
+
- -
+ +
0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -RACCOURCIS INACTIFS +RACCOURCIS INACTIFS - secondes: -     + secondes: +     -
+
-Votre Statut:
Calls Dialing: +Votre Statut:
Calls Dialing:
- + D1 - COMPOSER\n"; - echo "
\n"; + echo "   \n"; echo "D2 - COMPOSER\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
-
 Appels en attente:  
 
+
 Appels en attente:  
 
- + 0) { @@ -11202,20 +13161,35 @@ if ($view_calls_in_queue > 0) ?> -
  -Autres agents Etat:  
 
+ +X RAPPELS EN COURS
+
-
  -Web Téléphone:  
+
  +Autres agents Etat:  
 
-
Agents View +
+$webphone_content
\n"; + } +else + { + echo "
  + Web Téléphone:  
$webphone_content
\n"; + } +?> + + +
Agents Voir +
-
  WebTéléphone View -
+
  WebTéléphone View -
0) { - echo "Dialable Leads:
 \n"; + echo "Leads composable:
 \n"; } ?>
- - height=>
AGENT SCRIPT
+ +
\n";} + ?> +
AGENT SCRIPT
- + refresh + +
\n";} + ?> +
+
+ + +refresh + + - > - -
+ + + -
- Transfert - Conférence            
+ Transfert - Conférence            
- - -
- + + + - - + CLOSER LOCAL     + + + - - + - - - + channel + + + + - - + - - - + +                     + +   + + AGENTS + + + + + + + - - + - + Blind Transfer VMail Message + + -
+ - CLOSER LOCAL     - - Raccrocher la ligne transférée -
+ Raccrocher la ligne transférée +
- seconds +
+ seconds   - channel - - CONSULTATIF   - - Raccrocher les deux lignes -
+ CONSULTATIF   + + Raccrocher les deux lignes +
- Numéro à appeler +
+ Numéro à appeler   -   - AGENTS - - - SURNUMEROTATION - - QUITTER LA CONF A 3 -
+ SURNUMEROTATION + + QUITTER LA CONF A 3 +
- Transfert immédiat +
+ Transfert immédiat   - Appel Client + Appel Client   - Mettre en Attente + Mettre en Attente   - - D1 - D2 - D3 - D4 - D5 - + + Boutons prédéfinis + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + +   - Blind Transfer VMail Message -
+
+
-
-Transfert des agents disponibles:
+
+Transfert des agents disponibles:
- height=70> - -
Fiche Prospect Statuée en:

- -
-
+ + +
Fiche Prospect Statuée en:

+ -
+
- height=70> - +
Raccourcis clavier des Statut: + + - - + - + -
Raccourcis clavier des Statut: Si actif, utilisez le raccourci clavier pour statuer et raccrocher un appel:
+ - + - + -
+
- height=70> - - - +
Information De Rappels: close
+ + + - - + -
Information De Rappels: close
-
-
-
-
+ +
+
+
+
-
+
- height=70> - - - +
Extended Information Alt Téléphone: réduire
+ + + - - + -
Extended Information Alt Téléphone: réduire
-
-
-
-
+
+
+
+
+
-
+
- - - -
agrandir
Alt Téléphone Info
+ + + +
agrandir
Alt Téléphone Info
- height=>
No one is in your session:
+
Votre session est vide:
Retour -

+

Rappeler l'agent -
+
- height=>
Le client a raccroché:
+
Le client a raccroché:
Retour -

+

Terminer et Statuer l'Appel -
+
- height=>
Traitement Post Appel : secondes restant pour le traitement post appel

+
Traitement Post Appel : secondes restant pour le traitement post appel

-

+

Terminer le traitement post appel et continuer -
+
-
-


+
+


Fermer Message -
+
- height=>
Votre session a été neutralisée
DÉCONNEXION

Retour -
+
Votre session a été neutralisée
DÉCONNEXION

Retour +
- height=>
Il ya un problème de synchronisation avec votre système, s'il vous plaît dites-le à votre administrateur système


Retour -
+
Il ya un problème de synchronisation avec votre système, s'il vous plaît dites-le à votre administrateur système


Retour +
- height=>

DÉCONNEXION
+

DÉCONNEXION
-
+
-
 
+
 
- height=47>
Aucune modification ne peut être prise en compte, les modifications doivent être validées avant de raccrocher.
+
Aucune modification ne peut être prise en compte, les modifications doivent être validées avant de raccrocher.
- height=>
STATUER L'APPEL :       Décrochement Encore       réduire
+
STATUER L'APPEL :       Décrochement Encore       réduire
+
\n";} + ?> + + + Selection du status de fin d'appel -
- PAUSE DE LA NUMEROTATION
+
+ PAUSE DE LA NUMEROTATION
EFFACER LE FORMULAIRE | VALIDER -

+

WEB FORM VALIDER -

  -
+

  +
- height=>
Choisissez une date de Rappel :
- - +
Choisissez une date de Rappel :
+
\n";} + ?> + + Choisissez une date ci-dessous       Hour: - @@ -11480,7 +13518,7 @@ Transfert des agents disponibles: 12   Minutes: - @@ -11495,150 +13533,372 @@ Transfert des agents disponibles: 55   - -  
+  
RAPPELS PERSONNELS
";} + {echo " RAPPELS PERSONNELS
";} ?> - Commentaires du Rappel:

+ Commentaires du Rappel:

- VALIDER

+ VALIDER

-

  -
+

  +
- height=>
RAPPELS PERSONNELS :
Selectionnez un rappel a éffectuer immédiatement. Une fois éffectué, ce rappel diparaitra de la liste. -
+
RAPPELS PERSONNELS :
Pour voir les informations sur l'un des rappels ci-dessous, cliquez sur le lien INFO. Pour appeler le client en arrière maintenant, cliquez sur le lien COMPOSER. Si vous cliquez sur un enregistrement ci-dessous pour composer le numéro, il sera retiré de la liste. +
+
\n";} + ?>
-
  +
  Rafraichir                 - Retour -
+ Retour +
- height=>
NOUVEL APPEL MANUEL VERS :

Nouveau prospect: remplissez le formulaire ci dessous. -
+
NOUVEL APPEL MANUEL VERS :

Nouveau prospect: remplissez le formulaire ci dessous. +
\n"; + echo "Note : préfixe : $manual_dial_prefix servira de préfixe à ce nombre
\n"; } ?> - Note: all new manual dial leads will go into list

- - - + Note: all new manual dial leads will go into list

+
Code d'Appel:   (La valeur de ce champ est habituellement 1 aux Etats-Unis et au Canada)
+ + - - + - - + + - +

Si vous désirez composer un numéro sans insérer de nouvelle fiche client, entrez le N° a appeler dans le champ Surnumerotation. Pour raccrocher cet appel, vous devrez ouvrir la page Appels en Cours et raccrocher manuellement le canal correspondant.
  - - + -
Code d'Appel:   (La valeur de ce champ est habituellement 1 aux Etats-Unis et au Canada)
Téléphone Number: -   (12 digits max - digits only) + Téléphone Number: +   (digits only) + + +
Rechercher dans les fiches client existantes:   (Si cette option est activée, le numéro de téléphone sera recherché dans la base avant d'être inséré) Rechercher dans les fiches client existantes:   (Si cette option est activée, le numéro de téléphone sera recherché dans la base avant d'être inséré)
-

+
+

   
-

Si vous désirez composer un numéro sans insérer de nouvelle fiche client, entrez le N° a appeler dans le champ Surnumerotation. Pour raccrocher cet appel, vous devrez ouvrir la page Appels en Cours et raccrocher manuellement le canal correspondant.
 
Surnumérotation:   (Ce champ n'accepte que des chiffres) + Surnumérotation:   (Ce champ n'accepte que des chiffres)
-
+
+
Appel Manuel                 Preview Call                 - Retour -
+ Retour +
- height=>
UN CHOIX DE GROUPE D'ARRIVÉE PLUS ÉTROIT
+
UN CHOIX DE GROUPE D'ARRIVÉE PLUS ÉTROIT
+
\n";} + ?> Un Choix De Groupe D'arrivée Plus étroit -
+
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - APPEL EN MODE BLENDED(Mode "Appels Sortants" Activé)
+ APPEL EN MODE BLENDED(Mode "Appels Sortants" Activé)
REINITIALISATION | VALIDER -



  -
+



  +
- height=>
TERRITORY SELECTION
+
SÉLECTION DU TERRITOIRE
+
\n";} + ?> Territory Selection -
+
REINITIALISATION | VALIDER -



  -
+



  +
- Canal Canal RAPPELS PERSONNELS
";} + {echo " RAPPELS PERSONNELS
";} if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) - {echo " APPEL EN MODE BLENDED
";} + {echo " APPEL EN MODE BLENDED
";} ?>
- height=>
AGENT APPEL LOG:
+
      AGENT APPEL LOG:             close [X]
+
\n";} + ?>
Call log List
-

  -
+

  +
+
+ + +
      Rechercher un contact:             close [X]
+
\n";} + ?> +

+ Notes:lorsque vous faites une recherche pour un contact, des termes de recherche génériques ou partielle ne sont pas autorisés.
Demandes de recherche de contact sont tous enregistrés dans le système de. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Prenom Name:
Nom Name:
BU Name:
Department:
Group Name:
Job Titre:
Location:

VALIDER SEARCH             réinitialiser la forme
+

  +
+
+ + +
      RÉSULTATS DE RECHERCHE CONTACTS:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      RECHERCHE D'UN PLOMB:             close [X]
+
\n";} + ?> +

+ Notes:lorsque vous faites une recherche d'un chef de file, le numéro de téléphone, conduire ou ID sont les meilleurs champs à utiliser.
En utilisant les champs d'autres peut être plus lente. Recherche de plomb ne permet pas de termes de recherche génériques ou partielle.
Demandes de recherche de plomb sont tous enregistrés dans le système de. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Téléphone Number:
Téléphone Number Fields: + Numéro de téléphone principal + Autre numéro de téléphone + Adresse3 numéro de téléphone +
Lead ID:
:
:
:
:
:
:

VALIDER SEARCH             réinitialiser la forme
+

  +
+
+ + +
      RÉSULTATS DE RECHERCHE:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      NOTES D'APPEL LOG:             close [X]
+
\n";} + ?> +
Appelez liste de notes
+

  + Info Box Fermer +
- height=>
Informations Client:
+
      Informations Client:             close [X] +
+
\n";} + ?> Lead Info -

  -
+

  + Info Box Fermer +
- height=>
CHOISISSEZ Un CODE De PAUSE :
+
CHOISISSEZ Un CODE De PAUSE :
+
\n";} + ?> Pause Code Selection - -

  -
+ +

  +
+
+ + +
Sélectionnez un Preset :
+
\n";} + ?> + Presets Selection + +
- height=>
CHOISIR UN GROUPE ALIAS :
+
CHOISIR UN GROUPE ALIAS :
+
\n";} + ?> Groupe de sélection Alias - -

  -
+ +

  +
- + +
ALERT :
+     +

Retour +
+
- - + + + + + +
+ + + + + + +
+ +
+ + + + + +
+   Agent Alert! +
+ + + + + + +
  +

+alert +
  +

+ + Alert Box + +

+
+ +
  + +
+
+
+ +
+ @@ -11647,26 +13907,4 @@ Transfert des agents disponibles: 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } - $one_mysql_log=0; - return $errno; - } - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_fr/voicemail_check.php b/agc_2-X/trunk/LANG_www/agc_fr/voicemail_check.php index 38fa7f95..355a9871 100644 --- a/agc_2-X/trunk/LANG_www/agc_fr/voicemail_check.php +++ b/agc_2-X/trunk/LANG_www/agc_fr/voicemail_check.php @@ -62,7 +62,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n"; + echo "Invalide Username/Mot de passe: |$user|$pass|\n"; exit; } else diff --git a/agc_2-X/trunk/LANG_www/agc_it/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_it/astguiclient.php index 547ed6c6..24376772 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_it/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_it/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_it/conf_exten_check.php index 358626fb..6b15ebdc 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_it/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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 @@ -54,12 +54,13 @@ # 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination # 101123-1105 - Added api manual dial queue feature to external_dial function # 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.4-29'; -$build = '101208-0308'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=36; +$mysql_log_count=38; $one_mysql_log=0; $DB=0; @@ -112,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -149,7 +155,6 @@ if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) } else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n"; @@ -176,30 +181,29 @@ else } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Conf Extension Check"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conf Extension Check"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten non è valido\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -321,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -374,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -636,6 +658,11 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Stato: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; @@ -678,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten non è valido or Exten $exten non è valido\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Conferenza $conf_exten è stato registrato su $exten\n"; + echo "Conferenza $conf_exten è stato registrato su $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_it/css/custom.css b/agc_2-X/trunk/LANG_www/agc_it/css/custom.css deleted file mode 100644 index 8d1c8b69..00000000 --- a/agc_2-X/trunk/LANG_www/agc_it/css/custom.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/agc_2-X/trunk/LANG_www/agc_it/css/style.css b/agc_2-X/trunk/LANG_www/agc_it/css/style.css deleted file mode 100644 index 2e30a009..00000000 --- a/agc_2-X/trunk/LANG_www/agc_it/css/style.css +++ /dev/null @@ -1,26 +0,0 @@ -/* /!\ DO NOT EDIT THIS FILE !!! Please edit custom.css to keep your customizations after an upgrade /!\ */ - -body { padding:0; margin:0; background: #FFF; } - -div.scroll_list { height: 400px; width: 140px; overflow: scroll; } -div.text_input { overflow: auto; font-size: 10px; font-family: sans-serif; } -.body_text { font-size: 13px; font-family: sans-serif; } -.queue_text_red { font-size: 12px; font-family: sans-serif; font-weight: bold; color: red; } -.queue_text { font-size: 12px; font-family: sans-serif; color: black; text-decoration:none; } -.preview_text { font-size: 13px; font-family: sans-serif; background: #CCFFCC; } -.preview_text_red { font-size: 13px; font-family: sans-serif; background: #FFCCCC; } -.body_small { font-size: 11px; font-family: sans-serif; } -.body_small_bold { font-size: 11px; font-family: sans-serif; font-weight: bold; } -.body_tiny { font-size: 10px; font-family: sans-serif; } -.log_text { font-size: 11px; font-family: monospace; } -.log_text_red { font-size: 11px; font-family: monospace; font-weight: bold; background: #FF3333; } -.log_title { font-size: 12px; font-family: monospace; font-weight: bold; } -.sd_text { font-size: 16px; font-family: sans-serif; font-weight: bold; } -.sh_text { font-size: 14px; font-family: sans-serif; font-weight: bold; } -.sb_text { font-size: 12px; font-family: sans-serif; } -.sk_text { font-size: 11px; font-family: sans-serif; } -.skb_text { font-size: 13px; font-family: sans-serif; font-weight: bold; } -.ON_conf { font-size: 11px; font-family: monospace; color: black; background: #FFFF99; } -.OFF_conf { font-size: 11px; font-family: monospace; color: black; background: #FFCC77; } -.cust_form { font-family: sans-serif; font-size: 10px; overflow: hidden; } -.cust_form_text { font-family: sans-serif; font-size: 10px; overflow: auto; } diff --git a/agc_2-X/trunk/LANG_www/agc_it/functions.php b/agc_2-X/trunk/LANG_www/agc_it/functions.php index 12fd19a6..cc866913 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/functions.php +++ b/agc_2-X/trunk/LANG_www/agc_it/functions.php @@ -4,16 +4,19 @@ # # functions for agent scripts # -# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # # CHANGES: # 100629-1201 - First Build # 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change # - ##### BEGIN gather values for display of custom list fields for a lead ##### function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) { @@ -71,7 +74,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $A_field_order[$o] = $rowx[15]; $A_field_value[$o] = ''; - if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + if (!preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) { if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) { @@ -116,7 +119,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $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)) + if (preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) {$A_field_value[$o] = '--A--' . $A_field_label[$o] . '--B--';} $o++; } @@ -152,7 +155,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) {$CFoutput .= "right";} $CFoutput .= ">"; } - if ($A_field_type[$o]!='SCRIPT') + if ( ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) {$CFoutput .= "$A_field_name[$o]";} if ( ($A_name_position[$o]=='TOP') or ($A_field_type[$o]=='SCRIPT') ) {$CFoutput .= "   $helpHTML
";} @@ -239,6 +242,18 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} $field_HTML .= "$A_field_default[$o]\n"; } + if ($A_field_type[$o]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\n"; + } if ($A_field_type[$o]=='SCRIPT') { if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} @@ -317,7 +332,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $field_HTML .= ""; } - if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') ) + if ( ($A_name_position[$o]=='LEFT') and ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) { $CFoutput .= " $field_HTML $helpHTML"; } @@ -476,6 +491,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_id",$CFoutput); # custom fields replacement $o=0; diff --git a/agc_2-X/trunk/LANG_www/agc_it/manager_send.php b/agc_2-X/trunk/LANG_www/agc_it/manager_send.php index f79eb4f8..bb0a5eb3 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_it/manager_send.php @@ -45,6 +45,7 @@ # - $preset_name = ('TESTING PRESET',...) # - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') # - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -107,10 +108,10 @@ # 101107-2331 - Added CALLERONHOLD/CALLEROFFHOLD queue_log entries # 101125-1018 - Added call_variables Originate variables # 110224-1710 - Added compatibility with QM phone environment logging -# +# 110626-2320 - Added qm_extension -$version = '2.4-55'; -$build = '110224-1710'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=116; $one_mysql_log=0; @@ -206,6 +207,8 @@ if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"]; elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} header ("Content-type: text/html; charset=utf-8"); @@ -426,7 +429,7 @@ if ($ACTION=="OriginateVDRelogin") if ($ACTION=="Originate") { - if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or ( (strlen($queryCID)<10) && ($alertCID < 1) ) ) + if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or ( (strlen($queryCID)<10) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten non è valido or queryCID $queryCID non è valido, Originate comando non inserito\n"; } @@ -634,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -649,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -732,7 +736,10 @@ if ($ACTION=="Hangup") if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } if ($format=='debug') {echo "\n";} @@ -1433,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel non è attivo su $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1617,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1636,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1650,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel non è attivo su $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { diff --git a/agc_2-X/trunk/LANG_www/agc_it/phone_only.php b/agc_2-X/trunk/LANG_www/agc_it/phone_only.php new file mode 100644 index 00000000..d78779a1 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_it/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Ora non sei collegato. Grazie\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST su server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link su the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location su the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefono web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Orologio
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\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 "\n"; + echo "
\"VICIdial\" Telefono-Only Login
 
Login Telefono:
Password Telefono:
Login Utente:
Password Utente:
  \n"; + echo "

VERSIONE: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefono web client: Login Telefono\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Orologio
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefono-Only Login
 
Login Telefono:
Password Telefono:
  \n"; + echo "

VERSIONE: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login errato, prova di nuovo
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefono web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Orologio
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefono-Only Login
 
Login Utente:
Password Utente:
  \n"; + echo "

VERSIONE: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefono web client: Login Telefono Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Orologio
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Italiano
\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 "
\"VICIdial\" Telefono-Only Login Error
 
Spiacente, il telefono inserito non è attivo in questo sistema, riprova di nuovo:
 
Login Telefono:
Password Telefono:

VERSIONE: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ### go through the entered phones to figure out which server has fewest agents + ### logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + while($pb < $phones_auto_ct) + { + ### find the server_ip of each phone_login + $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; + if ($DB) {echo "|$stmtx|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmtx, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefono 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call secondi counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - secondi su call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefono: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefono:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_it/timeclock.php b/agc_2-X/trunk/LANG_www/agc_it/timeclock.php index bceeb45a..641145c3 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_it/timeclock.php @@ -266,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Ora avete registrati"; + $LOGtimeMESSAGE = "Si è connessi a $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; diff --git a/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php index 5ec1a2f6..54510095 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -90,6 +90,10 @@ # - $date - ('2010-02-19') # - $custom_field_names - ('|start_date|finish_date|favorite_color|') # - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -281,12 +285,31 @@ # 110310-0546 - Added ability to set a pause code at the same time of a pause # 110310-1628 - removed callslogview, extended lead info function to be used instead # 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.4-186'; -$build = '110317-0222'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=413; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); @@ -483,6 +506,24 @@ if (isset($_GET["search"])) {$search=$_GET["search"];} elseif (isset($_POST["search"])) {$search=$_POST["search"];} if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -501,6 +542,43 @@ $US='_'; while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} $check_time = ($StarTtime - 86400); +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + ##### Hangup Cause Dictionary ##### $hangup_cause_dictionary = array( 0 => "Unspecified. No other cause codes applicable.", @@ -557,7 +635,7 @@ $hangup_cause_dictionary = array( ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -568,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -586,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -900,7 +985,7 @@ if ($ACTION == 'regCLOSER') ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_addmember_enabled,queuemetrics_dispo_pause FROM system_settings;"; + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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";} @@ -917,6 +1002,7 @@ if ($ACTION == 'regCLOSER') $queuemetrics_log_id = $row[5]; $queuemetrics_addmember_enabled = $row[6]; $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -935,7 +1021,7 @@ if ($ACTION == 'regCLOSER') { if (strlen($in_groups[$k])>1) { - $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $stmt="SELECT group_weight,calls_today,group_grade FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00013',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -943,15 +1029,17 @@ if ($ACTION == 'regCLOSER') if ($viga_ct > 0) { $row=mysql_fetch_row($rslt); - $group_weight = $row[0]; + $group_weight = $row[0]; $calls_today = $row[1]; + $group_grade = $row[2]; } else { $group_weight = 0; $calls_today = 0; + $group_grade = 1; } - $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME',group_grade='$group_grade';"; 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);} @@ -967,7 +1055,10 @@ if ($ACTION == 'regCLOSER') if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $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' $data4SQL;"; @@ -1255,27 +1346,6 @@ if ($ACTION == 'manDiaLnextCaLL') $inSD = $pulldate0; $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); - ### Grab Server GMT value from the database - $stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; - $rslt=mysql_query($stmt, $link); - $gmt_recs = mysql_num_rows($rslt); - if ($gmt_recs > 0) - { - $row=mysql_fetch_row($rslt); - $DBSERVER_GMT = $row[0]; - if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} - if ($isdst) {$SERVER_GMT++;} - } - else - { - $SERVER_GMT = date("O"); - $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); - $SERVER_GMT = ($SERVER_GMT + 0); - $SERVER_GMT = ($SERVER_GMT / 100); - } - - $LOCAL_GMT_OFF = $SERVER_GMT; - $LOCAL_GMT_OFF_STD = $SERVER_GMT; $postalgmt=''; $postal_code=''; $state=''; @@ -1296,6 +1366,7 @@ if ($ACTION == 'manDiaLnextCaLL') } ### get current gmt_offset of the phone_number + $USarea = substr($phone_number, 0, 3); $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); $dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state); @@ -1488,7 +1559,7 @@ if ($ACTION == 'manDiaLnextCaLL') else { ##### gather no hopper dialing settings from campaign - $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary,call_count_limit FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00236',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1505,6 +1576,7 @@ if ($ACTION == 'manDiaLnextCaLL') $lead_order = $row[6]; $lead_order_randomize = $row[7]; $lead_order_secondary = $row[8]; + $call_count_limit = $row[9]; } if (eregi("N",$no_hopper_dialing)) { @@ -1841,6 +1913,12 @@ if ($ACTION == 'manDiaLnextCaLL') $DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )"; } + $CCLsql=''; + if ($call_count_limit > 0) + { + $CCLsql = "and (called_count < $call_count_limit)"; + } + $stmt="SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00239',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1964,7 +2042,7 @@ if ($ACTION == 'manDiaLnextCaLL') if (eregi("UP TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now desc, $last_order";} if (eregi("DOWN TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now, $last_order";} - $stmt="UPDATE vicidial_list SET status='QUEUE',user='$user' where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; + $stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and user NOT LIKE \"QUEUE%\" and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00242',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1976,7 +2054,7 @@ if ($ACTION == 'manDiaLnextCaLL') if ($affected_rows > 0) { - $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;"; + $stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id,vendor_lead_code FROM vicidial_list where user='QUEUE$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";} @@ -1989,8 +2067,9 @@ if ($ACTION == 'manDiaLnextCaLL') $gmt_offset_now = $row[2]; $state = $row[3]; $entry_list_id = $row[4]; + $vendor_lead_code = $row[5]; - $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';"; + $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -2075,6 +2154,72 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($agent_dialed_type) < 3) {$agent_dialed_type = 'MAIN';} } + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + if ($agent_dialed_type=='ALT') + {$agent_dialed_number = $alt_phone;} + if ($agent_dialed_type=='ADDR3') + {$agent_dialed_number = $address3;} + } + + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00414',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $row=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $row[0]; + $local_call_time = $row[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($agent_dialed_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefono and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefono Area Code Fuori Zona componibili $PHONEgmt_offset ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " CAP Fuori Zona componibili $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefono Area Code Fuori Zona componibili $PHONEgmt_offset ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " CAP Fuori Zona componibili $POSTgmt_offset ";} + } + } + ##### END check for postal_code and phone time zones if alert enabled + ##### check if system is set to generate logfile for transfers $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; @@ -2093,7 +2238,7 @@ if ($ACTION == 'manDiaLnextCaLL') # generate callerID for unique identifier in xfer_log file $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 + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; # DATETIME|campaign|lead_id|phone_number|user|type @@ -2192,7 +2337,12 @@ if ($ACTION == 'manDiaLnextCaLL') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00032',$user,$server_ip,$session_name,$one_mysql_log);} - + + $stmt="UPDATE vicidial_lists set list_lastcalldate=NOW() where list_id='$list_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);} + $campaign_cid_override=''; $LISTweb_form_address=''; $LISTweb_form_address_two=''; @@ -2231,7 +2381,7 @@ 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';"; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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";} @@ -2240,13 +2390,32 @@ if ($ACTION == 'manDiaLnextCaLL') { $row=mysql_fetch_row($rslt); $use_custom_cid = $row[0]; - } - if ($use_custom_cid > 0) - { - $temp_CID = preg_replace("/\D/",'',$security); + if ($use_custom_cid == 'AREACODE') + { + $temp_ac = substr("$agent_dialed_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00426',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00427',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$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("%010s", $lead_id); @@ -2265,7 +2434,7 @@ if ($ACTION == 'manDiaLnextCaLL') $use_eac = $row[0]; } - # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; $EAC=''; if ($use_eac > 0) @@ -2368,7 +2537,7 @@ if ($ACTION == 'manDiaLnextCaLL') ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00037',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2382,6 +2551,7 @@ if ($ACTION == 'manDiaLnextCaLL') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -2396,7 +2566,10 @@ if ($ACTION == 'manDiaLnextCaLL') if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); @@ -2460,7 +2633,7 @@ if ($ACTION == 'manDiaLnextCaLL') $VDCL_xferconf_c_number=''; $VDCL_xferconf_d_number=''; $VDCL_xferconf_e_number=''; - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00277',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2477,7 +2650,7 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2596,6 +2769,7 @@ if ($ACTION == 'manDiaLnextCaLL') $LeaD_InfO .= $custom_field_types . "\n"; $LeaD_InfO .= $LISTweb_form_address . "\n"; $LeaD_InfO .= $LISTweb_form_address_two . "\n"; + $LeaD_InfO .= $post_phone_time_diff_alert_message . "\n"; echo $LeaD_InfO; } @@ -2682,12 +2856,17 @@ if ($ACTION == 'manDiaLskip') else { $called_count = ($called_count - 1); - ### flag the lead as called and change it's status to INCALL + ### set the lead back to previous status and called_count $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00042',$user,$server_ip,$session_name,$one_mysql_log);} + ### log the skip event + $stmt = "INSERT INTO vicidial_agent_skip_log set campaign_id='$campaign', previous_status='$stage', previous_called_count='$called_count',user='$user', lead_id='$lead_id', event_date=NOW();"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00419',$user,$server_ip,$session_name,$one_mysql_log);} echo "LEAD REVERTED\n"; } @@ -2712,6 +2891,20 @@ if ($ACTION == 'manDiaLonly') } else { + ##### clear out last call to same lead if exists ##### + if (strlen($old_CID) > 16) + { + $old_lead_id = substr($old_CID, -10); + $old_lead_id = ($old_lead_id + 0); + if ($lead_id == "$old_lead_id") + { + $stmt="DELETE FROM vicidial_auto_calls where callerid='$old_CID' and lead_id='$old_lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00428',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); @@ -2790,7 +2983,7 @@ 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';"; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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";} @@ -2799,10 +2992,28 @@ if ($ACTION == 'manDiaLonly') { $row=mysql_fetch_row($rslt); $use_custom_cid = $row[0]; - } - if ($use_custom_cid > 0) - { - $temp_CID = preg_replace("/\D/",'',$security); + if ($use_custom_cid == 'AREACODE') + { + $temp_ac = substr("$phone_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00429',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00430',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$temp_CID = preg_replace("/\D/",'',$security);} if (strlen($temp_CID) > 6) {$CCID = "$temp_CID"; $CCID_on++;} } @@ -2810,7 +3021,7 @@ if ($ACTION == 'manDiaLonly') $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 + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; $EAC=''; if ($use_eac > 0) @@ -2966,7 +3177,7 @@ if ($ACTION == 'manDiaLonly') ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00048',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2980,6 +3191,7 @@ if ($ACTION == 'manDiaLonly') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -2994,7 +3206,10 @@ if ($ACTION == 'manDiaLonly') if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); @@ -3113,7 +3328,7 @@ if ($ACTION == 'manDiaLlookCaLL') { $wait_sec=0; $dead_epochSQL = ''; - $stmt = "select wait_epoch,wait_sec,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec,dead_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,'00053',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3394,7 +3609,7 @@ if ($stage == "end") ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### - $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_dispo_pause FROM system_settings;"; + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00063',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3410,6 +3625,7 @@ if ($stage == "end") $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_dispo_pause = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; if ($enable_queuemetrics_logging > 0) { @@ -3461,7 +3677,7 @@ if ($stage == "end") if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)",$auto_alt_dial)) ) { $alt_dial_skip=0; - $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT alt_phone,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00065',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3473,6 +3689,7 @@ if ($stage == "end") $alt_phone = eregi_replace("[^0-9]","",$alt_phone); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$alt_phone = '';} if (strlen($alt_phone)>5) @@ -3521,7 +3738,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',source='A';"; + $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -3538,7 +3755,7 @@ if ($stage == "end") if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) { $addr3_dial_skip=0; - $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT address3,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00069',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3550,6 +3767,7 @@ if ($stage == "end") $address3 = eregi_replace("[^0-9]","",$address3); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$address3 = '';} if (strlen($address3)>5) @@ -3598,7 +3816,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',source='A';"; + $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -3625,7 +3843,7 @@ if ($stage == "end") {$Xlast=0;} $VD_altdialx=''; - $stmt="SELECT gmt_offset_now,state,list_id,entry_list_id FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT gmt_offset_now,state,list_id,entry_list_id,vendor_lead_code 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";} @@ -3637,6 +3855,7 @@ if ($stage == "end") $EA_state = $row[1]; $EA_list_id = $row[2]; $EA_entry_list_id = $row[3]; + $EA_vendor_lead_code = $row[4]; } $alt_dial_phones_count=0; $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; @@ -3714,7 +3933,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',source='A';"; + $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',vendor_lead_code='$EA_vendor_lead_code';"; 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);} @@ -3782,7 +4001,10 @@ if ($stage == "end") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00081',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $licf_SQL = ''; + if ($VLA_inOUT == 'INBOUND') + {$licf_SQL = ",last_inbound_call_finish='$NOW_TIME'";} + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' $licf_SQL where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00082',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3810,7 +4032,10 @@ if ($stage == "end") if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; @@ -3860,7 +4085,10 @@ if ($stage == "end") if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; @@ -4084,7 +4312,10 @@ if ($stage == "end") if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$VDqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; @@ -4283,7 +4514,7 @@ if ($stage == "end") $dead_secSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_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,'00101',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4577,7 +4808,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### update the log status to INCALL $user_group=''; - $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $stmt="SELECT user_group,full_name FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -4586,6 +4817,7 @@ if ($ACTION == 'VDADcheckINCOMING') { $row=mysql_fetch_row($rslt); $user_group = trim("$row[0]"); + $fullname = $row[1]; } $stmt = "SELECT campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; @@ -4725,7 +4957,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00281',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4798,7 +5030,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + $stmt = "SELECT count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00118',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4822,7 +5054,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,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination 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);} @@ -4857,7 +5089,7 @@ if ($ACTION == 'VDADcheckINCOMING') $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,timer_action_destination 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);} @@ -4912,7 +5144,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00188',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4925,7 +5157,7 @@ if ($ACTION == 'VDADcheckINCOMING') if (strlen($VDCL_group_web_vars) < 1) { - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00189',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4938,7 +5170,7 @@ if ($ACTION == 'VDADcheckINCOMING') } ### update the comments in vicidial_live_agents record - $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND',last_inbound_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00120',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4947,7 +5179,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,timer_action_destination 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);} @@ -4986,7 +5218,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00190',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5001,7 +5233,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_caller_id_number=''; if (strlen($VDCL_default_group_alias)>1) { - $stmt = "select caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; + $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00187',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5016,7 +5248,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00282',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5216,7 +5448,7 @@ if ($ACTION == 'VDADcheckINCOMING') $wait_sec=0; $StarTtime = date("U"); - $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00123',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5291,7 +5523,7 @@ if ($ACTION == 'VDADcheckINCOMING') { if (eregi('--A--user_custom_',$VDCL_start_call_url)) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five 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,'00283',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5376,6 +5608,7 @@ if ($ACTION == 'VDADcheckINCOMING') $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); + $VDCL_start_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($callerid)),$VDCL_start_call_url); if (strlen($custom_field_names)>2) { @@ -5397,7 +5630,7 @@ if ($ACTION == 'VDADcheckINCOMING') $o=0; while ($custom_field_names_ct > $o) { - $form_field_value = trim("$row[$o]"); + $form_field_value = urlencode(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); @@ -5406,10 +5639,42 @@ if ($ACTION == 'VDADcheckINCOMING') } } + $stmt="UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00420',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$VDCL_start_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='start',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00421',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### grab the call_start_url ### if ($DB > 0) {echo "$VDCL_start_call_url
\n";} $SCUfile = file("$VDCL_start_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00422',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + ##### 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;"; @@ -5601,14 +5866,14 @@ if ($ACTION == 'userLOGout') $vla_delete = mysql_affected_rows($link); ##### Delete the vicidial_live_inbound_agents records for this session - $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + $stmt="DELETE from vicidial_live_inbound_agents where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00131',$user,$server_ip,$session_name,$one_mysql_log);} $vlia_delete = mysql_affected_rows($link); $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00136',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5629,7 +5894,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,queuemetrics_loginout,queuemetrics_addmember_enabled,queuemetrics_dispo_pause 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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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";} @@ -5647,6 +5912,7 @@ if ($ACTION == 'userLOGout') $queuemetrics_loginout = $row[7]; $queuemetrics_addmember_enabled = $row[8]; $queuemetrics_dispo_pause = $row[9]; + $queuemetrics_pe_phone_append = $row[10]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -5676,7 +5942,6 @@ if ($ACTION == 'userLOGout') $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00139',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - echo "$stmt\n"; $li_conf_ct = mysql_num_rows($rslt); $i=0; while ($i < $li_conf_ct) @@ -5696,7 +5961,10 @@ if ($ACTION == 'userLOGout') if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $time_logged_in = ($StarTtime - $logintime); @@ -5739,7 +6007,6 @@ if ($ACTION == 'userLOGout') $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) @@ -6040,7 +6307,7 @@ if ($ACTION == 'updateDISPO') $insert_into_dnc=0; if ( ($use_internal_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6053,7 +6320,7 @@ if ($ACTION == 'updateDISPO') } if ( ($use_campaign_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6070,7 +6337,7 @@ if ($ACTION == 'updateDISPO') $dispo_epochSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; + $stmt = "SELECT dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00150',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6197,7 +6464,7 @@ if ($ACTION == 'updateDISPO') if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) ) { - $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + $stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00156',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6330,7 +6597,7 @@ if ($ACTION == 'updateDISPO') if ( (ereg('ACCTID',$vtiger_search_category)) or (ereg('ACCOUNT',$vtiger_search_category)) ) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6342,7 +6609,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6686,7 +6953,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,queuemetrics_callstatus,queuemetrics_dispo_pause FROM system_settings;"; + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_callstatus,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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";} @@ -6702,6 +6969,7 @@ if ($ACTION == 'updateDISPO') $queuemetrics_log_id = $row[5]; $queuemetrics_callstatus = $row[6]; $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -6712,8 +6980,10 @@ if ($ACTION == 'updateDISPO') if (strlen($stage) < 2) {$stage = $campaign;} - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id';"; + $qm_dispo_codeSQL=''; + if (strlen($qm_dispo_code) > 0) + {$qm_dispo_codeSQL = ",data3='$qm_dispo_code'";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id' $qm_dispo_codeSQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00160',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6725,7 +6995,6 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00409',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - echo "$stmt\n"; $comp_ct = mysql_num_rows($rslt); if ($comp_ct > 0) { @@ -6746,7 +7015,6 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00410',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - echo "$stmt\n"; $connect_ct = mysql_num_rows($rslt); if ($connect_ct > 0) { @@ -6760,7 +7028,6 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00411',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - echo "$stmt\n"; $pausereason_ct = mysql_num_rows($rslt); if ($pausereason_ct > 0) { @@ -6807,9 +7074,9 @@ if ($ACTION == 'updateDISPO') $talk_time=0; $talk_time_ms=0; $talk_time_min=0; - if (eregi('--A--user_custom_',$dispo_call_url)) + if ( (eregi('--A--user_custom_',$dispo_call_url)) or (eregi('--A--fullname',$dispo_call_url)) ) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $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,'00288',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6817,17 +7084,18 @@ if ($ACTION == 'updateDISPO') if ($VUC_ct > 0) { $row=mysql_fetch_row($rslt); - $user_custom_one = urlencode(trim($row[0])); - $user_custom_two = urlencode(trim($row[1])); - $user_custom_three = urlencode(trim($row[2])); - $user_custom_four = urlencode(trim($row[3])); - $user_custom_five = urlencode(trim($row[4])); + $user_custom_one = urlencode(trim($row[0])); + $user_custom_two = urlencode(trim($row[1])); + $user_custom_three = urlencode(trim($row[2])); + $user_custom_four = urlencode(trim($row[3])); + $user_custom_five = urlencode(trim($row[4])); + $fullname = urlencode(trim($row[5])); } } if (eregi('--A--talk_time',$dispo_call_url)) { - $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + $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,'00289',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6854,7 +7122,7 @@ if ($ACTION == 'updateDISPO') if (eregi('--A--dispo_name--B--',$dispo_call_url)) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00297',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6862,11 +7130,11 @@ if ($ACTION == 'updateDISPO') if ($vs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00298',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6874,7 +7142,7 @@ if ($ACTION == 'updateDISPO') if ($vcs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } } if (strlen($status_name) < 1) {$status_name = $dispo_choice;} @@ -6930,8 +7198,8 @@ if ($ACTION == 'updateDISPO') if ($VDIDL_ct > 0) { $row=mysql_fetch_row($rslt); - $DID_pattern = $row[0]; - $DID_description = $row[1]; + $DID_pattern = urlencode(trim($row[0])); + $DID_description = urlencode(trim($row[1])); } } } @@ -7069,6 +7337,7 @@ if ($ACTION == 'updateDISPO') $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); + $dispo_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($MDnextCID)),$dispo_call_url); if (strlen($FORMcustom_field_names)>2) { @@ -7090,7 +7359,7 @@ if ($ACTION == 'updateDISPO') $o=0; while ($custom_field_names_ct > $o) { - $form_field_value = trim("$row[$o]"); + $form_field_value = urlencode(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); @@ -7099,10 +7368,43 @@ if ($ACTION == 'updateDISPO') } } + $stmt="UPDATE vicidial_log_extended set dispo_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00423',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$dispo_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='dispo',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00424',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### send dispo_call_url ### if ($DB > 0) {echo "$dispo_call_url
\n";} $SCUfile = file("$dispo_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00425',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00296',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7182,7 +7484,7 @@ if ($ACTION == 'updateDISPO') 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';"; + $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);} @@ -7206,6 +7508,9 @@ if ($ACTION == 'updateDISPO') fclose($fp); } + # debug testing sleep + # sleep(5); + echo 'Lead ' . $lead_id . ' è cambiato ' . $dispo_choice . " Stato\nNext agent_log_id:\n" . $agent_log_id . "\n"; } @@ -7371,7 +7676,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00167',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -7386,6 +7691,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -7418,7 +7724,10 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) if ($cqpe_ct > 0) { $row=mysql_fetch_row($rslt); - $data4SQL = ",data4='$row[0]'"; + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; } $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id' $data4SQL;"; @@ -7432,7 +7741,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) } $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7548,7 +7857,7 @@ if ($ACTION == 'UpdatEFavoritEs') } else { - $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + $stmt = "SELECT count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00172',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7599,7 +7908,7 @@ if ($ACTION == 'PauseCodeSubmit') else { $pause_sec=0; - $stmt = "select pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $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,'00306',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7645,7 +7954,7 @@ if ($ACTION == 'PauseCodeSubmit') { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00176',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -7661,6 +7970,7 @@ if ($ACTION == 'PauseCodeSubmit') $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $allow_sipsak_messages = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -7885,7 +8195,7 @@ if ($ACTION == 'AGENTSview') } echo "

\n"; - echo "    -READY      -INCALL      -PAUSED  \n"; + echo "    -READY      -Incall      -PAUSA  \n"; if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) {echo "    -LOGGED-OUT  \n";} @@ -8131,7 +8441,7 @@ if ($ACTION == 'CALLLOGview') echo "
No calls su this day
Nessuna chiamata in questo giorno
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i]
"; echo "
"; - echo "Close Call Log"; + echo "Chiudere registro chiamate"; echo ""; } @@ -8246,7 +8559,7 @@ if ($ACTION == 'SEARCHRESULTSview') if (strlen($stage) < 3) {$stage = '670';} - $stmt="select agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} $rslt=mysql_query($stmt, $link); $camps_to_print = mysql_num_rows($rslt); @@ -8280,8 +8593,10 @@ if ($ACTION == 'SEARCHRESULTSview') elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) { ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} if (preg_match('/MAIN/',$search)) - {$searchSQL = "phone_number='$phone_number'";} + {$searchSQL .= "phone_number='$phone_number'";} if (preg_match('/ALT/',$search)) { if (strlen($searchSQL) > 10) @@ -8294,6 +8609,8 @@ if ($ACTION == 'SEARCHRESULTSview') {$searchSQL .= " or ";} $searchSQL .= "address3='$phone_number'"; } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} } elseif (strlen($last_name) > 0) { @@ -8442,7 +8759,7 @@ if ($ACTION == 'SEARCHRESULTSview') ##### BEGIN search queries and output ##### - $stmt="select count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; ### LOG INSERTION Search Log Table ### $SQL_log = "$stmt|"; @@ -8473,7 +8790,7 @@ if ($ACTION == 'SEARCHRESULTSview') echo "
\n"; echo ""; - echo "Results Found: $search_result_count"; + echo "Risultati Trovati: $search_result_count"; echo "\n"; echo "
\n"; echo ""; @@ -8492,7 +8809,7 @@ if ($ACTION == 'SEARCHRESULTSview') if ($search_result_count) { - $stmt="select first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} $out_logs_to_print = mysql_num_rows($rslt); @@ -8519,7 +8836,7 @@ if ($ACTION == 'SEARCHRESULTSview') } if ($g < 1) - {echo "";} + {echo "";} $u=0; while ($g > $u) @@ -8556,7 +8873,7 @@ if ($ACTION == 'SEARCHRESULTSview') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} } else - {echo "";} + {echo "";} echo "
No results found
Nessun risultato trovato
No results found
Nessun risultato trovato
"; echo "
"; @@ -8585,6 +8902,334 @@ if ($ACTION == 'SEARCHRESULTSview') +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Torna Indietro"; + echo "
"; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Risultati Trovati: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set secondi='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Nessun risultato trovato
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Nessun risultato trovato
"; + echo "
"; + echo "Torna Indietro"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Torna Indietro"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campagna not found\n"; + echo "

"; + echo "Torna Indietro"; + echo ""; + exit; + } + } + + + ################################################################################ ### LEADINFOview - display the information for a lead and logs for that lead ################################################################################ @@ -8604,7 +9249,7 @@ if ($ACTION == 'LEADINFOview') $callback_id = preg_replace('/\D/','',$callback_id); if (strlen($callback_id) > 0) { - $stmt="select status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} $cb_to_print = mysql_num_rows($rslt); @@ -8613,11 +9258,11 @@ if ($ACTION == 'LEADINFOview') { $row=mysql_fetch_row($rslt); echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo "
Callback Stato:   $row[0]
Callback Lead Stato:   $row[7]
Callback Entry Time:   $row[1]
Callback Trigger Time:   $row[2]
Callback Note:  $row[6]
RICHIAMI Stato:   $row[0]
Richiamata Lead:   $row[7]
Richiamata Entry Tempo:   $row[1]
Richiamata trigger Tempo:   $row[2]
Richiamata commenti:   $row[6]
"; echo "
"; $hide_dial_links++; @@ -8625,6 +9270,17 @@ if ($ACTION == 'LEADINFOview') } ### END Display callback information ### + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } ### BEGIN Display lead info and custom fields ### ### BEGIN find any custom field labels ### @@ -8649,8 +9305,9 @@ if ($ACTION == 'LEADINFOview') $label_email = 'Email'; $label_comments = 'Note'; - $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;"; + $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,label_hide_field_logs from system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); if (strlen($row[0])>0) {$label_title = $row[0];} if (strlen($row[1])>0) {$label_first_name = $row[1];} @@ -8671,11 +9328,48 @@ if ($ACTION == 'LEADINFOview') 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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } ### END find any custom field labels ### $INFOout .= ""; - $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;"; + $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); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} $info_to_print = mysql_num_rows($rslt); @@ -8684,36 +9378,128 @@ if ($ACTION == 'LEADINFOview') if ($info_to_print > 0) { $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefono and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefono Area Code Fuori Zona componibili $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " CAP Fuori Zona componibili $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefono Area Code Fuori Zona componibili $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " CAP Fuori Zona componibili $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + $INFOout .= ""; - $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} $INFOout .= ""; $INFOout .= ""; $INFOout .= ""; - $INFOout .= ""; - $INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} $INFOout .= ""; - $INFOout .= ""; - $INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; - $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} $INFOout .= ""; $INFOout .= ""; # $INFOout .= ""; @@ -8787,7 +9573,7 @@ if ($ACTION == 'LEADINFOview') ### BEGIN Gather Call Log and notes ### $NOTESout=''; if ($search != 'logfirst') - {$NOTESout .= "
CALL LOG FOR THIS LEAD:
\n";} + {$NOTESout .= "
Registro Chiamate QUESTO FILO:
\n";} $NOTESout .= "
$post_phone_time_diff_alert_message
Stato:   $row[0]
$label_vendor_lead_code:   $row[1]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Chiamato Since Cognome Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; - if ($hide_dial_links < 1) - {$INFOout .= "DIAL";} + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } $INFOout .= "
$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]
$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] -         "; - if ($hide_dial_links < 1) - {$INFOout .= "DIAL";} + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "
$label_gender:   $row[19]
$label_alt_phone:   $row[20] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Chiamato Count:   $row[24]
Cognome Local Call Time:   $row[25]
Rank:   $row[26]
"; $NOTESout .= ""; $NOTESout .= ""; @@ -8805,7 +9591,7 @@ if ($ACTION == 'LEADINFOview') $NOTESout .= ""; - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $out_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {$NOTESout .= "|$out_logs_to_print|$stmt|";} @@ -8856,7 +9642,7 @@ if ($ACTION == 'LEADINFOview') $u++; } - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $in_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {$NOTESout .= "|$in_logs_to_print|$stmt|";} @@ -8910,7 +9696,7 @@ if ($ACTION == 'LEADINFOview') if ($g > 0) {sort($ALLsort, SORT_NUMERIC);} else - {$NOTESout .= "";} + {$NOTESout .= "";} $u=0; while ($g > $u) @@ -8923,6 +9709,10 @@ if ($ACTION == 'LEADINFOview') else {$bgcolor='bgcolor="#9BB9FB"';} + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $u++; $NOTESout .= ""; $NOTESout .= ""; @@ -8930,7 +9720,7 @@ if ($ACTION == 'LEADINFOview') $NOTESout .= "\n"; $NOTESout .= "\n"; $NOTESout .= "\n"; - $NOTESout .= "\n"; + $NOTESout .= "\n"; $NOTESout .= "\n"; $NOTESout .= "\n"; $NOTESout .= "\n"; @@ -9037,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -9063,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -9081,18 +9893,33 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status IN('LIVE');"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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);} @@ -9126,7 +9953,7 @@ if ($ACTION == 'customer_3way_hangup_process') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} diff --git a/agc_2-X/trunk/LANG_www/agc_it/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_it/vdc_form_display.php index dc51eb31..928fe0ed 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/vdc_form_display.php +++ b/agc_2-X/trunk/LANG_www/agc_it/vdc_form_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell 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 @@ -12,13 +12,17 @@ # 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields # -$version = '2.4-4'; -$build = '100916-1749'; +$version = '2.4-8'; +$build = '120315-1729'; require("dbconnect.php"); -require("functions.php"); +require_once("functions.php"); if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} @@ -138,6 +142,11 @@ 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["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -278,6 +287,8 @@ if ($stage=='SUBMIT') 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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes if ( ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='CHECKBOX') or ($A_field_type[$o]=='RADIO') ) { @@ -303,13 +314,13 @@ if ($stage=='SUBMIT') $A_field_value[$o] = $form_field_value; - if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') ) + if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) { $A_field_value[$o]='----IGNORE----'; } else { - if (preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) + if (preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) { $VL_update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; } @@ -437,7 +448,7 @@ else echo "\n"; - require("functions.php"); + require_once("functions.php"); $CFoutput = custom_list_fields_values($lead_id,$list_id,$uniqueid,$user); diff --git a/agc_2-X/trunk/LANG_www/agc_it/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_it/vdc_script_display.php index fb63caf6..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_it/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -14,10 +14,13 @@ # 100127-1611 - Added ignore_list_script_override option # 100823-1644 - Added DID variables # 100902-1344 - Added closecallid, xfercallid, agent_log_id variables +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.4-8'; -$build = '100902-1344'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -185,6 +188,10 @@ if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_u 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} header ("Content-type: text/html; charset=utf-8"); @@ -388,6 +395,7 @@ if (eregi("iframe src",$script_text)) $did_extension = eregi_replace(' ','+',$did_extension); $did_pattern = eregi_replace(' ','+',$did_pattern); $did_description = eregi_replace(' ','+',$did_description); + $web_vars = eregi_replace(' ','+',$web_vars); } $script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text); @@ -471,6 +479,8 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$script_text); if ($CF_uses_custom_fields=='Y') { @@ -500,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
  #  
No calls found
Nessuna chiamata trovate
$u $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i]
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_it/vicidial.php b/agc_2-X/trunk/LANG_www/agc_it/vicidial.php index 44e593e3..7ad6aa4a 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_it/vicidial.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database @@ -343,12 +343,46 @@ # 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work # 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes # 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.4-320c'; -$build = '110322-0923'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=72; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); @@ -431,7 +465,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,static_agent_url,custom_fields_enabled 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,pllb_grouping_limit 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";} @@ -452,6 +486,7 @@ if ($qm_conf_ct > 0) $user_territories_active = $row[10]; $static_agent_url = $row[11]; $custom_fields_enabled = $row[12]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -491,7 +526,9 @@ $disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from t $hide_timeclock_link = '0'; # set to 1 to hide the timeclock link su the agent login screen $conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups $focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$consult_custom_delay = '2'; # number of secondi to delay consultative transfers when customfields are active + +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 @@ -589,8 +626,8 @@ echo ' - - + + '; echo "\n"; echo "\n"; @@ -770,7 +807,7 @@ if ($LogiNAJAX > 0) // alert(logincampaign_query); // alert(xmlhttp.responseText); document.getElementById("LogiNCamPaigns").innerHTML = Nactiveext; - document.getElementById("LogiNReseT").innerHTML = ""; + document.getElementById("LogiNReseT").innerHTML = ""; document.getElementById("VD_campaign").focus(); } } @@ -831,7 +868,7 @@ echo "
Campagna: $camp_form_code
  \n"; - echo "

VERSIONE: $version       BUILD: $build
\n"; echo "\n\n"; @@ -989,7 +1026,7 @@ else $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,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $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,agent_lead_search_override,preset_contact_search from vicidial_users where user='$VD_login' and pass='$VD_pass'"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); @@ -1020,6 +1057,7 @@ else $VU_agent_call_log_view_override = $row[24]; $VU_agent_choose_blended = $row[25]; $VU_agent_lead_search_override = $row[26]; + $VU_preset_contact_search = $row[27]; if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';} @@ -1184,13 +1222,12 @@ else $VDdisplayMESSAGE.= "\n"; } } - ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR - + ### 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"); + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } $user_abb = "$VD_login$VD_login$VD_login$VD_login"; @@ -1337,7 +1374,7 @@ echo "
0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1434,7 +1471,75 @@ echo " 0) and (strlen($qm_phone_environment)>0) ) + {$qm_phone_environment .= "-$qm_extension";} + + $status_display_CALLID=0; + $status_display_LEADID=0; + $status_display_LISTID=0; + if (preg_match("/CALLID/",$status_display_fields)) + {$status_display_CALLID=1;} + if (preg_match("/LEADID/",$status_display_fields)) + {$status_display_LEADID=1;} + if (preg_match("/LISTID/",$status_display_fields)) + {$status_display_LISTID=1;} + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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 vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01073',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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 ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + + $hide_dispo_list=0; + if ( ($disable_dispo_screen == 'DISPO_ENABLED') or ($disable_dispo_screen == 'DISPO_SELECT_DISABLED') or (strlen($disable_dispo_status) < 1) ) + { + if ($disable_dispo_screen == 'DISPO_SELECT_DISABLED') + {$hide_dispo_list=1;} + $disable_dispo_screen=0; + $disable_dispo_status=''; + } + if ( ($disable_dispo_screen == 'DISPO_DISABLED') and (strlen($disable_dispo_status) > 0) ) + {$disable_dispo_screen=1;} + if ( ($VU_agent_lead_search_override == 'ENABLED') or ($VU_agent_lead_search_override == 'DISABLED') ) {$agent_lead_search = $VU_agent_lead_search_override;} $AllowManualQueueCalls=1; @@ -1492,6 +1597,19 @@ echo " 0) { - fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); fclose($fp); } $VDloginDISPLAY=1; @@ -1801,7 +1919,7 @@ echo " 0) { $row=mysql_fetch_row($rslt); - $alias_found = "$row[0]"; + $alias_found = $row[0]; } if ($alias_found > 0) { @@ -1812,8 +1930,8 @@ echo " 0) { $row=mysql_fetch_row($rslt); - $alias_name = "$row[0]"; - $phone_login = "$row[1]"; + $alias_name = $row[0]; + $phone_login = $row[1]; } } @@ -1856,7 +1974,7 @@ echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -1879,8 +1997,9 @@ echo " 0) { $pb=0; @@ -1888,7 +2007,9 @@ echo " 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01022',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -1941,22 +2062,75 @@ echo " 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) { - if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + if ( ($pllb_grouping == 'ONE_SERVER_ONLY') or ($pllb_grouping == 'CASCADING') ) { - $pb_count=$row[0]; - $pb_server_ip=$rowx[0]; - $phone_login=$phones_auto[$pb]; + if ($pllb_grouping == 'ONE_SERVER_ONLY') + { + ### one-server-only plib check + ### get number of agents logged in to each server + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01074',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowG=mysql_fetch_row($rslt); + + if ($rowG[0] > 0) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + $pb_force_set++; + echo "\n"; + } + } + else + { + ### cascading plib check + ### get number of agents logged in to each server + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01075',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowG=mysql_fetch_row($rslt); + + echo "\n"; + if ( ($rowG[0] > 0) and ($rowG[0] < $pllb_grouping_limit) and ($row[0] < $SSpllb_grouping_limit) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + $pb_force_set++; + echo "\n"; + } + } + } + if ($pb_force_set < 1) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } } } $pb++; } + + + + + + echo "\n"; } + ##### END phone login load balancing functions ##### + 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,phone_ring_timeout,on_hook_agent from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + $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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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);} + 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]; @@ -2027,6 +2201,7 @@ echo "0) && (strlen($park_file_name)>0) ) { @@ -2229,7 +2417,7 @@ echo " 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01040',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2247,6 +2435,7 @@ echo " 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01042',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2361,13 +2552,15 @@ echo " 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01043',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2380,7 +2573,7 @@ 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,on_hook_ring_time,on_hook_agent) 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','$phone_ring_timeout','$on_hook_agent');"; + $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,on_hook_ring_time,on_hook_agent,last_inbound_call_time,last_inbound_call_finish,campaign_grade) 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','$phone_ring_timeout','$on_hook_agent','$NOW_TIME','$NOW_TIME','$campaign_grade');"; 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);} @@ -2399,6 +2592,9 @@ echo " 0) and (strlen($qm_phone_environment)>0) ) + {$qm_phone_environment .= "-$qm_extension";} + if ($queuemetrics_loginout!='NONE') { $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',data4='$qm_phone_environment';"; @@ -2440,7 +2636,7 @@ echo "\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,on_hook_ring_time,on_hook_agent) 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','$phone_ring_timeout','$on_hook_agent');"; + $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,on_hook_ring_time,on_hook_agent,campaign_grade) 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','$phone_ring_timeout','$on_hook_agent','$campaign_grade');"; 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);} @@ -2665,6 +2861,10 @@ $MASTERwidth=($BROWSER_WIDTH - 340); $MASTERheight=($BROWSER_HEIGHT - 200); if ($MASTERwidth < 430) {$MASTERwidth = '430';} if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($per_call_notes == 'ENABLED') + { + if ($MASTERheight < 340) {$MASTERheight = '340';} + } if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} $CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) @@ -2722,6 +2922,10 @@ $Cyear = $CdayARY['year']; $CTODAY = date("Y-m"); $CTODAYmday = date("j"); $CINC=0; +$live_days=0; +$limit_days=999; +if ($callback_days_limit > 0) + {$limit_days=$callback_days_limit;} $Cmonths = Array('Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno', 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'); @@ -2732,106 +2936,117 @@ $CCAL_OUT = ''; $CCAL_OUT .= ""; while ($CINC < 12) -{ -if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) - {$CCAL_OUT .= "";} - -$CCAL_OUT .= "";} -$CCAL_OUT .= "
"; - -$CYyear = $Cyear; -$Cmonth= ($Cmon + $CINC); -if ($Cmonth > 12) { - $Cmonth = ($Cmonth - 12); - $CYyear++; - } -$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); -$CfirstdayARY = getdate($Cstart); -#echo "|$Cmon|$Cmonth|$CINC|\n"; -$CPRNTDAY = date("Y-m", $Cstart); + if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) ) + {$CCAL_OUT .= "
"; -$CCAL_OUT .= ""; -$CCAL_OUT .= ""; -$CCAL_OUT .= ""; + $CCAL_OUT .= ""; -} - -for( $Ccount=0;$Ccount<(6*7);$Ccount++) -{ - $Cdayarray = getdate($Cstart); - if((($Ccount) % 7) == 0) - { - if($Cdayarray['mon'] != $CfirstdayARY['mon']) - break; - $CCAL_OUT .= ""; - } - if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) - { - $CCAL_OUT .= ""; - } - else - { - if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + $CYyear = $Cyear; + $Cmonth= ($Cmon + $CINC); + if ($Cmonth > 12) { - $CPRNTmday = $Cdayarray['mday']; - if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} - $CBL = ""; - $CEL = ""; - - $CCAL_OUT .= ""; - $Cstart += ADAY; - } - else - { - $CDCLR="#ffffff"; - if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) - { - $CDCLR="$MAIN_COLOR"; - $CBL = ''; - $CEL = ''; - } - else - { - $CPRNTmday = $Cdayarray['mday']; - if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} - $CBL = ""; - $CEL = ""; + $Cmonth = ($Cmonth - 12); + $CYyear++; } + $Cstart= mktime(11,0,0,$Cmonth,1,$CYyear); + $CfirstdayARY = getdate($Cstart); + #echo "|$Cmon|$Cmonth|$CINC|\n"; + $CPRNTDAY = date("Y-m", $Cstart); - $CCAL_OUT .= ""; + $CCAL_OUT .= ""; -if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) ) - {$CCAL_OUT .= "";} -$CINC++; -} + foreach($Cdays as $Cday) + { + $CDCLR="#ffffff"; + $CCAL_OUT .= ""; + } + + for( $Ccount=0;$Ccount<(6*7);$Ccount++) + { + $Cdayarray = getdate($Cstart); + if((($Ccount) % 7) == 0) + { + if($Cdayarray['mon'] != $CfirstdayARY['mon']) + break; + $CCAL_OUT .= ""; + } + if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth) + { + $CCAL_OUT .= ""; + } + else + { + if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + if ($limit_days > $live_days) + { + $CBL = ""; + $CEL = ""; + } + else + {$CBL=''; $CEL='';} + $CCAL_OUT .= ""; + $Cstart += ADAY; + $live_days++; + } + else + { + $CDCLR="#ffffff"; + if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) ) + { + $CDCLR="$MAIN_COLOR"; + $CBL = ''; + $CEL = ''; + } + else + { + $CPRNTmday = $Cdayarray['mday']; + if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";} + if ($limit_days > $live_days) + { + $CBL = ""; + $CEL = ""; + } + else + {$CBL=''; $CEL='';} + $live_days++; + } + + $CCAL_OUT .= ""; + $Cstart += ADAY; + } + } + } + $CCAL_OUT .= ""; + $CCAL_OUT .= "
"; -$CCAL_OUT .= "
"; -$CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; -$CCAL_OUT .= "
"; -$CCAL_OUT .= "
"; -foreach($Cdays as $Cday) -{ - $CDCLR="#ffffff"; -$CCAL_OUT .= ""; -$CCAL_OUT .= "
"; -$CCAL_OUT .= "$Cday"; -$CCAL_OUT .= "
"; -$CCAL_OUT .= "
 "; - $CCAL_OUT .= "
"; - $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; - $CCAL_OUT .= "
"; - $CCAL_OUT .= "
"; - $CCAL_OUT .= "
"; - $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; - $CCAL_OUT .= "
"; + $CCAL_OUT .= ""; + $CCAL_OUT .= ""; + $CCAL_OUT .= ""; - $Cstart += ADAY; - } - } -} -$CCAL_OUT .= ""; -$CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CfirstdayARY[month] $CfirstdayARY[year]"; + $CCAL_OUT .= "
"; $CCAL_OUT .= "
"; -$CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$Cday"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
 "; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; + $CCAL_OUT .= "
"; @@ -2874,6 +3089,7 @@ $CCAL_OUT .= "
"; var CallBackrecipient = ''; var CallBackCommenTs = ''; var CallBackLeadStato = ''; + var DispoQMcsCODE = ''; var scheduled_callbacks = ''; var dispo_check_all_pause = ''; var api_check_all_pause = ''; @@ -3179,6 +3395,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var alert_enabled = ''; var allow_alerts = ''; var shift_logout_flag = 0; + var api_logout_flag = 0; var vtiger_callback_id = 0; var agent_status_view = ''; var agent_status_view_time = ''; @@ -3234,6 +3451,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var agent_call_log_view=''; var scheduled_callbacks_alert=''; var scheduled_callbacks_count=''; + var callback_days_limit=''; var tmp_vicidial_id=''; var agent_xfer_consultative=''; var agent_xfer_dial_override=''; @@ -3313,6 +3531,26 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var auto_resume_precall=''; var trigger_ready=0; var hide_gender=''; + var manual_dial_cid=''; + var post_phone_time_diff_alert_message=''; + var custom_3way_button_transfer=''; + var custom_3way_button_transfer_enabled=''; + var custom_3way_button_transfer_park=''; + var custom_3way_button_transfer_view=''; + var custom_3way_button_transfer_contacts=''; + var waiting_on_dispo=0; + var disable_dispo_screen=''; + var disable_dispo_status=''; + var status_display_CALLID=''; + var status_display_LEADID=''; + var status_display_LISTID=''; + var qm_extension=''; + var hide_dispo_list=''; + var external_transferconf_count=0; + var consult_custom_delay=''; + var consult_custom_wait=0; + var consult_custom_go=0; + var consult_custom_sent=0; var DiaLControl_auto_HTML = "\"\"Riprendi\""; var DiaLControl_auto_HTML_ready = "\"\"Riprendi\""; var DiaLControl_auto_HTML_OFF = "\"\"Riprendi\""; @@ -3405,7 +3643,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { var queryCID = "HLagcW" + epoch_sec + user_abb; var hangupvalue = taskvar; - livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&log_campaign=" + campaign; + livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&log_campaign=" + campaign + "&qm_extension=" + qm_extension; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(livehangup_query); @@ -3537,6 +3775,67 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } +// ################################################################################ +// custom button transfer 3way call + function custom_button_transfer() + { + ShoWTransferMain('ON'); + if (custom_3way_button_transfer_contacts > 0) + { + generate_contacts_search(); + } + else + { + if (custom_3way_button_transfer_view > 0) + { + generate_presets_pulldown(); + } + else + { + if ( (custom_3way_button_transfer == 'PRESET_1') || (custom_3way_button_transfer == 'ATTESA_PRESET_1') ) + {document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; document.vicidial_form.xfername.value='D1';} + if ( (custom_3way_button_transfer == 'PRESET_2') || (custom_3way_button_transfer == 'ATTESA_PRESET_2') ) + {document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; document.vicidial_form.xfername.value='D2';} + if ( (custom_3way_button_transfer == 'PRESET_3') || (custom_3way_button_transfer == 'ATTESA_PRESET_3') ) + {document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber; document.vicidial_form.xfername.value='D3';} + if ( (custom_3way_button_transfer == 'PRESET_4') || (custom_3way_button_transfer == 'ATTESA_PRESET_4') ) + {document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber; document.vicidial_form.xfername.value='D4';} + if ( (custom_3way_button_transfer == 'PRESET_5') || (custom_3way_button_transfer == 'ATTESA_PRESET_5') ) + {document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber; document.vicidial_form.xfername.value='D5';} + if ( (custom_3way_button_transfer == 'FIELD_address3') || (custom_3way_button_transfer == 'ATTESA_FIELD_address3') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.address3.value;} + if ( (custom_3way_button_transfer == 'FIELD_province') || (custom_3way_button_transfer == 'ATTESA_FIELD_province') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.province.value;} + if ( (custom_3way_button_transfer == 'FIELD_security_phrase') || (custom_3way_button_transfer == 'ATTESA_FIELD_security_phrase') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.security_phrase.value;} + if ( (custom_3way_button_transfer == 'FIELD_vendor_lead_code') || (custom_3way_button_transfer == 'ATTESA_FIELD_vendor_lead_code') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.vendor_lead_code.value;} + if ( (custom_3way_button_transfer == 'FIELD_email') || (custom_3way_button_transfer == 'ATTESA_FIELD_email') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.email.value;} + if ( (custom_3way_button_transfer == 'FIELD_owner') || (custom_3way_button_transfer == 'ATTESA_FIELD_owner') ) + {document.vicidial_form.xfernumber.value = document.vicidial_form.owner.value;} + + var temp_xfernumber = document.vicidial_form.xfernumber.value; + if (temp_xfernumber.length < 3) + { + alert_box("Number to Dial invalid: " + temp_xfernumber); + ShoWTransferMain('OFF','YES'); + } + else + { + if (custom_3way_button_transfer_park > 0) + { + xfer_park_dial(); + } + else + { + SendManualDial('YES'); + } + } + } + } + } + // ################################################################################ // park customer and place 3way call function xfer_park_dial() @@ -3618,6 +3917,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { var manual_number = document.vicidial_form.xfernumber.value; var manual_string = manual_number.toString(); + var threeway_cid='1'; + if (manual_dial_cid == 'AGENT_PHONE') + {threeway_cid = outbound_cid;} } var regXFvars = new RegExp("XFER","g"); if (manual_string.match(regXFvars)) @@ -3643,9 +3945,35 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } var sending_preset_name = document.vicidial_form.xfername.value; if (taskFromConf == 'YES') - {basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid,sending_group_alias,'',sending_preset_name,call_variables);} + { + // give extra time for custom fields to commit before consultative transfers + if ( (document.vicidial_form.consultativexfer.checked==true) && (custom_fields_enabled > 0) && (consult_custom_delay > 0) ) + { + if (consult_custom_wait >= consult_custom_delay) + { + consult_custom_go = 1; + consult_custom_wait = 0; + } + else + { + CustomerData_update(); + consult_custom_wait++; + consult_custom_sent++; + } + } + else + { + consult_custom_go = 1; + consult_custom_wait = 0; + } + + if (consult_custom_go > 0) + { + basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid,sending_group_alias,'',sending_preset_name,call_variables); + } + } else - {basic_originate_call(manual_string,'NO','NO','','','','1',sending_group_alias,sending_preset_name,call_variables);} + {basic_originate_call(manual_string,'NO','NO','','','',threeway_cid,sending_group_alias,sending_preset_name,call_variables);} MD_ring_secondS=0; } @@ -3689,7 +4017,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {var XfeR_GrouP = API_selected_xfergroup;} tasknum = Ctasknum + "*" + XfeR_GrouP + '*CXFER*' + document.vicidial_form.lead_id.value + '**' + dialed_number + '*' + user + '*' + agentdirect + '*' + VD_live_call_secondS + '*'; - CustomerData_update(); + if (consult_custom_sent < 1) + {CustomerData_update();} } var regAXFvars = new RegExp("AXFER","g"); if (tasknum_string.match(regAXFvars)) @@ -3702,8 +4031,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {closerxfercamptail = 'IVR';} tasknum = Ctasknum + '*' + document.vicidial_form.phone_number.value + '*' + document.vicidial_form.lead_id.value + '*' + campaign + '*' + closerxfercamptail + '*' + user + '**' + VD_live_call_secondS + '*'; - CustomerData_update(); - + if (consult_custom_sent < 1) + {CustomerData_update();} } @@ -4013,6 +4342,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { shift_logout_flag=1; } + if (AGLogiN == 'API_LOGOUT') + { + api_logout_flag=1; + if ( (MD_channel_look < 1) && (VD_live_customer_call < 1) && (alt_dial_status_display < 1) ) + {LogouT('API');} + } } var VLAStatuS_array = check_time_array[4].split("Stato: "); var VLAStatuS = VLAStatuS_array[1]; @@ -4084,35 +4419,39 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.xfernumber.value = api_transferconf_number; mainxfer_send_redirect('XfeRBLIND',lastcustchannel,lastcustserverip); } - if (api_transferconf_function == 'LOCAL_CLOSER') + if (external_transferconf_count < 1) { - API_selected_xfergroup = api_transferconf_group; - document.vicidial_form.xfernumber.value = api_transferconf_number; - mainxfer_send_redirect('XfeRLOCAL',lastcustchannel,lastcustserverip); - } - if (api_transferconf_function == 'DIAL_WITH_CUSTOMER') - { - if (api_transferconf_consultative=='YES') - {document.vicidial_form.consultativexfer.checked=true;} - if (api_transferconf_consultative=='NO') - {document.vicidial_form.consultativexfer.checked=false;} - if (api_transferconf_override=='YES') - {document.vicidial_form.xferoverride.checked=true;} - API_selected_xfergroup = api_transferconf_group; - document.vicidial_form.xfernumber.value = api_transferconf_number; - SendManualDial('YES'); - } - if (api_transferconf_function == 'ATTESA_CUSTOMER_DIAL') - { - if (api_transferconf_consultative=='YES') - {document.vicidial_form.consultativexfer.checked=true;} - if (api_transferconf_consultative=='NO') - {document.vicidial_form.consultativexfer.checked=false;} - if (api_transferconf_override=='YES') - {document.vicidial_form.xferoverride.checked=true;} - API_selected_xfergroup = api_transferconf_group; - document.vicidial_form.xfernumber.value = api_transferconf_number; - xfer_park_dial(); + if (api_transferconf_function == 'LOCAL_CLOSER') + { + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + mainxfer_send_redirect('XfeRLOCAL',lastcustchannel,lastcustserverip); + } + if (api_transferconf_function == 'DIAL_WITH_CUSTOMER') + { + if (api_transferconf_consultative=='YES') + {document.vicidial_form.consultativexfer.checked=true;} + if (api_transferconf_consultative=='NO') + {document.vicidial_form.consultativexfer.checked=false;} + if (api_transferconf_override=='YES') + {document.vicidial_form.xferoverride.checked=true;} + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + SendManualDial('YES'); + } + if (api_transferconf_function == 'ATTESA_CUSTOMER_DIAL') + { + if (api_transferconf_consultative=='YES') + {document.vicidial_form.consultativexfer.checked=true;} + if (api_transferconf_consultative=='NO') + {document.vicidial_form.consultativexfer.checked=false;} + if (api_transferconf_override=='YES') + {document.vicidial_form.xferoverride.checked=true;} + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + xfer_park_dial(); + } + external_transferconf_count=3; } Clear_API_Field('external_transferconf'); } @@ -4152,10 +4491,42 @@ function set_length(SLnumber,SLlength_goal,SLdirection) dialedcall_send_hangup(); } - if ( (APIStatuS.length < 10) && (APIStatuS.length > 0) && (AgentDispoing > 1) ) + if ( (APIStatuS.length < 1000) && (APIStatuS.length > 0) && (AgentDispoing > 1) && (APIStatuS != '::::::::::') ) { - document.vicidial_form.DispoSelection.value = APIStatuS; - DispoSelect_submit(); + var regCBmatch = new RegExp('!',"g"); + if (APIStatuS.match(regCBmatch)) + { + var APIcbSTATUS_array = APIStatuS.split("!"); + var APIcbSTATUS = APIcbSTATUS_array[0]; + var APIcbDATETIME = APIcbSTATUS_array[1]; + var APIcbTYPE = APIcbSTATUS_array[2]; + var APIcbNOTE = APIcbSTATUS_array[3]; + var APIqmCScode = APIcbSTATUS_array[4]; + + if ( (APIcbDATETIME.length > 10) && (APIcbTYPE.length > 5) ) + { + CallBackDatETimE = APIcbDATETIME; + CallBackrecipient = APIcbTYPE; + CallBackLeadStato = APIcbSTATUS; + CallBackCommenTs = APIcbNOTE; + hideDiv('CallBackSelectBox'); + document.vicidial_form.DispoSelection.value = 'CBHOLD'; + } + else + {document.vicidial_form.DispoSelection.value = APIcbSTATUS;} + if (APIqmCScode.length > 0) + { + DispoQMcsCODE = APIqmCScode; + } + // ZZZZZZZZZZZZZZZZZZZZZZZ API callback + // alert("CBdata: " + CallBackDatETimE + "|" + CallBackrecipient + "|" + CallBackLeadStato + "|" + CallBackCommenTs + "|" + DispoQMcsCODE + "|"); + DispoSelect_submit(); + } + else + { + document.vicidial_form.DispoSelection.value = APIStatuS; + DispoSelect_submit(); + } } if (APIPausE.length > 4) { @@ -4202,7 +4573,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (APIManualDialQueue != APIManualDialQueue_last) { APIManualDialQueue_last = APIManualDialQueue; - document.getElementById("ManualQueueNotice").innerHTML = "Manual Queue: " + APIManualDialQueue + "
"; + document.getElementById("ManualQueueNotice").innerHTML = "Queue Manual: " + APIManualDialQueue + "
"; } if ( (APIDiaL.length > 9) && (WaitingForNextStep == '0') && (AllowManualQueueCalls == '1') && (check_n > 2) ) { @@ -4222,6 +4593,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) active_group_alias = APIDiaL_array_detail[8]; cid_choice = APIDiaL_array_detail[9]; vtiger_callback_id = APIDiaL_array_detail[10]; + document.vicidial_form.MDLeadID.value = APIDiaL_array_detail[11]; + document.vicidial_form.MDType.value = APIDiaL_array_detail[12]; // alert(APIDiaL_array_detail[1] + "-----" + APIDiaL + "-----" + document.vicidial_form.MDDiaLCodE.value + "-----" + document.vicidial_form.phone_code.value); @@ -4614,6 +4987,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var consultativexfer_checked = 0; if (document.vicidial_form.consultativexfer.checked==true) {consultativexfer_checked = 1;} + if (taskvar == 'XfeRLOCAL') + {consultativexfer_checked = 0;} // conf_dialed=1; if (auto_dial_level == 0) {RedirecTxFEr = 1;} @@ -4714,7 +5089,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (taskvar == 'XfeRLOCAL') { - CustomerData_update(); + if (consult_custom_sent < 1) + {CustomerData_update();} document.vicidial_form.xfername.value=''; var XfeRSelecT = document.getElementById("XfeRGrouP"); @@ -4997,11 +5373,15 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (document.vicidial_form.DiaLAltPhonE.checked==true) { + var status_display_content=''; + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} + alt_num_status = 1; reselect_alt_dial = 1; alt_dial_active = 1; alt_dial_status_display = 1; - var man_status = "Chiama Numero Altern.: NUMERO PRINCIPALE or NUMERO ALTERNATIVO or INDIRIZZO3 or Termina Contatto"; + var man_status = "Chiama Numero Altern.: NUMERO PRINCIPALE or NUMERO ALTERNATIVO or INDIRIZZO3 or Termina Contatto" + status_display_content; document.getElementById("MainStatuSSpan").innerHTML = man_status; } } @@ -5033,7 +5413,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) "&list_id=" + document.vicidial_form.list_id.value + "&length_in_sec=0&phone_code=" + document.vicidial_form.phone_code.value + "&phone_number=" + lead_dial_number + - "&exten=" + extension + "&channel=" + lastcustchannel + "&start_epoch=" + MDlogEPOCH + "&auto_dial_level=" + auto_dial_level + "&VDstop_rec_after_each_call=" + VDstop_rec_after_each_call + "&conf_silent_prefix=" + conf_silent_prefix + "&protocol=" + protocol + "&extension=" + extension + "&ext_context=" + ext_context + "&conf_exten=" + session_id + "&user_abb=" + user_abb + "&agent_log_id=" + agent_log_id + "&MDnextCID=" + LasTCID + "&inOUT=" + inOUT + "&alt_dial=" + dialed_label + "&DB=0" + "&agentchannel=" + agentchannel + "&conf_dialed=" + conf_dialed + "&leaving_threeway=" + leaving_threeway + "&hangup_all_non_reserved=" + hangup_all_non_reserved + "&blind_transfer=" + blind_transfer + "&dial_method" + dial_method + "&nodeletevdac=" + nodeletevdac + "&alt_num_status=" + alt_num_status; + "&exten=" + extension + "&channel=" + lastcustchannel + "&start_epoch=" + MDlogEPOCH + "&auto_dial_level=" + auto_dial_level + "&VDstop_rec_after_each_call=" + VDstop_rec_after_each_call + "&conf_silent_prefix=" + conf_silent_prefix + "&protocol=" + protocol + "&extension=" + extension + "&ext_context=" + ext_context + "&conf_exten=" + session_id + "&user_abb=" + user_abb + "&agent_log_id=" + agent_log_id + "&MDnextCID=" + LasTCID + "&inOUT=" + inOUT + "&alt_dial=" + dialed_label + "&DB=0" + "&agentchannel=" + agentchannel + "&conf_dialed=" + conf_dialed + "&leaving_threeway=" + leaving_threeway + "&hangup_all_non_reserved=" + hangup_all_non_reserved + "&blind_transfer=" + blind_transfer + "&dial_method" + dial_method + "&nodeletevdac=" + nodeletevdac + "&alt_num_status=" + alt_num_status + "&qm_extension=" + qm_extension; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); // document.getElementById("busycallsdebug").innerHTML = "vdc_db_query.php?" + manDiaLlog_query; @@ -5127,7 +5507,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { // alert(xmlhttp.responseText); var DLcounT = xmlhttp.responseText; - document.getElementById("dialableleadsspan").innerHTML ="Dialable Leads:
" + DLcounT; + document.getElementById("dialableleadsspan").innerHTML ="Leads componibili:
" + DLcounT; } } @@ -5281,7 +5661,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var CB_calls = all_CBs_array[0]; var loop_ct=0; var conv_start=0; - var CB_HTML = "px\">\">" + var CB_HTML = "
# DATA/ORA RICHIAMONUMERONAME STATOCAMPAIGNDATA/ORA ULTIMA CHIAMATA CHIAMA
px\">\">" while (loop_ct < CB_calls) { loop_ct++; @@ -5301,7 +5681,21 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var CB_lastcall_time = call_array[7]; var CB_callback_time = call_array[8]; var CB_comments = call_array[9]; - CB_HTML = CB_HTML + ""; + var CB_dialable = call_array[10]; + var CB_comments_ten = CB_comments; + if (CB_comments_ten.length > 10) + { + CB_comments_ten = CB_comments_ten.substr(0,10); + CB_comments_ten = CB_comments_ten + '...'; + } + if (CB_dialable > 0) + { + CB_HTML = CB_HTML + ""; + } + else + { + CB_HTML = CB_HTML + ""; + } } CB_HTML = CB_HTML + "
# DATA/ORA RICHIAMONUMEROINFONAME STATOCAMPAIGNDATA/ORA ULTIMA CHIAMATA CHIAMA ALT
" + loop_ct + "" + CB_callback_time + "" + CB_phone + " - INFO" + CB_name + "" + CB_status + "" + CB_campaign + "" + CB_lastcall_time + " DIAL 
" + loop_ct + "" + CB_callback_time + "" + CB_phone + "" + CB_comments_ten + " - INFO" + CB_name + "" + CB_status + "" + CB_campaign + "" + CB_lastcall_time + " DIAL ALT 
" + loop_ct + "" + CB_callback_time + "" + CB_phone + "" + CB_comments_ten + " - INFO" + CB_name + "" + CB_status + "" + CB_campaign + "" + CB_lastcall_time + " NON-DIALABLE 
"; document.getElementById("CallBacKsLisT").innerHTML = CB_HTML; @@ -5358,27 +5752,44 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { AutoDial_ReSume_PauSe("VDADready"); } + ShoWGenDerPulldown(); hideDiv('SearcHForMDisplaYBox'); } // ################################################################################ -// Open up a callback customer record as manual dial preview mode - function new_callback_call(taskCBid,taskLEADid) +// closes contacts search screen + function ContactSearcHVieWClose() { - // alt_phone_dialing=1; - CognomeCallbackViewed=1; - CognomeCallbackCount = (CognomeCallbackCount - 1); - auto_dial_level=0; - manual_dial_in_progress=1; - MainPanelToFront(); - buildDiv('DiaLLeaDPrevieW'); - if (alt_phone_dialing == 1) - {buildDiv('DiaLDiaLAltPhonE');} - document.vicidial_form.LeadPreview.checked=true; - // document.vicidial_form.DiaLAltPhonE.checked=true; - hideDiv('CallBacKsLisTBox'); - ManualDialNext(taskCBid,taskLEADid,'','','','0'); + ShoWGenDerPulldown(); + hideDiv('SearcHContactsDisplaYBox'); + } + + +// ################################################################################ +// Open up a callback customer record as manual dial preview mode + function new_callback_call(taskCBid,taskLEADid,taskCBalt) + { + if (waiting_on_dispo > 0) + { + alert_box("Delay System, Riprova
code:" + agent_log_id + " - " + waiting_on_dispo + ""); + } + else + { + // alt_phone_dialing=1; + CognomeCallbackViewed=1; + CognomeCallbackCount = (CognomeCallbackCount - 1); + auto_dial_level=0; + manual_dial_in_progress=1; + MainPanelToFront(); + buildDiv('DiaLLeaDPrevieW'); + if (alt_phone_dialing == 1) + {buildDiv('DiaLDiaLAltPhonE');} + document.vicidial_form.LeadPreview.checked=true; + // document.vicidial_form.DiaLAltPhonE.checked=true; + hideDiv('CallBacKsLisTBox'); + ManualDialNext(taskCBid,taskLEADid,'','','','0','',taskCBalt); + } } @@ -5427,8 +5838,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) hideDiv('LeaDInfOBox'); document.vicidial_form.MDDiaLCodE.value = TVphone_code; document.vicidial_form.MDPhonENumbeR.value = TVphone_number; + document.vicidial_form.MDPhonENumbeRHiddeN.value = TVphone_number; document.vicidial_form.MDLeadID.value = TVlead_id; document.vicidial_form.MDType.value = TVtype; + if (disable_alter_custphone == 'HIDE') + {document.vicidial_form.MDPhonENumbeR.value = 'XXXXXXXXXX';} } if (TVfast=='LEADSEARCH') { @@ -5464,62 +5878,73 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Insert the new manual dial as a lead and go to manual dial screen function NeWManuaLDiaLCalLSubmiT(tempDiaLnow) { - hideDiv('NeWManuaLDiaLBox'); - document.getElementById("debugbottomspan").innerHTML = "DEBUG OUTPUT" + document.vicidial_form.MDPhonENumbeR.value + "|" + active_group_alias; - - var sending_group_alias = 0; - var MDDiaLCodEform = document.vicidial_form.MDDiaLCodE.value; - var MDPhonENumbeRform = document.vicidial_form.MDPhonENumbeR.value; - var MDLeadIDform = document.vicidial_form.MDLeadID.value; - var MDTypeform = document.vicidial_form.MDType.value; - var MDDiaLOverridEform = document.vicidial_form.MDDiaLOverridE.value; - var MDVendorLeadCode = document.vicidial_form.vendor_lead_code.value; - var MDLookuPLeaD = 'new'; - if (document.vicidial_form.LeadLookuP.checked==true) - {MDLookuPLeaD = 'lookup';} - - if (MDDiaLCodEform.length < 1) - {MDDiaLCodEform = document.vicidial_form.phone_code.value;} - - if (MDDiaLOverridEform.length > 0) + if (waiting_on_dispo > 0) { - agent_dialed_number=1; - agent_dialed_type='MANUAL_OVERRIDE'; - basic_originate_call(session_id,'NO','YES',MDDiaLOverridEform,'YES','','1','0'); + alert_box("Delay System, Riprova
code:" + agent_log_id + " - " + waiting_on_dispo + ""); } else { - auto_dial_level=0; - manual_dial_in_progress=1; - agent_dialed_number=1; - MainPanelToFront(); + hideDiv('NeWManuaLDiaLBox'); + // document.getElementById("debugbottomspan").innerHTML = "DEBUG OUTPUT" + document.vicidial_form.MDPhonENumbeR.value + "|" + active_group_alias; - if (tempDiaLnow == 'PREVIEW') + var sending_group_alias = 0; + var MDDiaLCodEform = document.vicidial_form.MDDiaLCodE.value; + var MDPhonENumbeRform = document.vicidial_form.MDPhonENumbeR.value; + var MDLeadIDform = document.vicidial_form.MDLeadID.value; + var MDTypeform = document.vicidial_form.MDType.value; + var MDDiaLOverridEform = document.vicidial_form.MDDiaLOverridE.value; + var MDVendorLeadCode = document.vicidial_form.vendor_lead_code.value; + var MDLookuPLeaD = 'new'; + if (document.vicidial_form.LeadLookuP.checked==true) + {MDLookuPLeaD = 'lookup';} + + if (MDPhonENumbeRform == 'XXXXXXXXXX') + {MDPhonENumbeRform = document.vicidial_form.MDPhonENumbeRHiddeN.value;} + + if (MDDiaLCodEform.length < 1) + {MDDiaLCodEform = document.vicidial_form.phone_code.value;} + + if (MDDiaLOverridEform.length > 0) { - // alt_phone_dialing=1; - agent_dialed_type='MANUAL_PREVIEW'; - buildDiv('DiaLLeaDPrevieW'); - if (alt_phone_dialing == 1) - {buildDiv('DiaLDiaLAltPhonE');} - document.vicidial_form.LeadPreview.checked=true; - // document.vicidial_form.DiaLAltPhonE.checked=true; + agent_dialed_number=1; + agent_dialed_type='MANUAL_OVERRIDE'; + basic_originate_call(session_id,'NO','YES',MDDiaLOverridEform,'YES','','1','0'); } else { - agent_dialed_type='MANUAL_DIALNOW'; - document.vicidial_form.LeadPreview.checked=false; - document.vicidial_form.DiaLAltPhonE.checked=false; + auto_dial_level=0; + manual_dial_in_progress=1; + agent_dialed_number=1; + MainPanelToFront(); + + if (tempDiaLnow == 'PREVIEW') + { + // alt_phone_dialing=1; + agent_dialed_type='MANUAL_PREVIEW'; + buildDiv('DiaLLeaDPrevieW'); + if (alt_phone_dialing == 1) + {buildDiv('DiaLDiaLAltPhonE');} + document.vicidial_form.LeadPreview.checked=true; + // document.vicidial_form.DiaLAltPhonE.checked=true; + } + else + { + agent_dialed_type='MANUAL_DIALNOW'; + document.vicidial_form.LeadPreview.checked=false; + document.vicidial_form.DiaLAltPhonE.checked=false; + } + if (active_group_alias.length > 1) + {var sending_group_alias = 1;} + + ManualDialNext("",MDLeadIDform,MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode,sending_group_alias,MDTypeform); } - if (active_group_alias.length > 1) - {var sending_group_alias = 1;} - ManualDialNext("",MDLeadIDform,MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode,sending_group_alias,MDTypeform); + document.vicidial_form.MDPhonENumbeR.value = ''; + document.vicidial_form.MDDiaLOverridE.value = ''; + document.vicidial_form.MDLeadID.value = ''; + document.vicidial_form.MDType.value = ''; + document.vicidial_form.MDPhonENumbeRHiddeN.value = ''; } - - document.vicidial_form.MDPhonENumbeR.value = ''; - document.vicidial_form.MDDiaLOverridE.value = ''; - document.vicidial_form.MDLeadID.value = ''; - document.vicidial_form.MDType.value = ''; } // ################################################################################ @@ -5536,22 +5961,29 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } else { - var MDLookuPLeaD = 'new'; - if (document.vicidial_form.LeadLookuP.checked==true) - {MDLookuPLeaD = 'lookup';} - - agent_dialed_number=1; - agent_dialed_type='MANUAL_DIALFAST'; - // alt_phone_dialing=1; - auto_dial_level=0; - manual_dial_in_progress=1; - MainPanelToFront(); - buildDiv('DiaLLeaDPrevieW'); - if (alt_phone_dialing == 1) - {buildDiv('DiaLDiaLAltPhonE');} - document.vicidial_form.LeadPreview.checked=false; - // document.vicidial_form.DiaLAltPhonE.checked=true; - ManualDialNext("","",MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode,'0'); + if (waiting_on_dispo > 0) + { + alert_box("Delay System, Riprova
code:" + agent_log_id + " - " + waiting_on_dispo + ""); + } + else + { + var MDLookuPLeaD = 'new'; + if (document.vicidial_form.LeadLookuP.checked==true) + {MDLookuPLeaD = 'lookup';} + + agent_dialed_number=1; + agent_dialed_type='MANUAL_DIALFAST'; + // alt_phone_dialing=1; + auto_dial_level=0; + manual_dial_in_progress=1; + MainPanelToFront(); + buildDiv('DiaLLeaDPrevieW'); + if (alt_phone_dialing == 1) + {buildDiv('DiaLDiaLAltPhonE');} + document.vicidial_form.LeadPreview.checked=false; + // document.vicidial_form.DiaLAltPhonE.checked=true; + ManualDialNext("","",MDDiaLCodEform,MDPhonENumbeRform,MDLookuPLeaD,MDVendorLeadCode,'0'); + } } } @@ -5611,8 +6043,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (alt_dial_status_display=='0') { + var status_display_content=''; + if (status_display_CALLID > 0) {status_display_content = status_display_content + " UID: " + CIDcheck;} + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} + // alert(document.getElementById("MainStatuSSpan").innerHTML); - document.getElementById("MainStatuSSpan").innerHTML = " In Chiamata: " + status_display_number + " UID: " + CIDcheck + "   In attesa dello squillo... " + MD_ring_secondS + " secondi"; + document.getElementById("MainStatuSSpan").innerHTML = " In Chiamata: " + status_display_number + " " + status_display_content + "   In attesa dello squillo... " + MD_ring_secondS + " secondi"; // alert("channel not found yet:\n" + campaign); } } @@ -5649,7 +6086,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var called3rdparty = document.vicidial_form.xfernumber.value; if (hide_xfer_number_to_dial=='ENABLED') {called3rdparty=' ';} - document.getElementById("MainStatuSSpan").innerHTML = " Terzo Numero Chiamato: " + called3rdparty + " UID: " + CIDcheck; + var status_display_content=''; + if (status_display_CALLID > 0) {status_display_content = status_display_content + " UID: " + CIDcheck;} + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} + + document.getElementById("MainStatuSSpan").innerHTML = " Terzo Numero Chiamato: " + called3rdparty + " " + status_display_content; document.getElementById("Leave3WayCall").innerHTML ="\"LASCIA"; @@ -5699,8 +6141,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) MD_channel_look=0; var dispnum = lead_dial_number; var status_display_number = phone_number_format(dispnum); + var status_display_content=''; + if (status_display_CALLID > 0) {status_display_content = status_display_content + " UID: " + CIDcheck;} + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} - document.getElementById("MainStatuSSpan").innerHTML = " Chiamato: " + status_display_number + " UID: " + CIDcheck + "  "; + document.getElementById("MainStatuSSpan").innerHTML = " Chiamato: " + status_display_number + " " + status_display_content + "  "; document.getElementById("ParkControl").innerHTML ="\"Metti"; if ( (ivr_park_call=='ENABLED') || (ivr_park_call=='ENABLED_ATTESA_ONLY') ) @@ -5761,6 +6207,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("QuickXfer").innerHTML = "\"TRASFERIMENTO"; } + if (custom_3way_button_transfer_enabled > 0) + { + document.getElementById("CustomXfer").innerHTML = "\"Personalizzato"; + } + if (call_requeue_button > 0) { var CloserSelectChoices = document.vicidial_form.CloserSelectList.value; @@ -5801,7 +6252,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) delete xmlhttp; } - if (MD_ring_secondS > 49) + if ( (MD_ring_secondS > 49) && (MD_ring_secondS > dial_timeout) ) { MD_channel_look=0; MD_ring_secondS=0; @@ -6007,353 +6458,380 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Send the Manual Chiama il prossimo numero request function ManualDialNext(mdnCBid,mdnBDleadid,mdnDiaLCodE,mdnPhonENumbeR,mdnStagE,mdVendorid,mdgroupalias,mdtype) { - inOUT = 'OUT'; - all_record = 'NO'; - all_record_count=0; - if (dial_method == "INBOUND_MAN") + if (waiting_on_dispo > 0) { - auto_dial_level=0; - - if (VDRP_stage != 'PAUSED') - { - agent_log_id = AutoDial_ReSume_PauSe("VDADpause",'','','',"DIALNEXT",'1','NXDIAL'); - - // PauseCodeSelect_submit("NXDIAL"); - } - else - {auto_dial_level=starting_dial_level;} - - document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; + alert_box("Delay System, Riprova
code:" + agent_log_id + " - " + waiting_on_dispo + ""); } else { - document.getElementById("DiaLControl").innerHTML = "\"Chiama"; - } - if (document.vicidial_form.LeadPreview.checked==true) - { - reselect_preview_dial = 1; - in_lead_preview_state = 1; - var man_preview = 'YES'; - var man_status = "Anteprima del contatto, quindi CHIAMA CLIENTE or SALTA CLIENTE"; - if (manual_preview_dial=='PREVIEW_ONLY') + inOUT = 'OUT'; + all_record = 'NO'; + all_record_count=0; + if (dial_method == "INBOUND_MAN") { - var man_status = "Anteprima del contatto, quindi CHIAMA CLIENTE"; - } - } - else - { - reselect_preview_dial = 0; - var man_preview = 'NO'; - var man_status = "In attesa dello squillo..."; - } + auto_dial_level=0; - if ( (mdtype == 'ALT') || (mdtype == 'ADDR3') ) - { - agent_dialed_type = mdtype; - agent_dialed_number = mdnPhonENumbeR; - } - var xmlhttp=false; - /*@cc_on @*/ - /*@if (@_jscript_version >= 5) - // JScript gives us Conditional compilation, we can cope with old IE versions. - // and security blocked creation of the objects. - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } catch (e) { - try { - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } catch (E) { - xmlhttp = false; - } - } - @end @*/ - if (!xmlhttp && typeof XMLHttpRequest!='undefined') - { - xmlhttp = new XMLHttpRequest(); - } - if (xmlhttp) - { - if (cid_choice.length > 3) - {var call_cid = cid_choice;} - else - {var call_cid = campaign_cid;} - if (prefix_choice.length > 0) - {var call_prefix = prefix_choice;} - else - {var call_prefix = manual_dial_prefix;} - - manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid + "&usegroupalias=" + mdgroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&vtiger_callback_id=" + vtiger_callback_id + "&dial_method=" + dial_method + "&manual_dial_call_time_check=" + manual_dial_call_time_check; - // alert(manual_dial_filter + "\n" +manDiaLnext_query); - xmlhttp.open('POST', 'vdc_db_query.php'); - xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); - xmlhttp.send(manDiaLnext_query); - xmlhttp.onreadystatechange = function() - { - if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + if (VDRP_stage != 'PAUSED') { - var MDnextResponse = null; - // alert(manDiaLnext_query); - // alert(xmlhttp.responseText); - MDnextResponse = xmlhttp.responseText; + agent_log_id = AutoDial_ReSume_PauSe("VDADpause",'','','',"DIALNEXT",'1','NXDIAL'); - var MDnextResponse_array=MDnextResponse.split("\n"); - MDnextCID = MDnextResponse_array[0]; - CognomeCallCID = MDnextResponse_array[0]; + // PauseCodeSelect_submit("NXDIAL"); + } + else + {auto_dial_level=starting_dial_level;} - var regMNCvar = new RegExp("LISTA DI CHIAMATA VUOTA","ig"); - var regMDFvarDNC = new RegExp("DNC","ig"); - var regMDFvarCAMP = new RegExp("CAMPLISTS","ig"); - var regMDFvarTIME = new RegExp("OUTSIDE","ig"); - if ( (MDnextCID.match(regMNCvar)) || (MDnextCID.match(regMDFvarDNC)) || (MDnextCID.match(regMDFvarCAMP)) || (MDnextCID.match(regMDFvarTIME)) ) + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; + } + else + { + document.getElementById("DiaLControl").innerHTML = "\"Chiama"; + } + var manual_dial_only_type_flag = ''; + if ( (mdtype == 'ALT') || (mdtype == 'ADDR3') ) + { + agent_dialed_type = mdtype; + agent_dialed_number = mdnPhonENumbeR; + if (mdtype == 'ALT') + {manual_dial_only_type_flag = 'ALTPhonE';} + if (mdtype == 'ADDR3') + {manual_dial_only_type_flag = 'AddresS3';} + } + if (document.vicidial_form.LeadPreview.checked==true) + { + reselect_preview_dial = 1; + in_lead_preview_state = 1; + var man_preview = 'YES'; + var man_status = "Anteprima del contatto, quindi CHIAMA CLIENTE or SALTA CLIENTE"; + if (manual_preview_dial=='PREVIEW_ONLY') + { + var man_status = "Anteprima del contatto, quindi CHIAMA CLIENTE"; + } + } + else + { + reselect_preview_dial = 0; + var man_preview = 'NO'; + var man_status = "In attesa dello squillo..."; + } + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + if (cid_choice.length > 3) + {var call_cid = cid_choice;} + else + { + var call_cid = campaign_cid; + if (manual_dial_cid == 'AGENT_PHONE') + {call_cid = outbound_cid;} + } + if (prefix_choice.length > 0) + {var call_prefix = prefix_choice;} + else + {var call_prefix = manual_dial_prefix;} + + manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid + "&usegroupalias=" + mdgroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&vtiger_callback_id=" + vtiger_callback_id + "&dial_method=" + dial_method + "&manual_dial_call_time_check=" + manual_dial_call_time_check + "&qm_extension=" + qm_extension; + // alert(manual_dial_filter + "\n" +manDiaLnext_query); + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(manDiaLnext_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - var alert_displayed=0; - trigger_ready=1; - alt_phone_dialing=starting_alt_phone_dialing; - auto_dial_level=starting_dial_level; - MainPanelToFront(); - CalLBacKsCounTCheck(); + var MDnextResponse = null; + // alert(manDiaLnext_query); + // alert(xmlhttp.responseText); + MDnextResponse = xmlhttp.responseText; - if (MDnextCID.match(regMNCvar)) - {alert_box("Non ci sono contatti da chiamare nella campagna:\n" + campaign); alert_displayed=1;} - if (MDnextCID.match(regMDFvarDNC)) - {alert_box("This phone number is in the DNC list:\n" + mdnPhonENumbeR); alert_displayed=1;} - if (MDnextCID.match(regMDFvarCAMP)) - {alert_box("Questo numero di telefono non è presente nell`elenco delle campagne:\n" + mdnPhonENumbeR); alert_displayed=1;} - if (MDnextCID.match(regMDFvarTIME)) - {alert_box("This phone number is outside of the local call time:\n" + mdnPhonENumbeR); alert_displayed=1;} - if (alert_displayed==0) - {alert_box("Errore non specificato:\n" + mdnPhonENumbeR + "|" + MDnextCID); alert_displayed=1;} + var MDnextResponse_array=MDnextResponse.split("\n"); + MDnextCID = MDnextResponse_array[0]; + CognomeCallCID = MDnextResponse_array[0]; - if (starting_dial_level == 0) + var regMNCvar = new RegExp("LISTA DI CHIAMATA VUOTA","ig"); + var regMDFvarDNC = new RegExp("DNC","ig"); + var regMDFvarCAMP = new RegExp("CAMPLISTS","ig"); + var regMDFvarTIME = new RegExp("OUTSIDE","ig"); + if ( (MDnextCID.match(regMNCvar)) || (MDnextCID.match(regMDFvarDNC)) || (MDnextCID.match(regMDFvarCAMP)) || (MDnextCID.match(regMDFvarTIME)) ) { - document.getElementById("DiaLControl").innerHTML = "\"Chiama"; - } - else - { - if (dial_method == "INBOUND_MAN") + var alert_displayed=0; + trigger_ready=1; + alt_phone_dialing=starting_alt_phone_dialing; + auto_dial_level=starting_dial_level; + MainPanelToFront(); + CalLBacKsCounTCheck(); + + if (MDnextCID.match(regMNCvar)) + {alert_box("Non ci sono contatti da chiamare nella campagna:\n" + campaign); alert_displayed=1;} + if (MDnextCID.match(regMDFvarDNC)) + {alert_box("This phone number is in the DNC list:\n" + mdnPhonENumbeR); alert_displayed=1;} + if (MDnextCID.match(regMDFvarCAMP)) + {alert_box("Questo numero di telefono non è presente nell`elenco delle campagne:\n" + mdnPhonENumbeR); alert_displayed=1;} + if (MDnextCID.match(regMDFvarTIME)) + {alert_box("Questo numero di telefono è al di fuori del tempo di chiamata locale:\n" + mdnPhonENumbeR); alert_displayed=1;} + if (alert_displayed==0) + {alert_box("Errore non specificato:\n" + mdnPhonENumbeR + "|" + MDnextCID); alert_displayed=1;} + + if (starting_dial_level == 0) { - auto_dial_level=starting_dial_level; - - document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; + document.getElementById("DiaLControl").innerHTML = "\"Chiama"; } else { - document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML; - } - document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; - reselect_alt_dial = 0; - } - } - else - { - fronter = user; - LasTCID = MDnextResponse_array[0]; - document.vicidial_form.lead_id.value = MDnextResponse_array[1]; - LeaDPreVDispO = MDnextResponse_array[2]; - document.vicidial_form.vendor_lead_code.value = MDnextResponse_array[4]; - document.vicidial_form.list_id.value = MDnextResponse_array[5]; - document.vicidial_form.gmt_offset_now.value = MDnextResponse_array[6]; - document.vicidial_form.phone_code.value = MDnextResponse_array[7]; - if ( (disable_alter_custphone=='Y') || (disable_alter_custphone=='HIDE') ) - { - var tmp_pn = document.getElementById("phone_numberDISP"); - if (disable_alter_custphone=='Y') - { - tmp_pn.innerHTML = MDnextResponse_array[8]; - } - } - document.vicidial_form.phone_number.value = MDnextResponse_array[8]; - document.vicidial_form.title.value = MDnextResponse_array[9]; - document.vicidial_form.first_name.value = MDnextResponse_array[10]; - document.vicidial_form.middle_initial.value = MDnextResponse_array[11]; - document.vicidial_form.last_name.value = MDnextResponse_array[12]; - document.vicidial_form.address1.value = MDnextResponse_array[13]; - document.vicidial_form.address2.value = MDnextResponse_array[14]; - document.vicidial_form.address3.value = MDnextResponse_array[15]; - document.vicidial_form.city.value = MDnextResponse_array[16]; - document.vicidial_form.state.value = MDnextResponse_array[17]; - document.vicidial_form.province.value = MDnextResponse_array[18]; - document.vicidial_form.postal_code.value = MDnextResponse_array[19]; - document.vicidial_form.country_code.value = MDnextResponse_array[20]; - document.vicidial_form.gender.value = MDnextResponse_array[21]; - document.vicidial_form.date_of_birth.value = MDnextResponse_array[22]; - document.vicidial_form.alt_phone.value = MDnextResponse_array[23]; - document.vicidial_form.email.value = MDnextResponse_array[24]; - document.vicidial_form.security_phrase.value = MDnextResponse_array[25]; - var REGcommentsNL = new RegExp("!N","g"); - MDnextResponse_array[26] = MDnextResponse_array[26].replace(REGcommentsNL, "\n"); - document.vicidial_form.comments.value = MDnextResponse_array[26]; - document.vicidial_form.called_count.value = MDnextResponse_array[27]; - previous_called_count = MDnextResponse_array[27]; - previous_dispo = MDnextResponse_array[2]; - CBentry_time = MDnextResponse_array[28]; - CBcallback_time = MDnextResponse_array[29]; - CBuser = MDnextResponse_array[30]; - CBcomments = MDnextResponse_array[31]; - dialed_number = MDnextResponse_array[32]; - dialed_label = MDnextResponse_array[33]; - source_id = MDnextResponse_array[34]; - document.vicidial_form.rank.value = MDnextResponse_array[35]; - document.vicidial_form.owner.value = MDnextResponse_array[36]; - // CalL_ScripT_id = MDnextResponse_array[37]; - script_recording_delay = MDnextResponse_array[38]; - CalL_XC_a_NuMber = MDnextResponse_array[39]; - CalL_XC_b_NuMber = MDnextResponse_array[40]; - CalL_XC_c_NuMber = MDnextResponse_array[41]; - CalL_XC_d_NuMber = MDnextResponse_array[42]; - CalL_XC_e_NuMber = MDnextResponse_array[43]; - document.vicidial_form.entry_list_id.value = MDnextResponse_array[44]; - custom_field_names = MDnextResponse_array[45]; - custom_field_values = MDnextResponse_array[46]; - custom_field_types = MDnextResponse_array[47]; - var list_webform = MDnextResponse_array[48]; - var list_webform_two = MDnextResponse_array[49]; - - timer_action = campaign_timer_action; - timer_action_message = campaign_timer_action_message; - timer_action_seconds = campaign_timer_action_seconds; - timer_action_destination = campaign_timer_action_destination; - - lead_dial_number = dialed_number; - var dispnum = dialed_number; - var status_display_number = phone_number_format(dispnum); - - document.getElementById("MainStatuSSpan").innerHTML = " In Chiamata: " + status_display_number + " UID: " + MDnextCID + "   " + man_status; - if ( (dialed_label.length < 2) || (dialed_label=='NONE') ) {dialed_label='MAIN';} - - if (hide_gender > 0) - { - document.vicidial_form.gender_list.value = MDnextResponse_array[21]; - } - else - { - var gIndex = 0; - if (document.vicidial_form.gender.value == 'M') {var gIndex = 1;} - if (document.vicidial_form.gender.value == 'F') {var gIndex = 2;} - document.getElementById("gender_list").selectedIndex = gIndex; - var genderIndex = document.getElementById("gender_list").selectedIndex; - var genderValue = document.getElementById('gender_list').options[genderIndex].value; - document.vicidial_form.gender.value = genderValue; - } - - LeaDDispO=''; - - VDIC_web_form_address = VICIDiaL_web_form_address - VDIC_web_form_address_two = VICIDiaL_web_form_address_two - if (list_webform.length > 5) {VDIC_web_form_address=list_webform;} - if (list_webform_two.length > 5) {VDIC_web_form_address_two=list_webform_two;} - - var regWFAcustom = new RegExp("^VAR","ig"); - if (VDIC_web_form_address.match(regWFAcustom)) - { - TEMP_VDIC_web_form_address = URLDecode(VDIC_web_form_address,'YES','CUSTOM'); - TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, ''); - } - else - { - TEMP_VDIC_web_form_address = URLDecode(VDIC_web_form_address,'YES','DEFAULT','1'); - } - - if (VDIC_web_form_address_two.match(regWFAcustom)) - { - TEMP_VDIC_web_form_address_two = URLDecode(VDIC_web_form_address_two,'YES','CUSTOM'); - TEMP_VDIC_web_form_address_two = TEMP_VDIC_web_form_address_two.replace(regWFAcustom, ''); - } - else - { - TEMP_VDIC_web_form_address_two = URLDecode(VDIC_web_form_address_two,'YES','DEFAULT','2'); - } - - document.getElementById("WebFormSpan").innerHTML = "\"Web\n"; - if (enable_second_webform > 0) - { - document.getElementById("WebFormSpanTwo").innerHTML = "\"Web\n"; - } - - if (CBentry_time.length > 2) - { - document.getElementById("CusTInfOSpaN").innerHTML = " PREVIOUS CHIAMATABACK "; - document.getElementById("CusTInfOSpaN").style.background = CusTCB_bgcolor; - document.getElementById("CBcommentsBoxA").innerHTML = "Ultima Chiamata:" + CBentry_time; - document.getElementById("CBcommentsBoxB").innerHTML = "Richiamo:" + CBcallback_time; - document.getElementById("CBcommentsBoxC").innerHTML = "Operatore:" + CBuser; - document.getElementById("CBcommentsBoxD").innerHTML = "Note:
" + CBcomments; - showDiv('CBcommentsBox'); - } - - if (document.vicidial_form.LeadPreview.checked==false) - { - reselect_preview_dial = 0; - MD_channel_look=1; - custchannellive=1; - - document.getElementById("HangupControl").innerHTML = "\"Riaggancia"; - - if ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) - {all_record = 'YES';} - - if ( (view_scripts == 1) && (campaign_script.length > 0) ) - { - var SCRIPT_web_form = 'http://127.0.0.1/testing.php'; - var TEMP_SCRIPT_web_form = URLDecode(SCRIPT_web_form,'YES','DEFAULT','1'); - - if ( (script_recording_delay > 0) && ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) ) + if (dial_method == "INBOUND_MAN") { - delayed_script_load = 'YES'; - RefresHScript('CLEAR'); + auto_dial_level=starting_dial_level; + + document.getElementById("DiaLControl").innerHTML = "\"\"Riprendi\"
\"Chiama"; } else { - load_script_contents(); + document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML; } + document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + reselect_alt_dial = 0; } - - if (custom_fields_enabled > 0) - { - FormContentsLoad(); - } - if (get_call_launch == 'SCRIPT') - { - if (delayed_script_load == 'YES') - { - load_script_contents(); - } - ScriptPanelToFront(); - } - - if (get_call_launch == 'FORM') - { - FormPanelToFront(); - } - - - if (get_call_launch == 'WEBFORM') - { - window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); - } - if (get_call_launch == 'WEBFORMTWO') - { - window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); - } - } else { - reselect_preview_dial = 1; + fronter = user; + LasTCID = MDnextResponse_array[0]; + document.vicidial_form.lead_id.value = MDnextResponse_array[1]; + LeaDPreVDispO = MDnextResponse_array[2]; + document.vicidial_form.vendor_lead_code.value = MDnextResponse_array[4]; + document.vicidial_form.list_id.value = MDnextResponse_array[5]; + document.vicidial_form.gmt_offset_now.value = MDnextResponse_array[6]; + document.vicidial_form.phone_code.value = MDnextResponse_array[7]; + if ( (disable_alter_custphone=='Y') || (disable_alter_custphone=='HIDE') ) + { + var tmp_pn = document.getElementById("phone_numberDISP"); + if (disable_alter_custphone=='Y') + { + tmp_pn.innerHTML = MDnextResponse_array[8]; + } + } + document.vicidial_form.phone_number.value = MDnextResponse_array[8]; + document.vicidial_form.title.value = MDnextResponse_array[9]; + document.vicidial_form.first_name.value = MDnextResponse_array[10]; + document.vicidial_form.middle_initial.value = MDnextResponse_array[11]; + document.vicidial_form.last_name.value = MDnextResponse_array[12]; + document.vicidial_form.address1.value = MDnextResponse_array[13]; + document.vicidial_form.address2.value = MDnextResponse_array[14]; + document.vicidial_form.address3.value = MDnextResponse_array[15]; + document.vicidial_form.city.value = MDnextResponse_array[16]; + document.vicidial_form.state.value = MDnextResponse_array[17]; + document.vicidial_form.province.value = MDnextResponse_array[18]; + document.vicidial_form.postal_code.value = MDnextResponse_array[19]; + document.vicidial_form.country_code.value = MDnextResponse_array[20]; + document.vicidial_form.gender.value = MDnextResponse_array[21]; + document.vicidial_form.date_of_birth.value = MDnextResponse_array[22]; + document.vicidial_form.alt_phone.value = MDnextResponse_array[23]; + document.vicidial_form.email.value = MDnextResponse_array[24]; + document.vicidial_form.security_phrase.value = MDnextResponse_array[25]; + var REGcommentsNL = new RegExp("!N","g"); + MDnextResponse_array[26] = MDnextResponse_array[26].replace(REGcommentsNL, "\n"); + document.vicidial_form.comments.value = MDnextResponse_array[26]; + document.vicidial_form.called_count.value = MDnextResponse_array[27]; + previous_called_count = MDnextResponse_array[27]; + previous_dispo = MDnextResponse_array[2]; + CBentry_time = MDnextResponse_array[28]; + CBcallback_time = MDnextResponse_array[29]; + CBuser = MDnextResponse_array[30]; + CBcomments = MDnextResponse_array[31]; + dialed_number = MDnextResponse_array[32]; + dialed_label = MDnextResponse_array[33]; + source_id = MDnextResponse_array[34]; + document.vicidial_form.rank.value = MDnextResponse_array[35]; + document.vicidial_form.owner.value = MDnextResponse_array[36]; + // CalL_ScripT_id = MDnextResponse_array[37]; + script_recording_delay = MDnextResponse_array[38]; + CalL_XC_a_NuMber = MDnextResponse_array[39]; + CalL_XC_b_NuMber = MDnextResponse_array[40]; + CalL_XC_c_NuMber = MDnextResponse_array[41]; + CalL_XC_d_NuMber = MDnextResponse_array[42]; + CalL_XC_e_NuMber = MDnextResponse_array[43]; + document.vicidial_form.entry_list_id.value = MDnextResponse_array[44]; + custom_field_names = MDnextResponse_array[45]; + custom_field_values = MDnextResponse_array[46]; + custom_field_types = MDnextResponse_array[47]; + var list_webform = MDnextResponse_array[48]; + var list_webform_two = MDnextResponse_array[49]; + post_phone_time_diff_alert_message = MDnextResponse_array[50]; + + timer_action = campaign_timer_action; + timer_action_message = campaign_timer_action_message; + timer_action_seconds = campaign_timer_action_seconds; + timer_action_destination = campaign_timer_action_destination; + + lead_dial_number = dialed_number; + var dispnum = dialed_number; + var status_display_number = phone_number_format(dispnum); + var status_display_content=''; + if (status_display_CALLID > 0) {status_display_content = status_display_content + " UID: " + MDnextCID;} + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} + + document.getElementById("MainStatuSSpan").innerHTML = " In Chiamata: " + status_display_number + " " + status_display_content + "   " + man_status; + if ( (dialed_label.length < 2) || (dialed_label=='NONE') ) {dialed_label='MAIN';} + + if (hide_gender > 0) + { + document.vicidial_form.gender_list.value = MDnextResponse_array[21]; + } + else + { + var gIndex = 0; + if (document.vicidial_form.gender.value == 'M') {var gIndex = 1;} + if (document.vicidial_form.gender.value == 'F') {var gIndex = 2;} + document.getElementById("gender_list").selectedIndex = gIndex; + var genderIndex = document.getElementById("gender_list").selectedIndex; + var genderValue = document.getElementById('gender_list').options[genderIndex].value; + document.vicidial_form.gender.value = genderValue; + } + + LeaDDispO=''; + + VDIC_web_form_address = VICIDiaL_web_form_address + VDIC_web_form_address_two = VICIDiaL_web_form_address_two + if (list_webform.length > 5) {VDIC_web_form_address=list_webform;} + if (list_webform_two.length > 5) {VDIC_web_form_address_two=list_webform_two;} + + var regWFAcustom = new RegExp("^VAR","ig"); + if (VDIC_web_form_address.match(regWFAcustom)) + { + TEMP_VDIC_web_form_address = URLDecode(VDIC_web_form_address,'YES','CUSTOM'); + TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, ''); + } + else + { + TEMP_VDIC_web_form_address = URLDecode(VDIC_web_form_address,'YES','DEFAULT','1'); + } + + if (VDIC_web_form_address_two.match(regWFAcustom)) + { + TEMP_VDIC_web_form_address_two = URLDecode(VDIC_web_form_address_two,'YES','CUSTOM'); + TEMP_VDIC_web_form_address_two = TEMP_VDIC_web_form_address_two.replace(regWFAcustom, ''); + } + else + { + TEMP_VDIC_web_form_address_two = URLDecode(VDIC_web_form_address_two,'YES','DEFAULT','2'); + } + + document.getElementById("WebFormSpan").innerHTML = "\"Web\n"; + if (enable_second_webform > 0) + { + document.getElementById("WebFormSpanTwo").innerHTML = "\"Web\n"; + } + + if (CBentry_time.length > 2) + { + document.getElementById("CusTInfOSpaN").innerHTML = " PREVIOUS CHIAMATABACK "; + document.getElementById("CusTInfOSpaN").style.background = CusTCB_bgcolor; + document.getElementById("CBcommentsBoxA").innerHTML = "Ultima Chiamata:" + CBentry_time; + document.getElementById("CBcommentsBoxB").innerHTML = "Richiamo:" + CBcallback_time; + document.getElementById("CBcommentsBoxC").innerHTML = "Operatore:" + CBuser; + document.getElementById("CBcommentsBoxD").innerHTML = "Note:
" + CBcomments; + showDiv('CBcommentsBox'); + } + + if (post_phone_time_diff_alert_message.length > 10) + { + document.getElementById("post_phone_time_diff_span_contents").innerHTML = "     " + post_phone_time_diff_alert_message + "
"; + showDiv('post_phone_time_diff_span'); + } + + if (document.vicidial_form.LeadPreview.checked==false) + { + reselect_preview_dial = 0; + MD_channel_look=1; + custchannellive=1; + + document.getElementById("HangupControl").innerHTML = "\"Riaggancia"; + + if ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) + {all_record = 'YES';} + + if ( (view_scripts == 1) && (campaign_script.length > 0) ) + { + var SCRIPT_web_form = 'http://127.0.0.1/testing.php'; + var TEMP_SCRIPT_web_form = URLDecode(SCRIPT_web_form,'YES','DEFAULT','1'); + + if ( (script_recording_delay > 0) && ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) ) + { + delayed_script_load = 'YES'; + RefresHScript('CLEAR'); + } + else + { + load_script_contents(); + } + } + + if (custom_fields_enabled > 0) + { + FormContentsLoad(); + } + if (get_call_launch == 'SCRIPT') + { + if (delayed_script_load == 'YES') + { + load_script_contents(); + } + ScriptPanelToFront(); + } + + if (get_call_launch == 'FORM') + { + FormPanelToFront(); + } + + + if (get_call_launch == 'WEBFORM') + { + window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + } + if (get_call_launch == 'WEBFORMTWO') + { + window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + } + + } + else + { + reselect_preview_dial = 1; + } } } } - } - delete xmlhttp; + delete xmlhttp; - if (document.vicidial_form.LeadPreview.checked==false) - { - active_group_alias=''; - cid_choice=''; - prefix_choice=''; - agent_dialed_number=''; - agent_dialed_type=''; - CalL_ScripT_id=''; + if (document.vicidial_form.LeadPreview.checked==false) + { + active_group_alias=''; + cid_choice=''; + prefix_choice=''; + agent_dialed_number=''; + agent_dialed_type=''; + CalL_ScripT_id=''; + } } } } @@ -6402,7 +6880,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - manDiaLskip_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLskip&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&stage=" + previous_dispo + "&called_count=" + previous_called_count; + manDiaLskip_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLskip&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&stage=" + previous_dispo + "&called_count=" + previous_called_count + "&campaign=" + campaign; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(manDiaLskip_query); @@ -6462,6 +6940,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) previous_dispo = ''; custchannellive=1; + if (post_phone_time_diff_alert_message.length > 10) + { + document.getElementById("post_phone_time_diff_span_contents").innerHTML = ""; + hideDiv('post_phone_time_diff_span'); + } + document.getElementById("MainStatuSSpan").innerHTML = " Lead skipped, go su to next lead"; if (dial_method == "INBOUND_MAN") @@ -6573,13 +7057,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) usegroupalias=1; } else - {var call_cid = campaign_cid;} + { + var call_cid = campaign_cid; + if (manual_dial_cid == 'AGENT_PHONE') + {call_cid = outbound_cid;} + } if (prefix_choice.length > 0) {var call_prefix = prefix_choice;} else {var call_prefix = manual_dial_prefix;} - manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id + "&security=" + document.vicidial_form.security_phrase.value; + manDiaLonly_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLonly&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_number=" + manDiaLonly_num + "&phone_code=" + document.vicidial_form.phone_code.value + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&omit_phone_code=" + omit_phone_code + "&usegroupalias=" + usegroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&dial_method=" + dial_method + "&agent_log_id=" + agent_log_id + "&security=" + document.vicidial_form.security_phrase.value + "&qm_extension=" + qm_extension + "&old_CID=" + CognomeCallCID; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(manDiaLonly_query); @@ -6611,7 +7099,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (alt_dial_status_display=='0') { - document.getElementById("MainStatuSSpan").innerHTML = " In Chiamata: " + status_display_number + " UID: " + MDnextCID + "   In attesa dello squillo..."; + var status_display_content=''; + if (status_display_CALLID > 0) {status_display_content = status_display_content + " UID: " + MDnextCID;} + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} + + document.getElementById("MainStatuSSpan").innerHTML = " In Chiamata: " + status_display_number + " " + status_display_content + "   In attesa dello squillo..."; document.getElementById("HangupControl").innerHTML = "\"Riaggancia"; } @@ -6748,7 +7241,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - autoDiaLready_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=" + taskaction + "&user=" + user + "&pass=" + pass + "&stage=" + VDRP_stage + "&agent_log_id=" + agent_log_id + "&agent_log=" + taskagentlog + "&wrapup=" + taskwrapup + "&campaign=" + campaign + "&dial_method" + dial_method + "&comments=" + taskstatuschange + add_pause_code; + autoDiaLready_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=" + taskaction + "&user=" + user + "&pass=" + pass + "&stage=" + VDRP_stage + "&agent_log_id=" + agent_log_id + "&agent_log=" + taskagentlog + "&wrapup=" + taskwrapup + "&campaign=" + campaign + "&dial_method" + dial_method + "&comments=" + taskstatuschange + add_pause_code + "&qm_extension=" + qm_extension; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(autoDiaLready_query); @@ -6766,6 +7259,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } delete xmlhttp; } + waiting_on_dispo=0; return agent_log_id; } @@ -7165,7 +7659,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var callnum = dialed_number; var dial_display_number = phone_number_format(callnum); - document.getElementById("MainStatuSSpan").innerHTML = " In entrata: " + dial_display_number + " " + custom_call_id + " UID: " + CIDcheck + "   " + VDIC_fronter; + var status_display_content=''; + if (status_display_CALLID > 0) {status_display_content = status_display_content + " UID: " + LasTCID;} + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} + + document.getElementById("MainStatuSSpan").innerHTML = " In entrata: " + dial_display_number + " " + custom_call_id + " " + status_display_content + "   " + VDIC_fronter; if (CBentry_time.length > 2) { @@ -7211,7 +7710,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var callnum = dialed_number; var dial_display_number = phone_number_format(callnum); - document.getElementById("MainStatuSSpan").innerHTML = " In entrata: " + dial_display_number + " " + custom_call_id + " Group- " + VDIC_data_VDIG[1] + "   " + VDIC_fronter; + var status_display_content=''; + if (status_display_CALLID > 0) {status_display_content = status_display_content + " UID: " + CIDcheck;} + if (status_display_LEADID > 0) {status_display_content = status_display_content + " Lead: " + document.vicidial_form.lead_id.value;} + if (status_display_LISTID > 0) {status_display_content = status_display_content + " List: " + document.vicidial_form.list_id.value;} + + document.getElementById("MainStatuSSpan").innerHTML = " In entrata: " + dial_display_number + " " + custom_call_id + " Group- " + VDIC_data_VDIG[1] + "   " + VDIC_fronter + " " + status_display_content; } document.getElementById("ParkControl").innerHTML ="\"Metti"; @@ -7268,6 +7772,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("QuickXfer").innerHTML = "\"TRASFERIMENTO"; } + if (custom_3way_button_transfer_enabled > 0) + { + document.getElementById("CustomXfer").innerHTML = "\"Personalizzato"; + } + + if (call_requeue_button > 0) { var CloserSelectChoices = document.vicidial_form.CloserSelectList.value; @@ -7640,7 +8150,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var queryCID = "HLvdcW" + epoch_sec + user_abb; var hangupvalue = customer_channel; // alert(auto_dial_level + "|" + CalLCID + "|" + customer_server_ip + "|" + hangupvalue + "|" + VD_live_call_secondS); - custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id + "&campaign=" + group + "&stage=CALLHANGUP&nodeletevdac=" + nodeletevdac + "&log_campaign=" + campaign; + custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id + "&campaign=" + group + "&stage=CALLHANGUP&nodeletevdac=" + nodeletevdac + "&log_campaign=" + campaign + "&qm_extension=" + qm_extension; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(custhangup_query); @@ -7720,6 +8230,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) lastcustchannel=''; lastcustserverip=''; MDchannel=''; + if (post_phone_time_diff_alert_message.length > 10) + { + document.getElementById("post_phone_time_diff_span_contents").innerHTML = ""; + hideDiv('post_phone_time_diff_span'); + post_phone_time_diff_alert_message=''; + } if( document.images ) { document.images['livecall'].src = image_livecall_OFF.src;} document.getElementById("WebFormSpan").innerHTML = "\"Web"; @@ -7743,6 +8259,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (quick_transfer_button_enabled > 0) {document.getElementById("QuickXfer").innerHTML = "\"TRASFERIMENTO";} + if (custom_3way_button_transfer_enabled > 0) + {document.getElementById("CustomXfer").innerHTML = "\"Personalizzato";} + if (call_requeue_button > 0) { document.getElementById("ReQueueCall").innerHTML = "\"Re-Queue"; @@ -7769,8 +8288,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (hotkeysused == 'YES') { + alt_dial_active = 0; + alt_dial_status_display = 0; reselect_alt_dial = 0; - manual_auto_hotkey = 1; + manual_auto_hotkey = 2; } } } @@ -7779,7 +8300,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (hotkeysused == 'YES') { - manual_auto_hotkey = 1; + alt_dial_active = 0; + alt_dial_status_display = 0; + manual_auto_hotkey = 2; } else { @@ -7807,8 +8330,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (hotkeysused == 'YES') { - manual_auto_hotkey = 1; + manual_auto_hotkey = 2; alt_dial_active=0; + alt_dial_status_display = 0; document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; document.getElementById("MainStatuSSpan").innerHTML = ''; @@ -7885,7 +8409,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { var queryCID = "HXvdcW" + epoch_sec + user_abb; var hangupvalue = xfer_channel; - custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&queryCID=" + queryCID + "&log_campaign=" + campaign; + custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&queryCID=" + queryCID + "&log_campaign=" + campaign + "&qm_extension=" + qm_extension; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(custhangup_query); @@ -7912,6 +8436,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) XDnextCID = ''; XDcheck = ''; xferchannellive=0; + consult_custom_wait=0; + consult_custom_go=0; + consult_custom_sent=0; + // DEACTIVATE CHANNEL-DEPENDANT BUTTONS AND VARIABLES document.vicidial_form.xferchannel.value = ""; @@ -7959,7 +8487,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (xmlhttp) { var queryCID = "HTvdcW" + epoch_sec + user_abb; - custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=HangupConfDial&format=text&user=" + user + "&pass=" + pass + "&exten=" + session_id + "&ext_context=" + ext_context + "&queryCID=" + queryCID + "&log_campaign=" + campaign; + custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=HangupConfDial&format=text&user=" + user + "&pass=" + pass + "&exten=" + session_id + "&ext_context=" + ext_context + "&queryCID=" + queryCID + "&log_campaign=" + campaign + "&qm_extension=" + qm_extension; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(custhangup_query); @@ -7982,7 +8510,6 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Update vicidial_list lead record with all altered values from form function CustomerData_update() { - var REGcommentsAMP = new RegExp('&',"g"); var REGcommentsQUES = new RegExp("\\?","g"); var REGcommentsPOUND = new RegExp("\\#","g"); @@ -8059,68 +8586,83 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Generate the Call Disposition Chooser panel function DispoSelectContent_create(taskDSgrp,taskDSstage) { - if (customer_3way_hangup_dispo_message.length > 1) + if (disable_dispo_screen > 0) { - document.getElementById("Dispo3wayMessage").innerHTML = "
" + customer_3way_hangup_dispo_message + "
"; - } - if (APIManualDialQueue > 0) - { - document.getElementById("DispoManualQueueMessage").innerHTML = "
Manual Dial Queue Calls Waiting: " + APIManualDialQueue + "
"; - } - if (per_call_notes == 'ENABLED') - { - var test_notes = document.vicidial_form.call_notes_dispo.value; - if (test_notes.length > 0) - {document.vicidial_form.call_notes.value = document.vicidial_form.call_notes_dispo.value} - document.getElementById("PerCallNoteContent").innerHTML = "
Call Note:
"; + document.vicidial_form.DispoSelection.value = disable_dispo_status; + DispoSelect_submit(); } else { - document.getElementById("PerCallNoteContent").innerHTML = ""; - } - - HidEGenDerPulldown(); - AgentDispoing = 1; - var CBflag = ''; - var VD_statuses_ct_half = parseInt(VARSELstatuses_ct / 2); - var dispo_HTML = "
ESITO CHIAMATA
"; - var loop_ct = 0; - var print_ct = 0; - while (loop_ct < VD_statuses_ct) - { - if (VARSELstatuses[loop_ct] == 'Y') + if (customer_3way_hangup_dispo_message.length > 1) { - if (VARCBstatuses[loop_ct] == 'Y') - {CBflag = '*';} - else - {CBflag = '';} - if (taskDSgrp == VARstatuses[loop_ct]) - { - dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; - } - else - { - dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; - } - if (print_ct == VD_statuses_ct_half) - {dispo_HTML = dispo_HTML + "
";} - print_ct++; + document.getElementById("Dispo3wayMessage").innerHTML = "
" + customer_3way_hangup_dispo_message + "
"; + } + if (APIManualDialQueue > 0) + { + document.getElementById("DispoManualQueueMessage").innerHTML = "
Coda Selezione manuale chiamate in attesa: " + APIManualDialQueue + "
"; + } + if (per_call_notes == 'ENABLED') + { + var test_notes = document.vicidial_form.call_notes_dispo.value; + if (test_notes.length > 0) + {document.vicidial_form.call_notes.value = document.vicidial_form.call_notes_dispo.value} + document.getElementById("PerCallNoteContent").innerHTML = "
Chiamate Note:
"; + } + else + { + document.getElementById("PerCallNoteContent").innerHTML = ""; } - loop_ct++; - } - dispo_HTML = dispo_HTML + "
"; - if (taskDSstage == 'ReSET') {document.vicidial_form.DispoSelection.value = '';} - else {document.vicidial_form.DispoSelection.value = taskDSgrp;} - - document.getElementById("DispoSelectContent").innerHTML = dispo_HTML; - if (focus_blur_enabled==1) - { - document.inert_form.inert_button.focus(); - document.inert_form.inert_button.blur(); + HidEGenDerPulldown(); + AgentDispoing = 1; + var CBflag = ''; + var VD_statuses_ct_half = parseInt(VARSELstatuses_ct / 2); + var dispo_HTML = "
ESITO CHIAMATA
"; + var loop_ct = 0; + var print_ct = 0; + if (hide_dispo_list < 1) + { + while (loop_ct < VD_statuses_ct) + { + if (VARSELstatuses[loop_ct] == 'Y') + { + if (VARCBstatuses[loop_ct] == 'Y') + {CBflag = '*';} + else + {CBflag = '';} + if (taskDSgrp == VARstatuses[loop_ct]) + { + dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; + } + else + { + dispo_HTML = dispo_HTML + "" + VARstatuses[loop_ct] + " - " + VARstatusnames[loop_ct] + " " + CBflag + "

"; + } + if (print_ct == VD_statuses_ct_half) + {dispo_HTML = dispo_HTML + "
";} + print_ct++; + } + loop_ct++; + } + } + else + { + dispo_HTML = dispo_HTML + "Condizione nella Lista Disposizione Nascosto

"; + } + dispo_HTML = dispo_HTML + "
"; + + if (taskDSstage == 'ReSET') {document.vicidial_form.DispoSelection.value = '';} + else {document.vicidial_form.DispoSelection.value = taskDSgrp;} + + document.getElementById("DispoSelectContent").innerHTML = dispo_HTML; + if (focus_blur_enabled==1) + { + document.inert_form.inert_button.focus(); + document.inert_form.inert_button.blur(); + } + if (my_callback_option == 'CHECKED') + {document.vicidial_form.CallBackOnlyMe.checked=true;} } - if (my_callback_option == 'CHECKED') - {document.vicidial_form.CallBackOnlyMe.checked=true;} } // ################################################################################ @@ -8194,7 +8736,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else { move_on=0; - alert_box("YOU MUST BE PAUSED TO SEARCH FOR A LEAD"); + alert_box("DEVI ESSERE IN PAUSA PER CERCARE DI PIOMBO"); } } if (move_on == 1) @@ -8205,6 +8747,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } } + +// ################################################################################ +// Generate the Contacts Search span content + function generate_contacts_search() + { + HidEGenDerPulldown(); + showDiv('SearcHContactsDisplaYBox'); + } + + // ################################################################################ // Generate the Presets Chooser span content function generate_presets_pulldown() @@ -8216,7 +8768,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var loop_ct = 0; while (loop_ct < VD_preset_names_ct) { - Presets_HTML = Presets_HTML + "" + VARpreset_names[loop_ct]; + Presets_HTML = Presets_HTML + "" + VARpreset_names[loop_ct]; if (VARpreset_hide_numbers[loop_ct]=='N') {Presets_HTML = Presets_HTML + " - " + VARpreset_numbers[loop_ct];} Presets_HTML = Presets_HTML + "
"; @@ -8225,35 +8777,35 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if ( (CalL_XC_a_NuMber.length > 0) || (CalL_XC_a_Dtmf.length > 0) ) { - Presets_HTML = Presets_HTML + "D1"; + Presets_HTML = Presets_HTML + "D1"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_a_NuMber;} Presets_HTML = Presets_HTML + "
"; } if ( (CalL_XC_b_NuMber.length > 0) || (CalL_XC_b_Dtmf.length > 0) ) { - Presets_HTML = Presets_HTML + "D2"; + Presets_HTML = Presets_HTML + "D2"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_b_NuMber;} Presets_HTML = Presets_HTML + "
"; } if (CalL_XC_c_NuMber.length > 0) { - Presets_HTML = Presets_HTML + "D3"; + Presets_HTML = Presets_HTML + "D3"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_c_NuMber;} Presets_HTML = Presets_HTML + "
"; } if (CalL_XC_d_NuMber.length > 0) { - Presets_HTML = Presets_HTML + "D4"; + Presets_HTML = Presets_HTML + "D4"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_d_NuMber;} Presets_HTML = Presets_HTML + "
"; } if (CalL_XC_e_NuMber.length > 0) { - Presets_HTML = Presets_HTML + "D5"; + Presets_HTML = Presets_HTML + "D5"; if (hide_xfer_number_to_dial=='DISABLED') {Presets_HTML = Presets_HTML + " - " + CalL_XC_e_NuMber;} Presets_HTML = Presets_HTML + "
"; @@ -8266,8 +8818,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // ################################################################################ // Submit chosen Preset - function PresetSelect_submit(taskpresetname,taskpresetnumber,taskpresetdtmf,taskhidenumber) + function PresetSelect_submit(taskpresetname,taskpresetnumber,taskpresetdtmf,taskhidenumber,taskclosesearch) { + if (taskclosesearch=='Y') + { + hideDiv('SearcHResultSContactsBox'); + hideDiv('SearcHContactsDisplaYBox'); + } hideDiv('PresetsSelectBox'); document.vicidial_form.conf_dtmf.value = taskpresetdtmf; document.vicidial_form.xfername.value = taskpresetname; @@ -8373,6 +8930,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) CheckDEADcallON=0; customer_3way_hangup_counter=0; customer_3way_hangup_counter_trigger=0; + waiting_on_dispo=1; document.getElementById("callchannel").innerHTML = ''; document.vicidial_form.callserverip.value = ''; document.vicidial_form.xferchannel.value = ''; @@ -8385,6 +8943,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (DispoChoice.length < 1) {alert_box("Devi selezionare un esito");} else { + if (document.vicidial_form.DiaLAltPhonE.checked==true) + { + var man_status = ""; + document.getElementById("MainStatuSSpan").innerHTML = man_status; + alt_dial_status_display = 0; + } document.getElementById("CusTInfOSpaN").innerHTML = ""; document.getElementById("CusTInfOSpaN").style.background = panel_bgcolor; var regCBstatus = new RegExp(' ' + DispoChoice + ' ',"ig"); @@ -8412,7 +8976,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&CallBackLeadStato=" + CallBackLeadStato + "&comments=" + CallBackCommenTs + "&custom_field_names=" + custom_field_names + "&call_notes=" + document.vicidial_form.call_notes_dispo.value; + DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&CallBackLeadStato=" + CallBackLeadStato + "&comments=" + CallBackCommenTs + "&custom_field_names=" + custom_field_names + "&call_notes=" + document.vicidial_form.call_notes_dispo.value + "&qm_dispo_code=" + DispoQMcsCODE; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(DSupdate_query); @@ -8420,16 +8984,20 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { // alert(DSupdate_query + "\n" +xmlhttp.responseText); - if ( (xmlhttp.readyState == 4 && xmlhttp.status == 200) && (auto_dial_level < 1) ) + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - var check_dispo = null; - check_dispo = xmlhttp.responseText; - var check_DS_array=check_dispo.split("\n"); - // alert(xmlhttp.responseText + "\n|" + check_DS_array[1] + "\n|" + check_DS_array[2] + "|"); - if (check_DS_array[1] == 'Next agent_log_id:') + // alert(xmlhttp.responseText); + if (auto_dial_level < 1) { - agent_log_id = check_DS_array[2]; + var check_dispo = null; + check_dispo = xmlhttp.responseText; + var check_DS_array=check_dispo.split("\n"); + if (check_DS_array[1] == 'Next agent_log_id:') + { + agent_log_id = check_DS_array[2]; + } } + waiting_on_dispo=0; } } delete xmlhttp; @@ -8511,6 +9079,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) custom_field_types=''; customerparked=0; customerparkedcounter=0; + consult_custom_wait=0; + consult_custom_go=0; + consult_custom_sent=0; document.getElementById("ParkCounterSpan").innerHTML = ''; document.vicidial_form.xfername.value=''; document.vicidial_form.xfernumhidden.value=''; @@ -8522,6 +9093,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) APIManualDialQueue_last=0; document.vicidial_form.FORM_LOADED.value = '0'; CallBackLeadStato = ''; + CallBackDatETimE=''; + CallBackrecipient=''; + CallBackCommenTs=''; + DispoQMcsCODE=''; + document.vicidial_form.CallBackDatESelectioN.value = ''; + document.vicidial_form.CallBackCommenTsField.value = ''; + document.vicidial_form.search_phone_number.value=''; document.vicidial_form.search_lead_id.value=''; document.vicidial_form.search_vendor_lead_code.value=''; @@ -8534,6 +9112,14 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.MDDiaLOverridE.value = ''; document.vicidial_form.MDLeadID.value = ''; document.vicidial_form.MDType.value = ''; + document.vicidial_form.MDPhonENumbeRHiddeN.value = ''; + + if (post_phone_time_diff_alert_message.length > 10) + { + document.getElementById("post_phone_time_diff_span_contents").innerHTML = ""; + hideDiv('post_phone_time_diff_span'); + post_phone_time_diff_alert_message=''; + } if (manual_dial_in_progress==1) { @@ -8554,10 +9140,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) CBcommentsBoxhide(); EAcommentsBoxhide(); + ContactSearchReset(); AgentDispoing = 0; - if (shift_logout_flag < 1) + if ( (shift_logout_flag < 1) && (api_logout_flag < 1) ) { if (wrapup_waiting == 0) { @@ -8567,7 +9154,6 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { AutoDialWaiting = 0; AutoDial_ReSume_PauSe("VDADpause"); - // document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML; } VICIDiaL_pause_calling = 1; if (dispo_check_all_pause != '1') @@ -8581,23 +9167,25 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { AutoDialWaiting = 1; agent_log_id = AutoDial_ReSume_PauSe("VDADready","NEW_ID"); - // document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML_ready; } else { // trigger HotKeys manual dial automatically go to next lead - if (manual_auto_hotkey == '1') - { - manual_auto_hotkey = 0; - ManualDialNext('','','','','','0'); - } + // if (manual_auto_hotkey > 0) + // { + // manual_auto_hotkey = 0; + // ManualDialNext('','','','','','0'); + // } } } } } else { - LogouT('SHIFT'); + if (shift_logout_flag > 0) + {LogouT('SHIFT');} + else + {LogouT('API');} } if (focus_blur_enabled==1) { @@ -8716,32 +9304,47 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.xfername.value = 'D5'; } - function DtMf_PreSet_a_DiaL() + function DtMf_PreSet_a_DiaL(taskquiet) { document.vicidial_form.conf_dtmf.value = CalL_XC_a_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; - basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_b_DiaL() + function DtMf_PreSet_b_DiaL(taskquiet) { document.vicidial_form.conf_dtmf.value = CalL_XC_b_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; - basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_c_DiaL() + function DtMf_PreSet_c_DiaL(taskquiet) { document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber; - basic_originate_call(CalL_XC_c_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_c_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_d_DiaL() + function DtMf_PreSet_d_DiaL(taskquiet) { document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber; - basic_originate_call(CalL_XC_d_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_d_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } - function DtMf_PreSet_e_DiaL() + function DtMf_PreSet_e_DiaL(taskquiet) { document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber; - basic_originate_call(CalL_XC_e_NuMber,'NO','YES',session_id,'YES','','1','0'); + var session_id_dial = session_id; + if (taskquiet == 'YES') + {session_id_dial = '7' + session_id}; + basic_originate_call(CalL_XC_e_NuMber,'NO','YES',session_id_dial,'YES','','1','0'); } function hangup_timer_xfer() { @@ -9006,7 +9609,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - CSCupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=regCLOSER&format=text&user=" + user + "&pass=" + pass + "&comments=" + VU_agent_choose_ingroups_DV + "&closer_blended=" + VICIDiaL_closer_blended + "&campaign=" + campaign + "&qm_phone=" + qm_phone + "&dial_method" + dial_method + "&closer_choice=" + CloserSelectChoices + "-"; + CSCupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=regCLOSER&format=text&user=" + user + "&pass=" + pass + "&comments=" + VU_agent_choose_ingroups_DV + "&closer_blended=" + VICIDiaL_closer_blended + "&campaign=" + campaign + "&qm_phone=" + qm_phone + "&qm_extension=" + qm_extension + "&dial_method" + dial_method + "&closer_choice=" + CloserSelectChoices + "-"; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(CSCupdate_query); @@ -9036,7 +9639,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) HidEGenDerPulldown(); if (agent_choose_territories > 0) { - var live_TERR_HTML = " +
TERRITORIES NOT SELEZIONATOSELEZIONATO TERRITORIES
  --- ADD ALL ---
"; + var live_TERR_HTML = " +
TERRITORI NON SELEZIONATOterritori selezionati
  --- ADD ALL ---
"; var loop_ct = 0; while (loop_ct < territoryCOUNT) { @@ -9127,9 +9730,9 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var TerritorySelectChoices = document.vicidial_form.TerritorySelectList.value; if (AllowManualQueueCalls == '0') - {document.getElementById("ManualQueueChoice").innerHTML = "
Manual Queue is Off
";} + {document.getElementById("ManualQueueChoice").innerHTML = "Queue manuale è Off
";} else - {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue in On
";} + {document.getElementById("ManualQueueChoice").innerHTML = "Queue Manual in On
";} } // ################################################################################ @@ -9271,7 +9874,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { if (alt_dial_status_display==1) { - alert("You are in ALT dial mode, you must finish the lead before logging out.\n" + reselect_alt_dial); + alert("Sei in modalità dial ALT, è necessario terminare il cavo prima di uscire.\n" + reselect_alt_dial); } else { @@ -9296,7 +9899,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - VDlogout_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=userLOGout&format=text&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&agent_log_id=" + agent_log_id + "&no_delete_sessions=" + no_delete_sessions + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages + "&LogouTKicKAlL=" + LogouTKicKAlL + "&ext_context=" + ext_context; + VDlogout_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=userLOGout&format=text&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&agent_log_id=" + agent_log_id + "&no_delete_sessions=" + no_delete_sessions + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages + "&LogouTKicKAlL=" + LogouTKicKAlL + "&ext_context=" + ext_context + "&qm_extension=" + qm_extension; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(VDlogout_query); @@ -9315,6 +9918,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var logout_content=''; if (tempreason=='SHIFT') {logout_content='Il tuo turno è finito o è cambiato, sei stato disconnesso dalla tua sessione

';} + if (tempreason=='API') + {logout_content='Il sistema ha ricevuto un comando di log out, si è stati disconnessi dalla sessione

';} document.getElementById("LogouTBoxLink").innerHTML = logout_content + "FAI CLICK QUI PER AUTENTICARTI DI NUOVO\n"; @@ -9361,6 +9966,9 @@ if ($useIE > 0) { HKdispo_display = 4; HKfinish=1; + alt_phone_dialing=starting_alt_phone_dialing; + alt_dial_active = 0; + alt_dial_status_display = 0; document.getElementById("HotKeyDispo").innerHTML = HKdispo_ary[0] + " - " + HKdispo_ary[1]; showDiv('HotKeyActionBox'); hideDiv('HotKeyEntriesBox'); @@ -9418,6 +10026,9 @@ else showDiv('HotKeyActionBox'); hideDiv('HotKeyEntriesBox'); document.vicidial_form.DispoSelection.value = HKdispo_ary[0]; + alt_phone_dialing=starting_alt_phone_dialing; + alt_dial_active = 0; + alt_dial_status_display = 0; dialedcall_send_hangup('NO', 'YES', HKdispo_ary[0]); if (custom_fields_enabled > 0) { @@ -9550,6 +10161,8 @@ else "&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + '' + "&entry_list_id=" + document.vicidial_form.entry_list_id.value + '' + + "&call_id=" + LasTCID + '' + + "&web_vars=" + LIVE_web_vars + '' + webform_session; if (custom_field_names.length > 2) @@ -9683,7 +10296,7 @@ else } CFN_tick++; } - document.getElementById("debugbottomspan").innerHTML = CFN_debug; +// document.getElementById("debugbottomspan").innerHTML = CFN_debug; } if (webformnumber == '1') @@ -9762,6 +10375,7 @@ else var SCdid_description = did_description; var SCclosecallid = closecallid; var SCxfercallid = xfercallid; + var SCcall_id = LasTCID; var SCagent_log_id = agent_log_id; var SCweb_vars = LIVE_web_vars; @@ -9834,6 +10448,7 @@ else SCdid_extension = SCdid_extension.replace(RGplus,'+'); SCdid_pattern = SCdid_pattern.replace(RGplus,'+'); SCdid_description = SCdid_description.replace(RGplus,'+'); + SCcall_id = SCcall_id.replace(RGplus,'+'); SCweb_vars = SCweb_vars.replace(RGplus,'+'); } @@ -9909,6 +10524,7 @@ else var RGclosecallid = new RegExp("--A--closecallid--B--","g"); var RGxfercallid = new RegExp("--A--xfercallid--B--","g"); var RGagent_log_id = new RegExp("--A--agent_log_id--B--","g"); + var RGcall_id = new RegExp("--A--call_id--B--","g"); var RGweb_vars = new RegExp("--A--web_vars--B--","g"); encoded = encoded.replace(RGvendor_lead_code, SCvendor_lead_code); @@ -9983,6 +10599,7 @@ else encoded = encoded.replace(RGclosecallid, SCclosecallid); encoded = encoded.replace(RGxfercallid, SCxfercallid); encoded = encoded.replace(RGagent_log_id, SCagent_log_id); + encoded = encoded.replace(RGcall_id, SCcall_id); encoded = encoded.replace(RGweb_vars, SCweb_vars); } decoded=encoded; // simple no ? @@ -10304,7 +10921,7 @@ function phone_number_format(formatphone) { { if (AVlocation=='AgentViewSpan') { - document.getElementById("AgentViewLink").innerHTML = "Agents View -"; + document.getElementById("AgentViewLink").innerHTML = "Agenti Visualizza -"; agent_status_view_active=1; } showDiv(AVlocation); @@ -10313,7 +10930,7 @@ function phone_number_format(formatphone) { { if (AVlocation=='AgentViewSpan') { - document.getElementById("AgentViewLink").innerHTML = "Agents View +"; + document.getElementById("AgentViewLink").innerHTML = "Agenti Visualizza +"; agent_status_view_active=0; } hideDiv(AVlocation); @@ -10442,7 +11059,7 @@ function phone_number_format(formatphone) { } if (xmlhttp) { - RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=LEADINFOview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&lead_id=" + VLI_lead_id + "&campaign=" + campaign + "&callback_id=" + VLI_cb_id + "&stage="; + RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=LEADINFOview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&lead_id=" + VLI_lead_id + "&disable_alter_custphone=" + disable_alter_custphone + "&campaign=" + campaign + "&callback_id=" + VLI_cb_id + "&stage="; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(RAview_query); @@ -10473,7 +11090,8 @@ function phone_number_format(formatphone) { else { move_on=0; - alert_box("YOU MUST BE PAUSED TO VIEW YOUR CHIAMATA LOG"); + alert_box("DEVI ESSERE IN PAUSA PER VEDERE IL VOSTRO CHIAMATA LOG"); + // alert("debug: " + AutoDialWaiting + "|" + VD_live_customer_call + "|" + alt_dial_active + "|" + MD_channel_look + "|" + in_lead_preview_state); } } if (move_on == 1) @@ -10504,7 +11122,7 @@ function phone_number_format(formatphone) { } if (xmlhttp) { - RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=CALLLOGview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&date=" + logdate + "&campaign=" + campaign + "&stage="; + RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=CALLLOGview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&date=" + logdate + "&disable_alter_custphone=" + disable_alter_custphone +"&campaign=" + campaign + "&stage="; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(RAview_query); @@ -10522,6 +11140,67 @@ function phone_number_format(formatphone) { } +// ################################################################################ +// Gather and display contacts search data + function ContactSearchSubmit() + { + showDiv('SearcHResultSContactsBox'); + + document.getElementById('SearcHResultSContactsSpan').innerHTML = "Searching...\n"; + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + LSview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=SEARCHCONTACTSRESULTSview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&phone_number=" + document.vicidial_form.contacts_phone_number.value + "&first_name=" + document.vicidial_form.contacts_first_name.value + "&last_name=" + document.vicidial_form.contacts_last_name.value + "&bu_name=" + document.vicidial_form.contacts_bu_name.value + "&department=" + document.vicidial_form.contacts_department.value + "&group_name=" + document.vicidial_form.contacts_group_name.value + "&job_title=" + document.vicidial_form.contacts_job_title.value + "&location=" + document.vicidial_form.contacts_location.value + "&campaign=" + campaign + "&stage="; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(LSview_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + // alert(xmlhttp.responseText); + document.getElementById('SearcHResultSContactsSpan').innerHTML = xmlhttp.responseText + "\n"; + } + } + delete xmlhttp; + } + } + + + +// ################################################################################ +// Reset contact search form + function ContactSearchReset() + { + document.vicidial_form.contacts_phone_number.value=''; + document.vicidial_form.contacts_first_name.value=''; + document.vicidial_form.contacts_last_name.value=''; + document.vicidial_form.contacts_bu_name.value=''; + document.vicidial_form.contacts_department.value=''; + document.vicidial_form.contacts_group_name.value=''; + document.vicidial_form.contacts_job_title.value=''; + document.vicidial_form.contacts_location.value=''; + } + // ################################################################################ // Gather and display lead search data @@ -10529,7 +11208,7 @@ function phone_number_format(formatphone) { { if ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) || (in_lead_preview_state==1) ) { - alert_box("YOU MUST BE PAUSED TO SEARCH FOR A LEAD"); + alert_box("DEVI ESSERE IN PAUSA PER CERCARE DI PIOMBO"); } else { @@ -10612,6 +11291,7 @@ function phone_number_format(formatphone) { document.vicidial_form.MDDiaLOverridE.value = ''; document.vicidial_form.MDLeadID.value = ''; document.vicidial_form.MDType.value = ''; + document.vicidial_form.MDPhonENumbeRHiddeN.value = ''; } @@ -10710,7 +11390,7 @@ function phone_number_format(formatphone) { var form_entry_list_id = document.vicidial_form.entry_list_id.value; if (form_entry_list_id.length > 2) {form_list_id = form_entry_list_id} - document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' +"&agent_log_id=" + agent_log_id + ''; + document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + pass + '&campaign=' + campaign + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' +"&xfercallid=" + xfercallid + '' + "&agent_log_id=" + agent_log_id + "&call_id=" + LasTCID + '' +"&web_vars=" + LIVE_web_vars + ''; form_list_id = ''; form_entry_list_id = ''; } @@ -10722,7 +11402,7 @@ function phone_number_format(formatphone) { showDiv('DispoButtonHideA'); showDiv('DispoButtonHideB'); showDiv('DispoButtonHideC'); - document.getElementById("DispoSelectBox").style.top = 340; + document.getElementById("DispoSelectBox").style.top = '340px'; document.getElementById("DispoSelectMaxMin").innerHTML = " ingrandisci "; } @@ -10731,7 +11411,7 @@ function phone_number_format(formatphone) { // Move the Dispo frame to the top and change the link to minimize function DispoMaximize() { - document.getElementById("DispoSelectBox").style.top = 1; + document.getElementById("DispoSelectBox").style.top = '1px'; document.getElementById("DispoSelectMaxMin").innerHTML = " riduci "; hideDiv('DispoButtonHideA'); hideDiv('DispoButtonHideB'); @@ -10986,6 +11666,26 @@ function phone_number_format(formatphone) { { DtMf_PreSet_e_DiaL(); } + if (timer_action == 'D1_DIAL_QUIET') + { + DtMf_PreSet_a_DiaL('YES'); + } + if (timer_action == 'D2_DIAL_QUIET') + { + DtMf_PreSet_b_DiaL('YES'); + } + if (timer_action == 'D3_DIAL_QUIET') + { + DtMf_PreSet_c_DiaL('YES'); + } + if (timer_action == 'D4_DIAL_QUIET') + { + DtMf_PreSet_d_DiaL('YES'); + } + if (timer_action == 'D5_DIAL_QUIET') + { + DtMf_PreSet_e_DiaL('YES'); + } if ( (timer_action == 'HANGUP') && (VD_live_customer_call==1) ) { hangup_timer_xfer(); @@ -11083,9 +11783,12 @@ function phone_number_format(formatphone) { hideDiv('CalLNoteDisplaYBox'); hideDiv('SearcHForMDisplaYBox'); hideDiv('SearcHResultSDisplaYBox'); + hideDiv('SearcHContactsDisplaYBox'); + hideDiv('SearcHResultSContactsBox'); hideDiv('LeaDInfOBox'); hideDiv('agentdirectlink'); hideDiv('blind_monitor_notice_span'); + hideDiv('post_phone_time_diff_span'); hideDiv('ivrParkControl'); if (is_webphone!='Y') {hideDiv('webphoneSpan');} @@ -11132,7 +11835,7 @@ function phone_number_format(formatphone) { if (agent_xfer_park_customer_dial < 1) {hideDiv('ParkCustomerDial');} if (AllowManualQueueCallsChoice == '1') - {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue is Off
";} + {document.getElementById("ManualQueueChoice").innerHTML = "Queue manuale è Off
";} document.vicidial_form.LeadLookuP.checked=true; @@ -11231,7 +11934,6 @@ function phone_number_format(formatphone) { } else { - var WaitingForNextStep=0; if ( (CloserSelecting==1) || (TerritorySelecting==1) ) {WaitingForNextStep=1;} if (open_dispo_screen==1) @@ -11292,6 +11994,14 @@ function phone_number_format(formatphone) { if ( (custchannellive < -30) && (lastcustchannel.length > 3) && (no_empty_session_warnings < 1) ) {CustomerChanneLGone();} if ( (custchannellive < -10) && (lastcustchannel.length > 3) ) {ReChecKCustoMerChaN();} if ( (nochannelinsession > 16) && (check_n > 15) && (no_empty_session_warnings < 1) ) {NoneInSession();} + if (external_transferconf_count > 0) {external_transferconf_count = (external_transferconf_count - 1);} + if (manual_auto_hotkey == "1") + { + manual_auto_hotkey = 0; + ManualDialNext('','','','','','0'); + } + if (manual_auto_hotkey > 1) {manual_auto_hotkey = (manual_auto_hotkey - 1);} + if (WaitingForNextStep==0) { if (trigger_ready > 0) @@ -11369,7 +12079,7 @@ function phone_number_format(formatphone) { if (customer_3way_hangup_action=='DISPO') { - customer_3way_hangup_dispo_message='Customer Hung-up, 3-way Call Ended Automatically'; + customer_3way_hangup_dispo_message='Clienti Hung-up, 3-way chiamata è terminata automaticamente'; bothcall_send_hangup(); } } @@ -11497,6 +12207,15 @@ function phone_number_format(formatphone) { } } } + if (consult_custom_wait > 0) + { + if (consult_custom_wait == '1') + {vcFormIFrame.document.form_custom_fields.submit();} + if (consult_custom_wait >= consult_custom_delay) + {SendManualDial('YES');} + else + {consult_custom_wait++;} + } } setTimeout("all_refresh()", refresh_interval); } @@ -11822,12 +12541,16 @@ function phone_number_format(formatphone) { var xfer_height = ; if (alt_phone_dialing>0) {xfer_height = (xfer_height + 20);} if ( (auto_dial_level == 0) && (manual_dial_preview == 1) ) {xfer_height = (xfer_height + 20);} - document.getElementById("TransferMain").style.top = xfer_height; + var X_xfer_height = xfer_height.toString(); + var temp_xfer_height = X_xfer_height + 'px'; + document.getElementById("TransferMain").style.top = temp_xfer_height; HKbutton_allowed = 0; showDiv('TransferMain'); document.getElementById("XferControl").innerHTML = "\"Trasferimento"; if ( (quick_transfer_button_enabled > 0) && (quick_transfer_button_locked < 1) ) {document.getElementById("QuickXfer").innerHTML = "\"TRASFERIMENTO";} + if (custom_3way_button_transfer_enabled > 0) + {document.getElementById("CustomXfer").innerHTML = "\"Personalizzato";} } else { @@ -11846,6 +12569,10 @@ function phone_number_format(formatphone) { { document.getElementById("QuickXfer").innerHTML = "\"TRASFERIMENTO"; } + if (custom_3way_button_transfer_enabled > 0) + { + document.getElementById("CustomXfer").innerHTML = "\"Personalizzato"; + } } } if (three_way_call_cid == 'AGENT_CHOOSE') @@ -11938,7 +12665,7 @@ function phone_number_format(formatphone) { document.getElementById("MainTable").style.backgroundColor=""; document.getElementById("MaiNfooter").style.backgroundColor=""; panel_bgcolor=''; - document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; HidEGenDerPulldown(); } @@ -11953,7 +12680,7 @@ function phone_number_format(formatphone) { document.getElementById("MainTable").style.backgroundColor=""; document.getElementById("MaiNfooter").style.backgroundColor=""; panel_bgcolor=''; - document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; HidEGenDerPulldown(); } @@ -12076,6 +12803,7 @@ $zi=2; echo "
\n"; } ?> + STATO:
@@ -12118,6 +12846,8 @@ $zi=2; 0) {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Personalizzato
\n";} ?> @@ -12151,12 +12881,12 @@ $zi=2; - + @@ -12252,16 +12982,24 @@ $zi=2; echo " + + +
  Customer Time:                         Canale:   Time Customer:                         Canale:
Dati Cliente:         LEAD SEARCH";} + {echo "PIOMBO RICERCA";} ?>
"; - echo "$label_phone_number: "; - - if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) - { - echo "                     "; - echo ""; + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; } else - { - echo ""; + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } } echo ""; @@ -12311,9 +13049,9 @@ $zi=2; if ($per_call_notes == 'ENABLED') { - echo "Call Note: "; + echo "Chiamate Note: "; if ($agent_call_log_view == '1') - {echo "
view notes ";} + {echo "
visualizzare le note ";} echo "
"; echo "\n"; } @@ -12356,7 +13094,7 @@ $zi=2; -VIEW CHIAMATA LOG
+Visualizza registro CHIAMATA
@@ -12444,7 +13182,7 @@ else ?> -
Agents View +
+
Agenti Visualizza +
0) { - echo "Dialable Leads:
 \n"; + echo "Leads componibili:
 \n"; } ?>
@@ -12575,15 +13313,24 @@ if ($agent_display_dialable_leads > 0) } else { - ?> - - D1 - D2 - D3 - D4 - D5 - - + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + +   @@ -12803,7 +13550,7 @@ Trasferimento Operatori Disponibili: - +
RICHIAMI PER L`OPERATORE :
To see information su one of the callbacks below, click su the INFO link. To call the customer back now, click su the CHIAMA link. If you click su a record below to dial it, it will be removed from the list. + @@ -12884,7 +13632,7 @@ Trasferimento Operatori Disponibili: -
RICHIAMI PER L`OPERATORE :
Per informazioni su uno dei callback in seguito, clicca sul link INFO. Per chiamare il cliente indietro, clicca sul link CHIAMA. Se si fa clic su un record qui sotto per comporlo, verrà rimosso dalla lista.
Telefono Number:
  (digits only) + - +
Cerca Contatti esistenti:
+
TERRITORY SELECTION
+
TERRITORIO DI SELEZIONE

\n";} @@ -12919,14 +13667,68 @@ Trasferimento Operatori Disponibili:
- - +
      SEARCH FOR A LEAD:             close [X]
+ +
      Cerca un contatto:             close [X]

\n";} ?>

- Note: when doing a search for a lead, the phone number, lead ID or are the best fields to use.
Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms.
Lead search requests are all logged in the system. + Note: quando si fa una ricerca di un contatto, termini di ricerca jolly o parziale non sono consentite.
Richieste di ricerca di contatto sono tutti registrati nel sistema di. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Nome Name:
Cognome Name:
BU Name:
Department:
Group Name:
Job Titolo:
Location:

INVIA SEARCH             ripristinare forma
+

  +
+
+ + +
      CONTATTI RISULTATI DELLA RICERCA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + + + + +
      RICERCA DI PIOMBO A:             close [X]
+
\n";} + ?> +

+ Note: quando si esegue una ricerca di un lead, il numero di telefono, portare ID o sono i migliori campi da utilizzare.
Utilizzando gli altri campi potrebbe essere più lento. Ricerca piombo non consente termini di ricerca con caratteri jolly o parziale.
Richieste di ricerca di piombo sono tutti registrati nel sistema di.

@@ -12936,9 +13738,9 @@ Trasferimento Operatori Disponibili: @@ -12963,7 +13765,7 @@ Trasferimento Operatori Disponibili: : - +
Telefono Number Fields: - Main Telefono Number - Alternate Telefono Number - Indirizzo3 Telefono Number + Numero di telefono principale + Numero di telefono alternativo + Indirizzo3 Numero di telefono

INVIA SEARCH             reset form

INVIA SEARCH             ripristinare forma


  @@ -12971,7 +13773,7 @@ Trasferimento Operatori Disponibili: - +
      SEARCH RESULTS:             close [X]
+ +
      RISULTATI DELLA RICERCA:             close [X]

\n";} @@ -12982,14 +13784,14 @@ Trasferimento Operatori Disponibili: -
      CHIAMATA NOTES LOG:             close [X]
+
      Note dal registro chiamate:             close [X]

\n";} ?> -
Call Note List
+
Lista chiamate Note


  - Close Info Box + Info Box Chiudi
@@ -13002,7 +13804,7 @@ Trasferimento Operatori Disponibili: Lead Info

  - Close Info Box + Info Box Chiudi
@@ -13019,7 +13821,7 @@ Trasferimento Operatori Disponibili: - +
SELECT A PRESET :
+ + + +
SELEZIONA UN PRESET :

\n";} diff --git a/agc_2-X/trunk/LANG_www/agc_nl/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_nl/astguiclient.php index 7fe83c08..f72ec949 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_nl/calendar.css b/agc_2-X/trunk/LANG_www/agc_nl/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_nl/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/agc_2-X/trunk/LANG_www/agc_nl/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_nl/calendar_db.js new file mode 100644 index 00000000..10f803bf --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_nl/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' : ['Januari', 'February', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'], + '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 ("Ongeldig 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 ("Ongeldig 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("Ongeldig 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/agc_2-X/trunk/LANG_www/agc_nl/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_nl/conf_exten_check.php index 03451858..e0dfdc5a 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $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 "Ongeldig Gebruikersnaam/Wachtwoord: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Ongeldig server_ip: |$server_ip| or Ongeldig session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Conf Extentie Controle"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Conf Extentie Controle"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten is niet geldig\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check op calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Gesprekken in Wachtrij: $RingCalls";} + else {$RingCalls = "Gesprekken in Wachtrij: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check op calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Gesprekken in Wachtrij: $RingCalls";} - else {$RingCalls = "Gesprekken in Wachtrij: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $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 . '|Status: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten is niet geldig or Exten $exten is niet geldig\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Conferentie $conf_exten is geregistreerd op $exten\n"; + echo "Conferentie $conf_exten is geregistreerd op $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_nl/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_nl/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_nl/functions.php b/agc_2-X/trunk/LANG_www/agc_nl/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_nl/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_nl/manager_send.php b/agc_2-X/trunk/LANG_www/agc_nl/manager_send.php index db564c75..ee53dd19 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -94,12 +99,21 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -289,6 +314,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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten is niet geldig or queryCID $queryCID is niet geldig, Originate commando niet uitgevoerd\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -795,10 +869,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='PARKEERED',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='PARKEER',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") @@ -822,9 +959,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='PARKEER',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 "Een van deze variabelen is niet geldig:\n"; + echo "Channel $channel moet groter zijn dan 2 karakters\n"; + echo "queryCID $queryCID moet groter zijn dan 14 karakters\n"; + echo "exten $exten moet ingevuld zijn\n"; + echo "extenName $extenName moet ingevuld zijn\n"; + echo "ext_context $ext_context moet ingevuld zijn\n"; + echo "ext_priority $ext_priority moet ingevuld zijn\n"; + echo "parkedby $parkedby moet ingevuld zijn\n"; + echo "\nRedirectToPark Action niet verstuurd\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='PARKEER_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='IVRPARKEERED',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='IVRPARKEER',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 "Een van deze variabelen is niet geldig:\n"; + echo "Channel $channel moet groter zijn dan 2 karakters\n"; + echo "queryCID $queryCID moet groter zijn dan 14 karakters\n"; + echo "exten $exten moet ingevuld zijn\n"; + echo "ext_context $ext_context moet ingevuld zijn\n"; + echo "ext_priority $ext_priority moet ingevuld zijn\n"; + echo "\nRedirectFromPark Action niet verstuurd\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='IVRPARKEER',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) ) @@ -1031,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is niet live op $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1138,7 +1547,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); } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1248,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is niet live op $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_nl/phone_only.php b/agc_2-X/trunk/LANG_www/agc_nl/phone_only.php new file mode 100644 index 00000000..f877a81f --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_nl/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Je ben nu uitgelogd. Bedankt\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST op server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link op the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location op the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefoon web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Tijdklok
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dutch
\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 "\n"; + echo "
\"VICIdial\" Telefoon-Only Inloggen
 
Telefoon login\/nummer:
Telefoon Wachtwoord:
Gebruikersnaam:
Gebruikerswachtwoord:
  \n"; + echo "

VERSIE: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefoon web client: Telefoon login\/nummer\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Tijdklok
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dutch
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefoon-Only Inloggen
 
Telefoon login\/nummer:
Telefoon Wachtwoord:
  \n"; + echo "

VERSIE: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + if ($WeBRooTWritablE > 0) + {$fp = fopen ("./vicidial_auth_entries.txt", "a");} + $VDloginDISPLAY=0; + + if ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Ongeldige login, probeer het nogmaals
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefoon web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Tijdklok
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dutch
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefoon-Only Inloggen
 
Gebruikersnaam:
Gebruikerswachtwoord:
  \n"; + echo "

VERSIE: $version       BUILD: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefoon web client: Telefoon login\/nummer Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Tijdklok
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Dutch
\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 "
\"VICIdial\" Telefoon-Only Inloggen Error
 
Sorry, de opgegeven telefoon login en wachtwoord zijn niet acitef in dit systeem, probeer het nogmaals:
 
Telefoon login\/nummer:
Telefoon Wachtwoord:

VERSIE: $version       BUILD: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + else + { + ### go through the entered phones to figure out which server has fewest agents + ### logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + while($pb < $phones_auto_ct) + { + ### find the server_ip of each phone_login + $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; + if ($DB) {echo "|$stmtx|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmtx, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefoon 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call seconden counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - seconden op call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefoon: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefoon:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_nl/timeclock.php b/agc_2-X/trunk/LANG_www/agc_nl/timeclock.php index 5b7a756c..351e624b 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/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 ##### @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "U heeft nu aangemelde"; + $LOGtimeMESSAGE = "U ingelogd op $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -338,7 +340,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($referrer=='agent') {$BACKlink = "TERUG naar Agent Inlog scherm";} if ($referrer=='admin') - {$BACKlink = "TERUG naar Administratie";} + {$BACKlink = "TERUG naar Administratie";} if ($referrer=='welcome') {$BACKlink = "TERUG naar Welkomstscherm";} diff --git a/agc_2-X/trunk/LANG_www/agc_nl/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_nl/vdc_db_query.php index 55d807a3..1f85987a 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStatus"])) {$CallBackLeadStatus=$_GET["CallBackLeadStatus"];} + elseif (isset($_POST["CallBackLeadStatus"])) {$CallBackLeadStatus=$_POST["CallBackLeadStatus"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Gebruiker busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Ongeldig number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STATUS INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Inkomend calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Ongeldig call reference value.", +88 => "Incompatible destination.", +95 => "Ongeldig message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Ongeldig information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery op timer expiry.", +103 => "Parameter non-existent or not implemented - passed op (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo ""; ### Gather agents data and statuses + $agentviewlistSQL=''; + $j=0; $stmt="SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user $AGENTviewSQL order by vu.full_name;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -6302,6 +8061,7 @@ if ($ACTION == 'AGENTSview') $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; if ( ($status=='READY') or ($status=='CLOSER') ) { @@ -6337,10 +8097,12 @@ if ($ACTION == 'AGENTSview') if ($comments=='AgentXferViewSelect') { - echo ""; - if ($agent_status_view_time > 0) - {echo "";} - echo ""; + $AXVSuserSORTEER[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = $call_time; + $AXVSstatuscolor[$j] = $statuscolor; + $j++; } else { @@ -6353,8 +8115,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') + { + $AXVSuserSORTEER[$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($AXVSuserSORTEER); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserSORTEER[$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"; + echo "    -KLAAR      -INCALL      -PAUSED  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} echo "\n"; } @@ -6552,6 +8395,1358 @@ 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     STATUS     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     BEL  
Geen oproepen op deze dag
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Sluit Call Log"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Ga Terug"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Gevonden resultaten: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set seconden='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STATUS     LAST BEL     CITY     STATE     ZIP     INFO     BEL  
Er zijn geen resultaten gevonden
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Er zijn geen resultaten gevonden
"; + echo "
"; + echo "Ga Terug"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Ga Terug"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campagne not found\n"; + echo "

"; + echo "Ga Terug"; + echo ""; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Ga Terug"; + echo ""; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Gevonden resultaten: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set seconden='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Er zijn geen resultaten gevonden
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Er zijn geen resultaten gevonden
"; + echo "
"; + echo "Ga Terug"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Ga Terug"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campagne not found\n"; + echo "

"; + echo "Ga Terug"; + echo ""; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Terugbellen Status:   $row[0]
Terugbellen Lead Status:   $row[7]
Terugbellen Entry Time:   $row[1]
Terugbellen Trigger Time:   $row[2]
Terugbellen Reacties:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Titel'; + $label_first_name = 'Eerste'; + $label_middle_initial = 'MI'; + $label_last_name = 'Laatste'; + $label_address1 = 'Adres1'; + $label_address2 = 'Adres2'; + $label_address3 = 'Adres3'; + $label_city = 'Stad'; + $label_state = 'Staat'; + $label_province = 'Provincie'; + $label_postal_code = 'Postcode'; + $label_vendor_lead_code = 'Leverancier ID'; + $label_gender = 'Gender'; + $label_phone_number = 'Telefoon'; + $label_phone_code = 'BelCode'; + $label_alt_phone = 'Alt. Tel.'; + $label_security_phrase = 'Toon'; + $label_email = 'Email'; + $label_comments = 'Opmerkingen'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefoon and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefoon netnummer Buiten kiesbaar Zone $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Postcode Buiten kiesbaar Zone $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefoon netnummer Buiten kiesbaar Zone $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Postcode Buiten kiesbaar Zone $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Status:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Gebeld Since Laatste Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Gebeld Count:   $row[24]
Laatste Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
OPROEP VOOR DEZE LOG LOOD:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STATUS     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Geen gesprekken gevonden
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +9767,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_nl/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_nl/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_nl/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_nl/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_nl/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_nl/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_nl/vdc_script_notes.php new file mode 100644 index 00000000..0e454c1d --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_nl/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 = 'Titel'; +$label_first_name = 'Eerste'; +$label_middle_initial = 'MI'; +$label_last_name = 'Laatste'; +$label_address1 = 'Adres1'; +$label_address2 = 'Adres2'; +$label_address3 = 'Adres3'; +$label_city = 'Stad'; +$label_state = 'Staat'; +$label_province = 'Provincie'; +$label_postal_code = 'Postcode'; +$label_vendor_lead_code = 'Leverancier ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefoon'; +$label_phone_code = 'BelCode'; +$label_alt_phone = 'Alt. Tel.'; +$label_security_phrase = 'Toon'; +$label_email = 'Email'; +$label_comments = 'Opmerkingen'; + +$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 "Ongeldig Gebruikersnaam/Wachtwoord: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Opmerkingen"; +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 Opmerkingen:

+
Please click OPSLAAN to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + +
+
+ + + + diff --git a/agc_2-X/trunk/LANG_www/agc_nl/vicidial.php b/agc_2-X/trunk/LANG_www/agc_nl/vicidial.php index 6372ffdd..6aaac5c8 100644 --- a/agc_2-X/trunk/LANG_www/agc_nl/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_nl/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -414,22 +523,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT BEL 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 op the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of seconden to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location op the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### BEGIN find any custom field labels ### +$label_title = 'Titel'; +$label_first_name = 'Eerste'; +$label_middle_initial = 'MI'; +$label_last_name = 'Laatste'; +$label_address1 = 'Adres1'; +$label_address2 = 'Adres2'; +$label_address3 = 'Adres3'; +$label_city = 'Stad'; +$label_state = 'Staat'; +$label_province = 'Provincie'; +$label_postal_code = 'Postcode'; +$label_vendor_lead_code = 'Leverancier ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefoon'; +$label_phone_code = 'BelCode'; +$label_alt_phone = 'Alt. Tel.'; +$label_security_phrase = 'Toon'; +$label_email = 'Email'; +$label_comments = 'Opmerkingen'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,249 +12720,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -UITLOGGEN\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Live Gesprek
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Ingelogd als gebruiker + ring)";} + echo "  naar campagne: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + UITLOGGEN\n"; ?> +
- -HANDMATIG BELLEN       SNEL BELLEN
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Live Gesprek
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STATUS:
+
+ Bel Volgend Nummer
+ + + BEKIJK LEAD
+ BEL ALT. TEL.
+ + OPNEEMBESTAND:
+
+
+ OPENEMEN ID:
+
+ + Start Opnemen
+
+ Web Formulier
+ 0) + {echo "\"Web
\n";} + ?> +  
+ Parkeer Gesprek
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Transfer - Conferentie
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Custom
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Ophangen Klant
+
+
Stuur DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  Klant Tijd:                         Kanaal:
Klant Informatie:         + LEIDEN ZOEKEN";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Call Opmerkingen: "; + if ($agent_call_log_view == '1') + {echo "
Notities bekijken ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+
+
+ + + + + +HANDMATIG BELLEN       SNEL BELLEN
- -X AKTIEVE TERUGBELLERS
+ +
- -
+ +VIEW BEL LOG
- seconden: -     + +     + + + +
VERSIE:   BUILD:     Server:              
+ + Toon kanaalinformatie van conferentie gesprek +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +SNELTOETSEN NIET AKTIEF + + + seconden: +    
- +
+
+ + +Jouw Status:
Calls Dialing: +
+ + D1 - BEL\n"; - echo "
\n"; + echo "   \n"; echo "D2 - BEL\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
TERUGBELLERS VOOR AGENT :
Klik op een terugbeller om de klant nu terug te bellen. Als je hierop klikt, wordt deze verwijderd uit de lijst. -
-
-
  - Ververs -                 - Ga Terug -
-
+
 Roept in de wachtrij:  
 
- - height=>
NIEUWE HANDMATIGE LEAD VOOR :

Voer de informatie voor de nieuwe te bellen lead hieronder in. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Netnummer:   (Dit is normaal gesproken een 1 in de USA en Canada)
Telefoon Number: -   (12 digits max - digits only) -
Zoek Bestaande Leads:   (Deze optie, indien geselecteerd, probeert een telefoonnummer te vinden voordat deze als nieuwe lead wordt toegevoegd)
-

-     -
-

Als je een nummer belt en NIET wilt dat deze als nieuwe lead wordt toegevoegd, vul dan het exacte nummer in, in het Dial Override veld. Om op te hangen, dien je GESPREKKEN IN DEZE SESSIE te open, onderaan het scherm, en daar op te hangen door te klikken op de kanaal link.
 
Dial Override:   (alleen cijfers aub) -
-
- Bel Nu -                 - Bekijk Gesprek -                 - Ga Terug -
-
- - - -
-
- - - - -Jouw Status:
Calls Dialing: -
- - - - - > - - -
-
- - Transfer - Conferentie            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - LOKALE CLOSER     - - Ophangen Xfer Lijn -
- seconds -   - channel - - ADVIESGROEP   - - Ophangen Beide Lijnen -
- Nummer om te kiezen -   -   - agenten - - - BEL OVERRIDE - - VERLAAT 3-WEG GESPREK -
- Bel Blinde Transfer -   - Bel Met Klant -   - Parkeer Gesprek Met Klant -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Roept in de wachtrij:  
 
- - + 0) { @@ -10817,189 +13161,349 @@ if ($view_calls_in_queue > 0) ?> + +X AKTIEVE TERUGBELLERS
+
-
  -Andere Agenten Status:  
 
+
  +Andere Agenten Status:  
 
-
-Beschikbaar Transfer Agents:
+$webphone_content
\n"; + } +else + { + echo "
  + Web Telefoon:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
agenten bekijken +
+ + + +
  WebTelefoon View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "kiesbaar Leads:
 \n"; } ?>
- + - - - height=70> - -
Lead Gedispositioneerd Als:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
Dispositie Sneltoetsen: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Transfer - Conferentie            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LOKALE CLOSER     + + Ophangen Xfer Lijn +
+ seconds +   + channel + + ADVIESGROEP   + + Ophangen Beide Lijnen +
+ Nummer om te kiezen +   + +                     + +   + + agenten + + + + + BEL OVERRIDE + + VERLAAT 3-WEG GESPREK +
+ Bel Blinde Transfer +   + Bel Met Klant +   + Parkeer Gesprek Met Klant +   + + Presets Button + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Beschikbaar Transfer Agents:
+ + + + + +
Lead Gedispositioneerd Als:

+ -
+
+
+ + + + - - + - + -
Dispositie Sneltoetsen: Wanneer aktief, kies de corresponderende toets op het toetsenbord, om dit geprek te dispositioneren. Het gesprek wordt opgehangen en automatisch gedispositioneerd:
+ - + - + -
+
- - height=70> - - - + +
Vorige Terugbel Informatie: close
+ + + - - + -
Vorige Terugbel Informatie: close
-
-
-
-
+ +
+
+
+
-
+
- - height=70> - - - + +
Uitgebreide Alt. Tel. Informatie minimaliseer
+ + + - - + -
Uitgebreide Alt. Tel. Informatie minimaliseer
-
-
-
-
+
+
+
+
+
-
+
- - - - -
maximaliseer
Alt Telefoon Info
+ + + + +
maximaliseer
Alt Telefoon Info
- - height=>
Er is niemand in jouw sessie:
+ +
Er is niemand in jouw sessie:
Ga Terug -

- Bel Agent Opnieuw -
+

+ Bel Agent Opnieuw +
- - height=>
Klant heeft opgehangen:
+ +
Klant heeft opgehangen:
Ga Terug -

+

Afsluiten en Dispositioneren Gesprek -
+
- - height=>
Gesprek Afronden: seconden over in afronden

+ +
Gesprek Afronden: seconden over in afronden

-

+

Afronden afmaken en doorgaan -
+
- -
-


+ +
+


Close Message -
+
- - height=>
Jouw sessie is geblokkeerd
UITLOGGEN

Ga Terug -
+ +
Jouw sessie is geblokkeerd
UITLOGGEN

Ga Terug +
- - height=>
Er is een tijd synchronisatieprobleem met uw systeem, neem contact op met je systeem beheerder


Ga Terug -
+ +
Er is een tijd synchronisatieprobleem met uw systeem, neem contact op met je systeem beheerder


Ga Terug +
- - height=>

UITLOGGEN
+ +

UITLOGGEN
- -
+ +
- -
 
+ +
 
- - height=47>
Alle aanpassingen gedaan aan onderstaande klant informatie wordt niet doorgevoerd. Je moet de klant informatie aanpassen VOORDAT je VOLGENDE LEAD kiest.
+ +
Alle aanpassingen gedaan aan onderstaande klant informatie wordt niet doorgevoerd. Je moet de klant informatie aanpassen VOORDAT je VOLGENDE LEAD kiest.
- - height=>
DISPOSITIONEER GESPREK :       Opnieuw Ophangen       minimaliseer
+ +
DISPOSITIONEER GESPREK :       Opnieuw Ophangen       minimaliseer
+
\n";} + ?> + + + Einde Gesprek Dispositie Selectie -
- PAUZEER BELLEN
+
+ PAUZEER BELLEN
RESET FORM | OPSLAAN -

+

WEB FORM OPSLAAN -

  -
+

  +
- - height=>
SELECTEER EEN PAUZE CODE :
- Pauze Code Selection - -

  -
-
- - - height=>
KIES EEN GROEP ALIAS :
- Groep Alias Selectie - -

  -
-
- - - - - - height=>
Selecteer een terugbel datum :
- - + +
Selecteer een terugbel datum :
+
\n";} + ?> + + Selecteer een datum       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
ALLEEN MIJN TERUGBELLER
";} + {echo " ALLEEN MIJN TERUGBELLER
";} ?> - TB Opmerkingen:

+ TB Opmerkingen:

- OPSLAAN

+ OPSLAAN

-

  -
+

  +
- - height=>
CLOSER INKOMENDE GROEP SELECTIE
- Closer Inkomende Groep Selectie -
+ +
TERUGBELLERS VOOR AGENT :
Als u informatie over een van de callbacks zie hieronder, klik op de INFO link. Om de klant nu terug te bellen, klik op de BEL link. Als u hieronder klikt op een record om te bellen, wordt deze verwijderd uit de lijst. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Ververs +                 + Ga Terug +
+
+ + +
NIEUWE HANDMATIGE LEAD VOOR :

Voer de informatie voor de nieuwe te bellen lead hieronder in. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Netnummer:   (Dit is normaal gesproken een 1 in de USA en Canada)
Telefoon Number: +   (digits only) + + + +
Zoek Bestaande Leads:   (Deze optie, indien geselecteerd, probeert een telefoonnummer te vinden voordat deze als nieuwe lead wordt toegevoegd)
+

+     +
+

Als je een nummer belt en NIET wilt dat deze als nieuwe lead wordt toegevoegd, vul dan het exacte nummer in, in het Dial Override veld. Om op te hangen, dien je GESPREKKEN IN DEZE SESSIE te open, onderaan het scherm, en daar op te hangen door te klikken op de kanaal link.
 
Dial Override:   (alleen cijfers aub) +
+
+ Bel Nu +                 + Bekijk Gesprek +                 + Ga Terug +
+
+ + +
CLOSER INKOMENDE GROEP SELECTIE
+
\n";} + ?> + Closer Inkomende Groep Selectie +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - BLENDED BELLEN(uitgaand geactiveerd)
+ BLENDED BELLEN(uitgaand geactiveerd)
RESET | OPSLAAN -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
GRONDGEBIED SELECTIE
+
\n";} + ?> Territory Selection -
+
RESET | OPSLAAN -



  -
+



  +
- - + Kanaal Kanaal ALLEEN MIJN TERUGBELLER
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " BLENDED BELLEN
";} + {echo " ALLEEN MIJN TERUGBELLER
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " BLENDED BELLEN
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT BEL LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Zoeken naar een contactpersoon:             close [X]
+
\n";} + ?> +

+ Opmerkingen: bij het doen van een zoektocht naar een contactpersoon, worden wildcard of gedeeltelijke zoektermen niet toegestaan.
Contact zoekopdrachten zijn allen geregistreerd in het systeem. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Eerste Name:
Laatste Name:
BU Name:
Department:
Group Name:
Job Titel:
Location:

OPSLAAN SEARCH             opnieuw in te stellen formulier
+

  +
+
+ + +
      CONTACTEN ZOEKRESULTATEN:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      ZOEK NAAR EEN LOOD:             close [X]
+
\n";} + ?> +

+ Opmerkingen: bij het doen van een zoektocht naar een voorsprong, het telefoonnummer, leiden ID of worden de beste velden.
De andere velden kunnen vertragen. Lead zoeken houdt geen rekening met wildcard of gedeeltelijke zoektermen.
Lead zoekopdrachten zijn allemaal geregistreerd in het systeem. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefoon Number:
Telefoon Number Fields: + Belangrijkste Telefoonnummer + Andere telefoonnummer + Adres3 Telefoonnummer +
Lead ID:
:
:
:
:
:
:

OPSLAAN SEARCH             opnieuw in te stellen formulier
+

  +
+
+ + +
      ZOEKRESULTATEN:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Opmerkingen bij oproep LOG:             close [X]
+
\n";} + ?> +
Call Opmerkingen Lijst
+

  + Sluiten Info Box +
+
+ + +
      Klant Informatie:             close [X] +
+
\n";} + ?> + Lead Info +

  + Sluiten Info Box +
+
+ + +
SELECTEER EEN PAUZE CODE :
+
\n";} + ?> + Pauze Code Selection + +

  +
+
+ + +
SELECT A PRESET :
+
\n";} + ?> + Presets Selection + +
+
+ + +
KIES EEN GROEP ALIAS :
+
\n";} + ?> + Groep Alias Selectie + +

  +
+
+ + +
ALERT :
+     +

Ga Terug +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -SNELTOETSEN NIET AKTIEF - + + + - -> +
Agent web-client version:     BUILD:               Server:              
- -Toon kanaalinformatie van conferentie gesprek -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
STATUS:
-
-Bel Volgend Nummer
- BEKIJK LEAD
- BEL ALT. TEL.
- - -OPNEEMBESTAND:
-
-
-OPENEMEN ID:
-
- -Start Opnemen
-
-Web Formulier
- 0) - {echo "\"Web
\n";} -?> -
-Parkeer Gesprek
-Transfer - Conferentie
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Ophangen Klant
-
-
Stuur DTMF

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Kanaal:
Klant Informatie:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Titel:   Eerste:   MI:   Laatste:
Adres1:
Adres2: Adres3:
Stad: Staat: Postcode:
Provincie: Leverancier ID: Geslacht:
Telefoon: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -BelCode: Alt. Tel.:
Toon: Email:
Opmerkingen: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_pl/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_pl/astguiclient.php index 9bd1e790..3d004e3a 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_pl/calendar.css b/agc_2-X/trunk/LANG_www/agc_pl/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pl/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/agc_2-X/trunk/LANG_www/agc_pl/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_pl/calendar_db.js new file mode 100644 index 00000000..58b56790 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pl/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' : ['Styczeń', 'February', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'], + '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 ("Nieprawidłowy 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 ("Nieprawidłowy 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("Nieprawidłowy 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/agc_2-X/trunk/LANG_www/agc_pl/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_pl/conf_exten_check.php index 26b41dbd..dc5919af 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Nieprawidłowy server_ip: |$server_ip| or Nieprawidłowy session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Sprawdzanie numeru wewnętrznego konferencji"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Sprawdzanie numeru wewnętrznego konferencji"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten nie jest prawidłowy\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check na calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Wzywa w kolejce: $RingCalls";} + else {$RingCalls = "Wzywa w kolejce: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check na calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Wzywa w kolejce: $RingCalls";} - else {$RingCalls = "Wzywa w kolejce: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $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 . '|Status: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten nie jest prawidłowy or Exten $exten nie jest prawidłowy\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Konferencja $conf_exten został zarejestrowany $exten\n"; + echo "Konferencja $conf_exten został zarejestrowany $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_pl/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_pl/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_pl/functions.php b/agc_2-X/trunk/LANG_www/agc_pl/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pl/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_pl/manager_send.php b/agc_2-X/trunk/LANG_www/agc_pl/manager_send.php index 06fb12c7..807a8e86 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -94,12 +99,21 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -289,6 +314,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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten nie jest prawidłowy or queryCID $queryCID nie jest prawidłowy, Originate komenda nie wstawiona\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -795,10 +869,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='PARKINGED',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='PARKING',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") @@ -822,9 +959,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='PARKING',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 "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Channel $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "extenName $extenName musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "parkedby $parkedby musi być ustawiony\n"; + echo "\nRedirectToPark Action nie wysłano\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='PARKING_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='IVRPARKINGED',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='IVRPARKING',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 "Jedna z tych zmiennych nie jest prawidłowy:\n"; + echo "Channel $channel musi mieć więcej niż 2 znaki\n"; + echo "queryCID $queryCID musi mieć więcje niż 14 znaków\n"; + echo "exten $exten musi być ustawiony\n"; + echo "ext_context $ext_context musi być ustawiony\n"; + echo "ext_priority $ext_priority musi być ustawiony\n"; + echo "\nRedirectFromPark Action nie wysłano\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='IVRPARKING',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) ) @@ -1031,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie jest aktywna na $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1138,7 +1547,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); } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1248,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie jest aktywna na $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_pl/phone_only.php b/agc_2-X/trunk/LANG_www/agc_pl/phone_only.php new file mode 100644 index 00000000..9044cf5c --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pl/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Wylogowałeś się. Do zobaczenia\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST na server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link na the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location na the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefon 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 Polski
\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 "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Login telefonu:
Hasło telefonu:
Login użytkownika:
Hasło użytkownika:
  \n"; + echo "

WERSJA: $version       KOMPILACJA: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefon web client: Login telefonu\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Login telefonu:
Hasło telefonu:
  \n"; + echo "

WERSJA: $version       KOMPILACJA: $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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Login nie aktywny, spróbuj jeszcze raz
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefon 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 Polski
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefon-Only Login
 
Login użytkownika:
Hasło użytkownika:
  \n"; + echo "

WERSJA: $version       KOMPILACJA: $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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefon web client: Login telefonu Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Polski
\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 "
\"VICIdial\" Telefon-Only Login Error
 
Login Twojego telefonu lub hasło są nieaktywne w tym systememie, spróbuj jeszcze raz:
 
Login telefonu:
Hasło telefonu:

WERSJA: $version       KOMPILACJA: $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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefon 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call sekundy counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - sekundy na call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefon: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefon:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_pl/timeclock.php b/agc_2-X/trunk/LANG_www/agc_pl/timeclock.php index edc3f085..c583118c 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/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 ##### @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Masz teraz zalogowanych"; + $LOGtimeMESSAGE = "Jesteś zalogowany na $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -338,7 +340,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($referrer=='agent') {$BACKlink = "POWRÓT pełnomocnika do ekranu logowania";} if ($referrer=='admin') - {$BACKlink = "POWRÓT do administracji";} + {$BACKlink = "POWRÓT do administracji";} if ($referrer=='welcome') {$BACKlink = "Powrót do ekranu powitalnego";} diff --git a/agc_2-X/trunk/LANG_www/agc_pl/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_pl/vdc_db_query.php index 236f21b6..76863548 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStatus"])) {$CallBackLeadStatus=$_GET["CallBackLeadStatus"];} + elseif (isset($_POST["CallBackLeadStatus"])) {$CallBackLeadStatus=$_POST["CallBackLeadStatus"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Użytkownik busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Nieprawidłowy number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STATUS INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Przychodząca calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Nieprawidłowy call reference value.", +88 => "Incompatible destination.", +95 => "Nieprawidłowy message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Nieprawidłowy information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery na timer expiry.", +103 => "Parameter non-existent or not implemented - passed na (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo ""; ### Gather agents data and statuses + $agentviewlistSQL=''; + $j=0; $stmt="SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user $AGENTviewSQL order by vu.full_name;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -6302,6 +8061,7 @@ if ($ACTION == 'AGENTSview') $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; if ( ($status=='READY') or ($status=='CLOSER') ) { @@ -6337,10 +8097,12 @@ if ($ACTION == 'AGENTSview') if ($comments=='AgentXferViewSelect') { - echo ""; - if ($agent_status_view_time > 0) - {echo "";} - echo ""; + $AXVSuserPORZĄDEK[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = $call_time; + $AXVSstatuscolor[$j] = $statuscolor; + $j++; } else { @@ -6353,8 +8115,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') + { + $AXVSuserPORZĄDEK[$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($AXVSuserPORZĄDEK); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserPORZĄDEK[$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"; + echo "    -GOTOWE      -Incall      -WSTRZYMANE  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} echo "\n"; } @@ -6552,6 +8395,1358 @@ 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     STATUS     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     WYBIERZ  
Nie wzywa dziś
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Zamknij Zadzwoń Zaloguj"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Wróć"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Wyniki znaleziono: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set sekundy='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STATUS     LAST Rozmowa     CITY     STATE     ZIP     INFO     WYBIERZ  
Nie znaleziono żadnych wyników
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Nie znaleziono żadnych wyników
"; + echo "
"; + echo "Wróć"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Wróć"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampania not found\n"; + echo "

"; + echo "Wróć"; + echo "
"; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Wróć"; + echo ""; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Wyniki znaleziono: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set sekundy='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Nie znaleziono żadnych wyników
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Nie znaleziono żadnych wyników
"; + echo "
"; + echo "Wróć"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Wróć"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampania not found\n"; + echo "

"; + echo "Wróć"; + echo ""; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Stan oddzwaniania:   $row[0]
Callback status wiodącego:   $row[7]
Czas Wejście oddzwaniania:   $row[1]
Callback czas wyzwalania:   $row[2]
Komentarze oddzwonienia:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Tytuł'; + $label_first_name = 'Imię'; + $label_middle_initial = 'MI'; + $label_last_name = 'Nazwisko'; + $label_address1 = 'Adres1'; + $label_address2 = 'Adres2'; + $label_address3 = 'Adres3'; + $label_city = 'Miasto'; + $label_state = 'Stan'; + $label_province = 'Powiat'; + $label_postal_code = 'KodPocztowy'; + $label_vendor_lead_code = 'Vendedor ID'; + $label_gender = 'Gender'; + $label_phone_number = 'Telefon'; + $label_phone_code = 'Prefiks'; + $label_alt_phone = 'Drugi telefon'; + $label_security_phrase = 'Pokaż'; + $label_email = 'Email'; + $label_comments = 'Komentarz'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefon and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon: Kierunek Poza Dialable Strefie $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Kod pocztowy Poza Dialable Strefie $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefon: Kierunek Poza Dialable Strefie $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Kod pocztowy Poza Dialable Strefie $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Status:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Zadzwoniono Since Nazwisko Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Zadzwoniono Count:   $row[24]
Nazwisko Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
ZAPROSZENIE dziennika dla tego OŁOWIU:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STATUS     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Brak połączenia znaleźć
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +9767,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_pl/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_pl/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pl/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_pl/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_pl/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_pl/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_pl/vdc_script_notes.php new file mode 100644 index 00000000..56c3c773 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pl/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 = 'Tytuł'; +$label_first_name = 'Imię'; +$label_middle_initial = 'MI'; +$label_last_name = 'Nazwisko'; +$label_address1 = 'Adres1'; +$label_address2 = 'Adres2'; +$label_address3 = 'Adres3'; +$label_city = 'Miasto'; +$label_state = 'Stan'; +$label_province = 'Powiat'; +$label_postal_code = 'KodPocztowy'; +$label_vendor_lead_code = 'Vendedor ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'Prefiks'; +$label_alt_phone = 'Drugi telefon'; +$label_security_phrase = 'Pokaż'; +$label_email = 'Email'; +$label_comments = 'Komentarz'; + +$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 "Nieprawidłowy NazwaUżytkownika/Hasło: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Notatki"; +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 Notatki:

+
Please click ZATWIERDŹ to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + +
+
+ + + + diff --git a/agc_2-X/trunk/LANG_www/agc_pl/vicidial.php b/agc_2-X/trunk/LANG_www/agc_pl/vicidial.php index dd01aea8..5626f4b6 100644 --- a/agc_2-X/trunk/LANG_www/agc_pl/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_pl/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -414,22 +523,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT WYBIERZ 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 na the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of sekundy to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location na the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### BEGIN find any custom field labels ### +$label_title = 'Tytuł'; +$label_first_name = 'Imię'; +$label_middle_initial = 'MI'; +$label_last_name = 'Nazwisko'; +$label_address1 = 'Adres1'; +$label_address2 = 'Adres2'; +$label_address3 = 'Adres3'; +$label_city = 'Miasto'; +$label_state = 'Stan'; +$label_province = 'Powiat'; +$label_postal_code = 'KodPocztowy'; +$label_vendor_lead_code = 'Vendedor ID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'Prefiks'; +$label_alt_phone = 'Drugi telefon'; +$label_security_phrase = 'Pokaż'; +$label_email = 'Email'; +$label_comments = 'Komentarz'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,249 +12720,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -WYLOGUJ\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Aktywna rozmowa
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Zalogowany jako + ring)";} + echo "  do kampani: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + WYLOGUJ\n"; ?> +
- -WYBIERANIE RĘCZNE       SZYBKA TARCZA
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Aktywna rozmowa
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STATUS:
+
+ Wybierz kolejny numer
+ + + PODGLĄD POŁĄCZEŃ
+ WYBIERANIE ALT NUM
+ + PLIK NAGRANIA:
+
+
+ NUMER NAGRANIA:
+
+ + Rozpocznij nagrywanie
+
+ Web Formularz
+ 0) + {echo "\"Web
\n";} + ?> +  
+ Zawieś rozmowę
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Transfer - Konferencja
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Niestandardowe
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Odłącz kilenta
+
+
Wyślij tonowo

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  Czas klienta:                         Kanał:
Informacje o kliencie:         + OŁÓW WYSZUKIWANIE";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Zadzwoń Uwagi: "; + if ($agent_call_log_view == '1') + {echo "
przeglądać notatki ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+
+
+ + + + + +WYBIERANIE RĘCZNE       SZYBKA TARCZA
- -X AKTYWNE INNE TERMINY
+ +
- -
+ +ZOBACZ ZAPROSZENIE ZALOGUJ
- sekundy: -     + +     + + + +
WERSJA:   KOMPILACJA:     Serwer:              
+ + Pokaż informacje o kanałach konferencyjnych +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +KLAWISZE SKRÓTU NIEAKTYWNE + + + sekundy: +    
- +
+
+ + +Twój Status:
Calls Dialing: +
+ + D1 - WYBIERZ\n"; - echo "
\n"; + echo "   \n"; echo "D2 - WYBIERZ\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
INNE TERMINY DLA AGENTA :
Kliknij poniżej na Inne terminy żeby teraz zadzwonić do klienta. Jeżeli klikniesz na rekordzie by zadzwonić, rekord zostanie usunięty z listy. -
-
-
  - Odswież -                 - Wróć -
-
+
 Wzywa w kolejce:  
 
- - height=>
NOWE RĘCZNE WYBIERANIE NUMERU DLA :

Wpisz poniżej informacje o kontakcie do którego chcesz wykonać połączenie. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Kod wybierania:   (dla polski będzie to 48)
Telefon Number: -   (12 digits max - digits only) -
Przeszukuj rekordy:   (This option if checked will attempt to find the phone number in the system before inserting it as a new lead)
-

-     -
-

Jeżeli chcesz wybrać numer tak aby NIE został dodany jako nowy kontakt, wpisz dokładny numer telefonu w polu Wybierz ten numer poniżej. By zakończyć połączenie musisz otworzyć ROZMOWY W TEJ SESJI (w dole ekranu), i zakończyć połączenie klinając na link jego kanału..
 
Wybierz ten numer:   (tylko cyfry) -
-
- Wybierz teraz -                 - Podgląd połączeń -                 - Wróć -
-
- - - -
-
- - - - -Twój Status:
Calls Dialing: -
- - - - - > - - -
-
- - Transfer - Konferencja            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - LOKALNY FINALIZUJĄCYCH     - - Rozłącz linię transferu -
- seconds -   - channel - - KONSULTACYJNA   - - Rozłącz obie linie -
- Numer do wybrania -   -   - agentów - - - WYBIERZ TEN NUMER - - WYJDŹ Z ROZMOWY 3-STRONNEJ -
- Wybierz numer do nieweryfikowanego transferu -   - Połącz z klientem -   - Zawieś połączenie z klientem -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Wzywa w kolejce:  
 
- - + 0) { @@ -10817,189 +13161,349 @@ if ($view_calls_in_queue > 0) ?> + +X AKTYWNE INNE TERMINY
+
-
  -Inne leki Status:  
 
+
  +Inne leki Status:  
 
-
-Transfer Dostępne pełnomocników:
+$webphone_content
\n"; + } +else + { + echo "
  + Web Telefon:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
agenci Zobacz +
+ + + +
  WebTelefon View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "Dialable Przewody:
 \n"; } ?>
- + - - - height=70> - -
Połączenie rozdysponowane jako:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
Klawisze skrótu dyspozycji: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Transfer - Konferencja            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LOKALNY FINALIZUJĄCYCH     + + Rozłącz linię transferu +
+ seconds +   + channel + + KONSULTACYJNA   + + Rozłącz obie linie +
+ Numer do wybrania +   + +                     + +   + + agentów + + + + + WYBIERZ TEN NUMER + + WYJDŹ Z ROZMOWY 3-STRONNEJ +
+ Wybierz numer do nieweryfikowanego transferu +   + Połącz z klientem +   + Zawieś połączenie z klientem +   + + Przycisk Presets + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Transfer Dostępne pełnomocników:
+ + + + + +
Połączenie rozdysponowane jako:

+ -
+
+
+ + + + - - + - + -
Klawisze skrótu dyspozycji: Kiedy aktywne, naciśnij guzik na klawiaturze w celu wybrania opcji dla tej rozmowy. Rozmowa zostanie automatycznie rozłączona a opcja ustawiona:
+ - + - + -
+
- - height=70> - - - + +
Previous Callback Information: close
+ + + - - + -
Previous Callback Information: close
-
-
-
-
+ +
+
+
+
-
+
- - height=70> - - - + +
Rozszerzony Alt telefonu: minimalizuj
+ + + - - + -
Rozszerzony Alt telefonu: minimalizuj
-
-
-
-
+
+
+
+
+
-
+
- - - - -
maksymalizuj
Alt Telefon Info
+ + + + +
maksymalizuj
Alt Telefon Info
- - height=>
Nikt nie uczestniczy w Twojej sesji:
+ +
Nikt nie uczestniczy w Twojej sesji:
Wróć -

- Ponownie połącz się z telefonem -
+

+ Ponownie połącz się z telefonem +
- - height=>
Klient sie rozłączył:
+ +
Klient sie rozłączył:
Wróć -

+

Zakończ i wprowadź rezultat rozmowy -
+
- - height=>
Call Wrapup sekundy remaining in wrapup

+ +
Call Wrapup sekundy remaining in wrapup

-

+

Finish Wrapup and Move On -
+
- -
-


+ +
+


Zamknij komunikat -
+
- - height=>
Wasza sesja była uszkadzana
WYLOGUJ

Wróć -
+ +
Wasza sesja była uszkadzana
WYLOGUJ

Wróć +
- - height=>
Istnieje problem synchronizacji czasu z systemem, należy powiadomić administratora systemu


Wróć -
+ +
Istnieje problem synchronizacji czasu z systemem, należy powiadomić administratora systemu


Wróć +
- - height=>

WYLOGUJ
+ +

WYLOGUJ
- -
+ +
- -
 
+ +
 
- - height=47>
Zmiany wprowadzone w informacjach o kliencie będą zapisane tylko podczas trwania połączenia. Nie po rozłączaniu!.
+ +
Zmiany wprowadzone w informacjach o kliencie będą zapisane tylko podczas trwania połączenia. Nie po rozłączaniu!.
- - height=>
REZULTAT ROZMOWY :       Rozłącz się ponownie       minimalizuj
+ +
REZULTAT ROZMOWY :       Rozłącz się ponownie       minimalizuj
+
\n";} + ?> + + + Koniec rozmowy, wybierz rezultat -
- ZATRZYMAJ DZWONIENIE
+
+ ZATRZYMAJ DZWONIENIE
WYCZYŚĆ FORMULARZ | ZATWIERDŹ -

+

WEB FORM ZATWIERDŹ -

  -
+

  +
- - height=>
WYBÓR SZYFR PRZERWY :
- Przerwa Code Selection - -

  -
-
- - - height=>
Wybierz grupę Alias :
- Wybór grupy Alias - -

  -
-
- - - - - - height=>
Wybierz datę oddzwonienia :
- - + +
Wybierz datę oddzwonienia :
+
\n";} + ?> + + Wybierz datę poniżej       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
TYLKO MOJE INNE TERMINY
";} + {echo " TYLKO MOJE INNE TERMINY
";} ?> - Notatki:

+ Notatki:

- ZATWIERDŹ

+ ZATWIERDŹ

-

  -
+

  +
- - height=>
SELEKCJA GRUPY ZAWNĘTRZNYCH FINALIZUJĄCYCH
- Selekcja grupy zawnętrznych finalizujących -
+ +
INNE TERMINY DLA AGENTA :
Aby zobaczyć informacje na temat jednego z wywołań zwrotnych poniżej, kliknij na link INFO. Aby zadzwonić do klienta z powrotem teraz, kliknij na link WYBIERZ. Jeśli klikniesz na płycie poniżej, aby go wybrać, zostanie na usunięty z listy. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Odswież +                 + Wróć +
+
+ + +
NOWE RĘCZNE WYBIERANIE NUMERU DLA :

Wpisz poniżej informacje o kontakcie do którego chcesz wykonać połączenie. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Kod wybierania:   (dla polski będzie to 48)
Telefon Number: +   (digits only) + + + +
Przeszukuj rekordy:   (This option if checked will attempt to find the phone number in the system before inserting it as a new lead)
+

+     +
+

Jeżeli chcesz wybrać numer tak aby NIE został dodany jako nowy kontakt, wpisz dokładny numer telefonu w polu Wybierz ten numer poniżej. By zakończyć połączenie musisz otworzyć ROZMOWY W TEJ SESJI (w dole ekranu), i zakończyć połączenie klinając na link jego kanału..
 
Wybierz ten numer:   (tylko cyfry) +
+
+ Wybierz teraz +                 + Podgląd połączeń +                 + Wróć +
+
+ + +
SELEKCJA GRUPY ZAWNĘTRZNYCH FINALIZUJĄCYCH
+
\n";} + ?> + Selekcja grupy zawnętrznych finalizujących +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - KOMBINOWANE POŁĄCZENIA(wychodzące aktywowane)
+ KOMBINOWANE POŁĄCZENIA(wychodzące aktywowane)
RESET | ZATWIERDŹ -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
WYBÓR TERYTORIUM
+
\n";} + ?> Territory Selection -
+
RESET | ZATWIERDŹ -



  -
+



  +
- - + Kanał Kanał TYLKO MOJE INNE TERMINY
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " KOMBINOWANE POŁĄCZENIA
";} + {echo " TYLKO MOJE INNE TERMINY
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " KOMBINOWANE POŁĄCZENIA
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT Rozmowa LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Wyszukiwanie kontaktów:             close [X]
+
\n";} + ?> +

+ Uwagi: podczas wyszukiwania kontaktu, wieloznaczne lub częściowe kryteria wyszukiwania nie są dozwolone.
Wywołań wyszukiwania kontaktowe są rejestrowane w systemie. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Imię Name:
Nazwisko Name:
BU Name:
Department:
Group Name:
Job Tytuł:
Location:

ZATWIERDŹ SEARCH             zresetować formularz
+

  +
+
+ + +
      KONTAKT WYNIKI WYSZUKIWANIA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      SZUKAJ OŁOWIU:             close [X]
+
\n";} + ?> +

+ Uwagi: podczas wyszukiwania dla ołowiu, numer telefonu, identyfikator lub prowadzić są najlepsze pola w użyciu.
Korzystanie z innych pól może być wolniejsze. Wiodący wyszukiwania nie pozwala na wieloznacznych lub częściowe warunków wyszukiwania.
Ołów żądania wyszukiwania są rejestrowane w systemie. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefon Number:
Telefon Number Fields: + Główny numer telefonu + Alternatywny numer telefonu + Adres3 numer telefonu +
Lead ID:
:
:
:
:
:
:

ZATWIERDŹ SEARCH             zresetować formularz
+

  +
+
+ + +
      WYNIKI WYSZUKIWANIA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      ZAPROSZENIE ZALOGUJ NOTES:             close [X]
+
\n";} + ?> +
Lista połączeń Uwagi
+

  + Close Box Info +
+
+ + +
      Informacje o kliencie:             close [X] +
+
\n";} + ?> + Lead Info +

  + Close Box Info +
+
+ + +
WYBÓR SZYFR PRZERWY :
+
\n";} + ?> + Przerwa Code Selection + +

  +
+
+ + +
SELECT PRESET :
+
\n";} + ?> + Presets Selection + +
+
+ + +
Wybierz grupę Alias :
+
\n";} + ?> + Wybór grupy Alias + +

  +
+
+ + +
ALERT :
+     +

Wróć +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -KLAWISZE SKRÓTU NIEAKTYWNE - + + + - -> +
Agent web-client version:     KOMPILACJA:               Serwer:              
- -Pokaż informacje o kanałach konferencyjnych -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
STATUS:
-
-Wybierz kolejny numer
- PODGLĄD POŁĄCZEŃ
- WYBIERANIE ALT NUM
- - -PLIK NAGRANIA:
-
-
-NUMER NAGRANIA:
-
- -Rozpocznij nagrywanie
-
-Web Formularz
- 0) - {echo "\"Web
\n";} -?> -
-Zawieś rozmowę
-Transfer - Konferencja
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Odłącz kilenta
-
-
Wyślij tonowo

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Kanał:
Informacje o kliencie:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tytuł:   Imię:   2 Imię:   Nazwisko:
Adres1:
Adres2: Adres3:
Miasto: Stan: KodPocztowy:
Powiat: Vendedor ID: Płeć:
Telefon: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -Prefiks: Drugi telefon:
Pokaż: Email:
Komentarz: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_pt/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_pt/astguiclient.php index 3cb5f3fa..8ff805eb 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_pt/calendar.css b/agc_2-X/trunk/LANG_www/agc_pt/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pt/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/agc_2-X/trunk/LANG_www/agc_pt/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_pt/calendar_db.js new file mode 100644 index 00000000..ab540a69 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pt/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' : ['Janeiro', 'February', 'Março', 'Abril', 'Pode', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], + '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 ("Inválido 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 ("Inválido 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("Inválido 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/agc_2-X/trunk/LANG_www/agc_pt/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_pt/conf_exten_check.php index 56f1da42..d7cd75d7 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; - if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { echo "Inválido Username/Senha: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Verificação Da Extensão De Conf"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Verificação Da Extensão De Conf"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten é inválido\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check em calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Solicita, em fila: $RingCalls";} + else {$RingCalls = "Solicita, em fila: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check em calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Solicita, em fila: $RingCalls";} - else {$RingCalls = "Solicita, em fila: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $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 . '|Status: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten é inválido or Exten $exten é inválido\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Conferência $conf_exten foi registado a $exten\n"; + echo "Conferência $conf_exten foi registado a $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_pt/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_pt/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_pt/functions.php b/agc_2-X/trunk/LANG_www/agc_pt/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pt/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_pt/manager_send.php b/agc_2-X/trunk/LANG_www/agc_pt/manager_send.php index c66c5512..719477c8 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -94,12 +99,21 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -289,6 +314,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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten é inválido or queryCID $queryCID é inválido, Originate comando não introduzido\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -795,10 +869,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='PARQUEED',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='PARQUE',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") @@ -822,9 +959,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='PARQUE',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 "Uma destas variáveis é inválido:\n"; + echo "Channel $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "extenName $extenName deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "parkedby $parkedby deve ser ajustado\n"; + echo "\nRedirectToPark Action não emitido\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='PARQUE_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='IVRPARQUEED',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='IVRPARQUE',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 "Uma destas variáveis é inválido:\n"; + echo "Channel $channel deve ser mais grande de 2 caráteres\n"; + echo "queryCID $queryCID deve ser mais grande de 14 caráteres\n"; + echo "exten $exten deve ser ajustado\n"; + echo "ext_context $ext_context deve ser ajustado\n"; + echo "ext_priority $ext_priority deve ser ajustado\n"; + echo "\nRedirectFromPark Action não emitido\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='IVRPARQUE',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) ) @@ -1031,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está vivo em $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1138,7 +1547,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); } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1248,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel não está vivo em $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_pt/phone_only.php b/agc_2-X/trunk/LANG_www/agc_pt/phone_only.php new file mode 100644 index 00000000..d45c3354 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pt/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Você tem registrado agora para fora. Obrigado\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST em server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link em the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location em the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefone 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 Português
\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 "\n"; + echo "
\"VICIdial\" Telefone-Only Início de uma sessão
 
Início de uma sessão Do Telefone:
Senha Do Telefone:
Início de uma sessão Do Usuário:
Senha Do Usuário:
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefone web client: Início de uma sessão Do Telefone\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefone-Only Início de uma sessão
 
Início de uma sessão Do Telefone:
Senha Do Telefone:
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "O início de uma sessão incorreto, tenta por favor outra vez
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefone 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 Português
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefone-Only Início de uma sessão
 
Início de uma sessão Do Usuário:
Senha Do Usuário:
  \n"; + echo "

VERSÃO: $version       CONFIGURAÇÃO: $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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefone web client: Início de uma sessão Do Telefone Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Português
\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 "
\"VICIdial\" Telefone-Only Início de uma sessão Error
 
Pesaroso, seus início de uma sessão do telefone e senha não seja:
 
Início de uma sessão Do Telefone:
Senha Do Telefone:

VERSÃO: $version       CONFIGURAÇÃO: $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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefone 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call segundos counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - segundos em call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefone: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefone:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_pt/timeclock.php b/agc_2-X/trunk/LANG_www/agc_pt/timeclock.php index 82d84e2b..286f8496 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/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 ##### @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Você tem agora registrados em"; + $LOGtimeMESSAGE = "Você logou em $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -338,7 +340,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($referrer=='agent') {$BACKlink = "BACK TO Agent Início de uma sessão Screen";} if ($referrer=='admin') - {$BACKlink = "Retornar para Administração";} + {$BACKlink = "Retornar para Administração";} if ($referrer=='welcome') {$BACKlink = "ANTERIOR a tela Bem-vindo";} diff --git a/agc_2-X/trunk/LANG_www/agc_pt/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_pt/vdc_db_query.php index e1fe8bee..91e7ba9e 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStatus"])) {$CallBackLeadStatus=$_GET["CallBackLeadStatus"];} + elseif (isset($_POST["CallBackLeadStatus"])) {$CallBackLeadStatus=$_POST["CallBackLeadStatus"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Usuário busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Inválido number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STATUS INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Entrante calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Inválido call reference value.", +88 => "Incompatible destination.", +95 => "Inválido message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Inválido information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery em timer expiry.", +103 => "Parameter non-existent or not implemented - passed em (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo ""; ### Gather agents data and statuses + $agentviewlistSQL=''; + $j=0; $stmt="SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user $AGENTviewSQL order by vu.full_name;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -6302,6 +8061,7 @@ if ($ACTION == 'AGENTSview') $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; if ( ($status=='READY') or ($status=='CLOSER') ) { @@ -6337,10 +8097,12 @@ if ($ACTION == 'AGENTSview') if ($comments=='AgentXferViewSelect') { - echo ""; - if ($agent_status_view_time > 0) - {echo "";} - echo ""; + $AXVSuserORDEM[$j] = "$full_name$US$j"; + $AXVSuser[$j] = $user; + $AXVSfull_name[$j] = $full_name; + $AXVScall_time[$j] = $call_time; + $AXVSstatuscolor[$j] = $statuscolor; + $j++; } else { @@ -6353,8 +8115,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') + { + $AXVSuserORDEM[$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($AXVSuserORDEM); + while ($j > $k) + { + $order_split = explode("_",$AXVSuserORDEM[$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"; + echo "    -PRONTO      -Chamadas      -PAUSA  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} echo "\n"; } @@ -6552,6 +8395,1358 @@ 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     STATUS     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     SELETOR  
Nenhuma chamada neste dia
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Feche Registro de chamadas"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Vá Para trás"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Resultados Encontrado: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set segundos='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STATUS     LAST CHAMADA     CITY     STATE     ZIP     INFO     SELETOR  
Não foram encontrados resultados
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Não foram encontrados resultados
"; + echo "
"; + echo "Vá Para trás"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Vá Para trás"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campanha not found\n"; + echo "

"; + echo "Vá Para trás"; + echo ""; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Vá Para trás"; + echo ""; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Resultados Encontrado: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set segundos='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Não foram encontrados resultados
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Não foram encontrados resultados
"; + echo "
"; + echo "Vá Para trás"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Vá Para trás"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Campanha not found\n"; + echo "

"; + echo "Vá Para trás"; + echo ""; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Estado de retorno de chamada:   $row[0]
Callback Estado de chumbo:   $row[7]
Tempo de entrada de retorno de chamada:   $row[1]
Callback tempo de disparo:   $row[2]
Comentários de retorno de chamada:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Título'; + $label_first_name = 'Prime'; + $label_middle_initial = 'MI'; + $label_last_name = 'Último'; + $label_address1 = 'Endereço1'; + $label_address2 = 'Endereço2'; + $label_address3 = 'Endereço3'; + $label_city = 'Cidade'; + $label_state = 'Estado'; + $label_province = 'Província'; + $label_postal_code = 'PostCode'; + $label_vendor_lead_code = 'Vendedor Id'; + $label_gender = 'Gender'; + $label_phone_number = 'Telefone'; + $label_phone_code = 'DialCode'; + $label_alt_phone = 'Alt. Telefone'; + $label_security_phrase = 'Mostra'; + $label_email = 'Email'; + $label_comments = 'Comentários'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefone and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefone Código de Área fora da zona discável $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Código Postal fora da zona discável $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefone Código de Área fora da zona discável $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Código Postal fora da zona discável $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Status:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Chamado Since Último Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Chamado Count:   $row[24]
Último Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
CONVITE PARA ESTE LOG LEAD:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STATUS     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Nenhuma chamada encontrado
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +9767,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_pt/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_pt/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pt/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_pt/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_pt/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_pt/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_pt/vdc_script_notes.php new file mode 100644 index 00000000..2161caaf --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_pt/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 = 'Título'; +$label_first_name = 'Prime'; +$label_middle_initial = 'MI'; +$label_last_name = 'Último'; +$label_address1 = 'Endereço1'; +$label_address2 = 'Endereço2'; +$label_address3 = 'Endereço3'; +$label_city = 'Cidade'; +$label_state = 'Estado'; +$label_province = 'Província'; +$label_postal_code = 'PostCode'; +$label_vendor_lead_code = 'Vendedor Id'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefone'; +$label_phone_code = 'DialCode'; +$label_alt_phone = 'Alt. Telefone'; +$label_security_phrase = 'Mostra'; +$label_email = 'Email'; +$label_comments = 'Comentários'; + +$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 "Inválido Username/Senha: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Notas"; +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 Notas:

+
Please click SUBMETA to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + +
+
+ + + + diff --git a/agc_2-X/trunk/LANG_www/agc_pt/vicidial.php b/agc_2-X/trunk/LANG_www/agc_pt/vicidial.php index 5f141e2c..722e326d 100644 --- a/agc_2-X/trunk/LANG_www/agc_pt/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_pt/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -414,22 +523,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT SELETOR 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 em the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of segundos to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location em the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### BEGIN find any custom field labels ### +$label_title = 'Título'; +$label_first_name = 'Prime'; +$label_middle_initial = 'MI'; +$label_last_name = 'Último'; +$label_address1 = 'Endereço1'; +$label_address2 = 'Endereço2'; +$label_address3 = 'Endereço3'; +$label_city = 'Cidade'; +$label_state = 'Estado'; +$label_province = 'Província'; +$label_postal_code = 'PostCode'; +$label_vendor_lead_code = 'Vendedor Id'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefone'; +$label_phone_code = 'DialCode'; +$label_alt_phone = 'Alt. Telefone'; +$label_security_phrase = 'Mostra'; +$label_email = 'Email'; +$label_comments = 'Comentários'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,249 +12720,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -LOGOUT\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Vive A Chamada
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Usuário + ring)";} + echo "  à campanha: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + LOGOUT\n"; ?> +
- -SELETOR MANUAL       SELETOR RÁPIDO
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Vive A Chamada
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STATUS:
+
+ Número Seguinte Do Seletor
+ + + INSPECÇÃO PRÉVIA DA LIGAÇÃO
+ ALT DO TELEFONE
+ + LIMA DE GRAVAÇÃO:
+
+
+ ID RECORD:
+
+ + Comece Gravar
+
+ Formulário Da Correia fotorreceptora
+ 0) + {echo "\"Formulário
\n";} + ?> +  
+ Chamada Do Parque
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Transferência - Conferência
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Transferência
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Cliente Do Hangup
+
+
Emita DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  Hora do cliente:                         Canaleta:
Informação Do Cliente:         + LEAD PESQUISA";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Chame Notas: "; + if ($agent_call_log_view == '1') + {echo "
ver as notas ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+
+
+ + + + + +SELETOR MANUAL       SELETOR RÁPIDO
- -X RECHAMADAS ATIVAS
+ +
- -
+ +VEJA Registro de chamadas
- segundos: -     + +     + + + +
VERSÃO:   CONFIGURAÇÃO:     Usuário:              
+ + Mostre a informação da canaleta da chamada de conferência +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +CHAVES QUENTES INATIVAS + + + segundos: +    
- +
+
+ + +Seu Status:
Calls Dialing: +
+ + D1 - SELETOR\n"; - echo "
\n"; + echo "   \n"; echo "D2 - SELETOR\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
RECHAMADAS PARA O AGENTE :
Estale sobre uma rechamada abaixo para chamar agora a parte traseira do cliente. Se você estalar sobre um registro abaixo para o chamar, estará removido da lista. -
-
-
  - Refresque -                 - Vá Para trás -
-
+
 Solicita, em fila:  
 
- - height=>
LIGAÇÃO MANUAL NOVA DO SELETOR PARA :

Incorpore a informação abaixo para a ligação que nova você deseja se chamar. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Código Do Seletor:   (Este é geralmente um 1 nos EUA e no Canadá)
Telefone Number: -   (12 digits max - digits only) -
Ligações Existentes Da Busca:   (Esta opção se verificado tentará encontrar o número de telefone no sistema antes de introduzi-lo como uma ligação nova)
-

-     -
-

Se você quiser marcar um número e o ter não adicionado como uma ligação nova, entre no dialstring exato esse você querem chamar-se abaixo no campo da ultrapassagem do seletor. Ao hangup esta chamada você terá que abrir as CHAMADAS ncEsta ligação da SESSÃO no fundo da tela e pendurá-las acima estalando em sua ligação da canaleta lá.
 
Ultrapassagem Do Seletor:   (os dígitos satisfazem somente) -
-
- Seletor Agora -                 - Preview Call -                 - Vá Para trás -
-
- - - -
-
- - - - -Seu Status:
Calls Dialing: -
- - - - - > - - -
-
- - Transferência - Conferência            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - LOCAL MAIS PRÓXIMO     - - Linha De Xfer Do Hangup -
- seconds -   - channel - - CONSULTIVO   - - Hangup Ambas as Linhas -
- Número a chamar-se -   -   - AGENTES - - - ULTRAPASSAGEM DO SELETOR - - CHAMADA DA LICENÇA 3-WAY -
- Transferência Da Cortina Do Seletor -   - Seletor Com Cliente -   - Seletor Do Cliente Do Parque -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Solicita, em fila:  
 
- - + 0) { @@ -10817,189 +13161,349 @@ if ($view_calls_in_queue > 0) ?> + +X RECHAMADAS ATIVAS
+
-
  -Outros agentes Status:  
 
+
  +Outros agentes Status:  
 
-
-Agentes de transferência disponíveis:
+$webphone_content
\n"; + } +else + { + echo "
  + Web Telefone:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
Agentes Ver +
+ + + +
  WebTelefone View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "Leads discáveis:
 \n"; } ?>
- + - - - height=70> - -
Ligação Dispositioned Como:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
Chaves Quentes Da Disposição: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Transferência - Conferência            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LOCAL MAIS PRÓXIMO     + + Linha De Xfer Do Hangup +
+ seconds +   + channel + + CONSULTIVO   + + Hangup Ambas as Linhas +
+ Número a chamar-se +   + +                     + +   + + AGENTES + + + + + ULTRAPASSAGEM DO SELETOR + + CHAMADA DA LICENÇA 3-WAY +
+ Transferência Da Cortina Do Seletor +   + Seletor Com Cliente +   + Seletor Do Cliente Do Parque +   + + Botão Presets + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Agentes de transferência disponíveis:
+ + + + + +
Ligação Dispositioned Como:

+ -
+
+
+ + + + - - + - + -
Chaves Quentes Da Disposição: Quando ativo, pressione simplesmente a chave de teclado para a:
+ - + - + -
+
- - height=70> - - - + +
Informação Precedente Da Rechamada: close
+ + + - - + -
Informação Precedente Da Rechamada: close
-
-
-
-
+ +
+
+
+
-
+
- - height=70> - - - + +
Extensão Alt Telefone Informação: minimize
+ + + - - + -
Extensão Alt Telefone Informação: minimize
-
-
-
-
+
+
+
+
+
-
+
- - - - -
maximize
Alt Telefone Info
+ + + + +
maximize
Alt Telefone Info
- - height=>
Noone está em sua sessão:
+ +
Ninguém está na sua sessão:
Vá Para trás -

- Agente Da Chamada Outra vez -
+

+ Agente Da Chamada Outra vez +
- - height=>
O cliente pendurou acima:
+ +
O cliente pendurou acima:
Vá Para trás -

+

Revestimento e chamada da disposição -
+
- - height=>
Chamada Wrapup: segundos restantes no wrapup

+ +
Chamada Wrapup: segundos restantes no wrapup

-

+

Revestimento Wrapup e movimento sobre -
+
- -
-


+ +
+


Fechar Mensagem -
+
- - height=>
Sua sessão foi incapacitada
LOGOUT

Vá Para trás -
+ +
Sua sessão foi incapacitada
LOGOUT

Vá Para trás +
- - height=>
Há um tempo sincronização problema com o seu sistema, por favor informe o seu administrador de sistema


Vá Para trás -
+ +
Há um tempo sincronização problema com o seu sistema, por favor informe o seu administrador de sistema


Vá Para trás +
- - height=>

LOGOUT
+ +

LOGOUT
- -
+ +
- -
 
+ +
 
- - height=47>
Todas as mudanças feitas ao cliente que a informação abaixo neste tempo não será comitted, você devem mudar a informação do cliente antes de você hangup a chamada.
+ +
Todas as mudanças feitas ao cliente que a informação abaixo neste tempo não será comitted, você devem mudar a informação do cliente antes de você hangup a chamada.
- - height=>
CHAMADA DA DISPOSIÇÃO :       Hangup Outra vez       minimize
+ +
CHAMADA DA DISPOSIÇÃO :       Hangup Outra vez       minimize
+
\n";} + ?> + + + Extremidade-$$$-CHAME A Seleção Da Disposição -
- PARE DE CHAMAR-SE
+
+ PARE DE CHAMAR-SE
RESTAURAÇÃO | SUBMETA -

+

WEB FORM SUBMETA -

  -
+

  +
- - height=>
SELECIONE Um CÓDIGO Da PAUSA :
- Pausa Code Selection - -

  -
-
- - - height=>
Selecionar um grupo ALIÁS :
- Grupo Alias Selecção - -

  -
-
- - - - - - height=>
Selecione uma data da rechamada :
- - + +
Selecione uma data da rechamada :
+
\n";} + ?> + + Selecione uma data abaixo       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
MINHA RECHAMADA SOMENTE
";} + {echo " MINHA RECHAMADA SOMENTE
";} ?> - Comentários dos CB:

+ Comentários dos CB:

- SUBMETA

+ SUBMETA

-

  -
+

  +
- - height=>
SELEÇÃO DE GRUPO INBOUND MAIS PRÓXIMA
- Seleção De Grupo Inbound Mais próxima -
+ +
RECHAMADAS PARA O AGENTE :
Para ver informações sobre um dos callbacks abaixo, clique no link INFO. Para chamar o cliente de volta agora, clique no link SELETOR. Se você clicar em um registro abaixo para marcá-lo, ele será removido da lista. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Refresque +                 + Vá Para trás +
+
+ + +
LIGAÇÃO MANUAL NOVA DO SELETOR PARA :

Incorpore a informação abaixo para a ligação que nova você deseja se chamar. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Código Do Seletor:   (Este é geralmente um 1 nos EUA e no Canadá)
Telefone Number: +   (digits only) + + + +
Ligações Existentes Da Busca:   (Esta opção se verificado tentará encontrar o número de telefone no sistema antes de introduzi-lo como uma ligação nova)
+

+     +
+

Se você quiser marcar um número e o ter não adicionado como uma ligação nova, entre no dialstring exato esse você querem chamar-se abaixo no campo da ultrapassagem do seletor. Ao hangup esta chamada você terá que abrir as CHAMADAS ncEsta ligação da SESSÃO no fundo da tela e pendurá-las acima estalando em sua ligação da canaleta lá.
 
Ultrapassagem Do Seletor:   (os dígitos satisfazem somente) +
+
+ Seletor Agora +                 + Preview Call +                 + Vá Para trás +
+
+ + +
SELEÇÃO DE GRUPO INBOUND MAIS PRÓXIMA
+
\n";} + ?> + Seleção De Grupo Inbound Mais próxima +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - CHAMADA MISTURADA(outbound ativado)
+ CHAMADA MISTURADA(outbound ativado)
RESTAURAÇÃO | SUBMETA -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
SELEÇÃO DE TERRITÓRIO
+
\n";} + ?> Territory Selection -
+
RESTAURAÇÃO | SUBMETA -



  -
+



  +
- - + Canaleta Canaleta MINHA RECHAMADA SOMENTE
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " CHAMADA MISTURADA
";} + {echo " MINHA RECHAMADA SOMENTE
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " CHAMADA MISTURADA
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT CHAMADA LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Procurar um Contato:             close [X]
+
\n";} + ?> +

+ Notas: ao fazer uma busca de um contato, termos de pesquisa curinga ou parcial não são permitidos.
Pedidos de busca de contato são todos registrados no sistema. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Prime Name:
Último Name:
BU Name:
Department:
Group Name:
Job Título:
Location:

SUBMETA SEARCH             repor forma
+

  +
+
+ + +
      CONTACTOS PESQUISA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      BUSCA POR UMA LEAD:             close [X]
+
\n";} + ?> +

+ Notas: ao fazer uma busca por um chumbo, o número de telefone, levar identidade ou são as melhores campos para usar.
Usando os outros campos pode ser mais lento. Busca de chumbo não permite termos de pesquisa curinga ou parcial.
Solicitações de pesquisa de chumbo são todos registrados no sistema. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefone Number:
Telefone Number Fields: + Número de telefone principal + Número de telefone alternativo + Endereço3 número de telefone +
Lead ID:
:
:
:
:
:
:

SUBMETA SEARCH             repor forma
+

  +
+
+ + +
      RESULTADOS DA PROCURA:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Registro de chamadas NOTAS:             close [X]
+
\n";} + ?> +
Call List Notas
+

  + Info Box Fechar +
+
+ + +
      Informação Do Cliente:             close [X] +
+
\n";} + ?> + Lead Info +

  + Info Box Fechar +
+
+ + +
SELECIONE Um CÓDIGO Da PAUSA :
+
\n";} + ?> + Pausa Code Selection + +

  +
+
+ + +
Selecione um Preset :
+
\n";} + ?> + Presets Selection + +
+
+ + +
Selecionar um grupo ALIÁS :
+
\n";} + ?> + Grupo Alias Selecção + +

  +
+
+ + +
ALERT :
+     +

Vá Para trás +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -CHAVES QUENTES INATIVAS - + + + - -> +
Agent web-client version:     CONFIGURAÇÃO:               Usuário:              
- -Mostre a informação da canaleta da chamada de conferência -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
STATUS:
-
-Número Seguinte Do Seletor
- INSPECÇÃO PRÉVIA DA LIGAÇÃO
- ALT DO TELEFONE
- - -LIMA DE GRAVAÇÃO:
-
-
-ID RECORD:
-
- -Comece Gravar
-
-Formulário Da Correia fotorreceptora
- 0) - {echo "\"Formulário
\n";} -?> -
-Chamada Do Parque
-Transferência - Conferência
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Cliente Do Hangup
-
-
Emita DTMF

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Canaleta:
Informação Do Cliente:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Título:   Prime:   Mi:  Último:
Endereço1:
Endereço2: Endereço3:
Cidade: Estado: PostCode:
Província: Vendedor Id: Sexo:
Telefone: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -DialCode: Alt. Telefone:
Mostra: Email:
Comentários: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_ru/active_list_refresh.php b/agc_2-X/trunk/LANG_www/agc_ru/active_list_refresh.php index 3279f941..96d8fb7b 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/active_list_refresh.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/active_list_refresh.php @@ -126,7 +126,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else @@ -134,7 +134,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -146,7 +146,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -161,11 +161,11 @@ if ($format=='table') echo "\n"; echo "\n"; echo "\n"; -echo "Показывать Списки: "; -if ($ADD==1) {echo "Активные расширения";} -if ($ADD==2) {echo "Занятые Расширения";} -if ($ADD==3) {echo "Внешние Линии";} -if ($ADD==4) {echo "Локальные Расширения";} +echo "<title>Отображение списка: "; +if ($ADD==1) {echo "Активные номера";} +if ($ADD==2) {echo "Занятые номера";} +if ($ADD==3) {echo "Внешние линии";} +if ($ADD==4) {echo "Местные номера";} if ($ADD==5) {echo "Конференции";} if ($ADD==99999) {echo "ПОМОЩЬ";} echo "\n"; @@ -470,7 +470,7 @@ if ($ADD==5) $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); -if ($format=='table') {echo "\n";} +if ($format=='table') {echo "\n";} if ($format=='table') {echo "\n\n\n";} exit; diff --git a/agc_2-X/trunk/LANG_www/agc_ru/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_ru/astguiclient.php index 155c8d83..7558176d 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -145,7 +146,7 @@ if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') ) { header ("Content-type: text/html; charset=utf-8"); - echo "web-клиент astGUIclient: Login\n"; + echo "Веб-клиент astGUIclient: Login\n"; echo "\n"; echo "\n"; echo "\n"; @@ -155,18 +156,18 @@ echo " + + +
\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "
Логин Вход
 
Логин Пользователя:
Ваше имя:
Пароль Пользователя:
Ваш пароль:
Логин Телефона:
Ваш телефон:
Пароль Телефона:
Пароль телефона:

ВЕРСИЯ: $version       СБОРКА: $build
\n"; echo "\n\n"; @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -210,7 +211,7 @@ echo "\n"; if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) { -echo "web-клиент astGUIclient: Логин Телефона\n"; +echo "Веб-клиент astGUIclient: Ваш телефон\n"; echo "\n"; echo "\n"; echo "\n"; @@ -222,14 +223,14 @@ echo "\n"; echo "\n"; echo "


"; echo ""; -echo ""; +echo ""; echo "\n"; echo "\n"; -echo ""; +echo ""; echo "\n"; -echo ""; +echo ""; echo "\n"; -echo "\n"; +echo "\n"; echo "\n"; echo "
Логин Телефона Ваш телефон
 
Логин Телефона:
Ваш телефон:
Пароль Телефона:
Пароль телефона:

ВЕРСИЯ: $version       СБОРКА: $build
\n"; echo "\n\n"; @@ -247,7 +248,7 @@ $row=mysql_fetch_row($rslt); $authphone=$row[0]; if (!$authphone) { - echo "web-клиент astGUIclient: Логин Телефона\n"; + echo "Веб-клиент astGUIclient: Ваш телефон\n"; echo "\n"; echo "\n"; echo "\n"; @@ -259,14 +260,14 @@ echo "
\n"; echo "


"; echo ""; - echo ""; + echo ""; echo "\n"; - echo "\n"; - echo ""; + echo "\n"; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "
Логин Телефона Ваш телефон
 
Извините, но ваш логин и пароль телефона не активен в этой системе. Пожалуйста, попробуйте еще раз:
 
Логин Телефона:
 
Извините, Ваш телефон и его пароль не активировны в системе, попробуйте еще раз, пожалуйста:
 
Ваш телефон:
Пароль Телефона:
Пароль телефона:

ВЕРСИЯ: $version       СБОРКА: $build
\n"; echo "\n\n"; @@ -276,7 +277,7 @@ echo "
web-клиент astGUIclient\n"; + echo "Веб-клиент astGUIclient\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); @@ -492,15 +493,15 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var phone_pass = ''; var session_name = ''; var image_livecall_OFF = new Image(); - image_livecall_OFF.src="../agc/images/agc_live_call_OFF.gif"; + image_livecall_OFF.src="../agc/images/agc_live_call_OFF_ru.gif"; var image_livecall_ON = new Image(); - image_livecall_ON.src="../agc/images/agc_live_call_ON.gif"; + image_livecall_ON.src="../agc/images/agc_live_call_ON_ru.gif"; var image_voicemail_OFF = new Image(); - image_voicemail_OFF.src="../agc/images/agc_check_voicemail_OFF.gif"; + image_voicemail_OFF.src="../agc/images/agc_check_voicemail_OFF_ru.gif"; var image_voicemail_ON = new Image(); - image_voicemail_ON.src="../agc/images/agc_check_voicemail_ON.gif"; + image_voicemail_ON.src="../agc/images/agc_check_voicemail_ON_ru.gif"; var image_voicemail_BLINK = new Image(); - image_voicemail_BLINK.src="../agc/images/agc_check_voicemail_BLINK.gif"; + image_voicemail_BLINK.src="../agc/images/agc_check_voicemail_BLINK_ru.gif"; var favorites = new Array(); var favorites_names = new Array(); var favorites_busy = new Array(); @@ -887,7 +888,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} else { bsr_continue=0; - alert("Вы можете только контролировать Zap каналы:\n" + listenvalue); + alert("Отслеживать можно только линии ISDN (ZAP):\n" + listenvalue); } } if (bsr_continue == '1') @@ -953,7 +954,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} } // ################################################################################ -// Send Redirect command for live call to Менеджерsends phone name where call is going to +// Send Redirect command for live call to Начальник sends phone name where call is going to function mainxfer_send_redirect(taskvar,taskxferconf) { var xmlhttp=false; @@ -1046,7 +1047,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} // ################################################################################ -// Send Originate command for local dial to Менеджерsends phone name where call is going to +// Send Originate command for local dial to Начальник sends phone name where call is going to function mainxfer_send_originate(taskvar,taskxferconf,taskentrypop) { var xmlhttp=false; @@ -1197,7 +1198,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} { recLIST = recLIST + "|" + monitorchannelvalue; filename = filedate + "_" + user_abb; - var rec_start_html = "Остановить Запись"; + var rec_start_html = "Остановить запись"; document.getElementById(taskspan).innerHTML = rec_start_html; } @@ -1207,7 +1208,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} recLIST = recLIST.replace(regy, ''); filename = taskfile; - var rec_stop_html = "Record"; + var rec_stop_html = "Запись"; document.getElementById(taskspan).innerHTML = rec_stop_html; } livemonitor_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=" + monitorvalue + "&format=text&channel=" + monitorchannelvalue + "&queryCID=" + queryCID + "&filename=" + filename + "&exten=" + protocol + "/" + extension; @@ -1259,7 +1260,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} recLIST = recLIST + "|" + taskconfrec; filename = filedate + "_" + user_abb; var channelrec = "Local/" + taskconfrec + "@" + ext_context; - var conf_rec_start_html = "Остановить Запись"; + var conf_rec_start_html = "Остановить запись"; document.getElementById(taskconfspan).innerHTML = conf_rec_start_html; } @@ -1270,7 +1271,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} filename = taskconffile; var channelrec = "Local/" + taskconfrec + "@" + ext_context; - var conf_rec_start_html = "Record"; + var conf_rec_start_html = "Запись"; document.getElementById(taskconfspan).innerHTML = conf_rec_start_html; } confmonitor_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=" + taskconfrectype + "&format=text&channel=" + channelrec + "&filename=" + filename + "&exten=" + recording_exten + "&ext_context=" + ext_context + "&ext_priority=1"; @@ -1386,7 +1387,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=3; if (live_calls > 0) { - var live_calls_HTML = "ЖИВЫЕ ВЫЗОВЫ НА ЭТОТ ТЕЛЕФОН:
"; + var live_calls_HTML = "АКТИВНЫЕ ЗВОНКИ ДЛЯ ЭТОГО ТЕЛЕФОНА:
#КАНАЛ КЛИЕНТАУДАЛЕННЫЙ КАНАЛRECORDРАЗЪЕДИНЕНИЕПЕРЕВОДПАРКОВКА
"; if ( (LCAcount > live_calls) || (LCAcount < live_calls) ) { LCAe[0]=''; LCAe[1]=''; LCAe[2]=''; LCAe[3]=''; LCAe[4]=''; LCAe[5]=''; @@ -1402,7 +1403,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} {var row_color = '#DDDDFF';} else {var row_color = '#CCCCFF';} - var Recordbutton = 'Monitor'; + var Записьbutton = 'Monitor'; var conv_ct = (loop_ct + conv_start); var conversation_array = check_live_array[conv_ct].split(" ~"); var channelfieldA_array = conversation_array[1].split(": "); @@ -1412,11 +1413,11 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var regx = new RegExp("\\|"+channelfieldBtrunk_array[1],"ig"); if (recLIST.match(regx)) - {live_calls_HTML = live_calls_HTML + "Остановить Запись";} + {live_calls_HTML = live_calls_HTML + "Остановить запись";} else - {live_calls_HTML = live_calls_HTML + "Record";} + {live_calls_HTML = live_calls_HTML + "Запись";} - live_calls_HTML = live_calls_HTML + ""; + live_calls_HTML = live_calls_HTML + ""; if (LCAe[ARY_ct].length < 1) {LCAe[ARY_ct] = channelfieldA_array[1]; LCAcontent_change++; LCAalter++;} @@ -1533,7 +1534,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=0; if (out_calls > 0) { - var out_log_HTML = "
#ЛИНИЯ КЛИЕНТАУДАЛЕННАЯ ЛИНИЯRECORDЗАВЕРШЕНИЕПЕРЕВОДПАРКОВКА
РАЗЪЕДИНЕНИЕПЕРЕВОДПАРКОВКА
ЗАВЕРШЕНИЕПЕРЕВОДПАРКОВКА
" + var out_log_HTML = "
# ЗВОНИТЬ ДАТА/ВРЕМЯНОМЕРLENGTH (M:SS)
" while (loop_ct < out_calls) { loop_ct++; @@ -1561,7 +1562,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=0; if (in_calls > 0) { - var in_log_HTML = "
# ДАТА И ВРЕМЯ ЗВОНКАНОМЕРLENGTH (M:SS)
" + var in_log_HTML = "
# ЗВОНИТЬ ДАТА/ВРЕМЯВ-НОМЕРВЫЗЫВАЮЩИЙIDLENGTH
" while (loop_ct < in_calls) { loop_ct++; @@ -1636,7 +1637,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=-1; if (parked_count > 0) { - var park_HTML = "
# ДАТА И ВРЕМЯ ЗВОНКАВХОДЯЩИЙ-НОМЕРCALLERIDLENGTH
" + var park_HTML = "
#CHANNEL
  ВЫЗОВ ID
ПАРКОВАНЫЙ
  ВРЕМЯ ПАРКОВКИ
РАЗЪЕДИНЕНИЕПЕРЕВОДPICKUP
" while (loop_ct < parked_count) { loop_ct++; @@ -1652,7 +1653,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var park_call_id = park_array[1]; var parked_by = park_array[3]; var parked_time = park_array[4]; - park_HTML = park_HTML + ""; + park_HTML = park_HTML + ""; } park_HTML = park_HTML + "
#CHANNEL
  ВЫЗОВ ID
ЗАПАРКОВАНО
  ВРЕМЯ ПАРКОВКИ
ЗАВЕРШЕНИЕПЕРЕВОДПЕРЕХВАТИТЬ
" + loop_ct + "" + park_channel + "
  " + park_call_id + "
" + parked_by + "
  " + parked_time + "
РАЗЪЕДИНЕНИЕПЕРЕВОДPICKUP
" + loop_ct + "" + park_channel + "
  " + park_call_id + "
" + parked_by + "
  " + parked_time + "
ЗАВЕРШЕНИЕПЕРЕВОДПЕРЕХВАТИТЬ
"; @@ -1764,7 +1765,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} show_reglink=1; reglink = "Register"; } - var conf_head_HTML = "КОНФЕРЕНЦИЯ " + head_conf + "    Registered to: " + head_reg + "   " + reglink + "         Вход на Конференцию
Обновление     Record         Послать DTMF         Набор номера Conf
"; + var conf_head_HTML = "КОНФЕРЕНЦИЯ " + head_conf + "    Зарегистрировано на: " + head_reg + "   " + reglink + "         Войти в конференцию
Обновить     Запись         Набор DTMF         Позвонить из конференции
"; document.getElementById("ConfereNceHeaderContent").innerHTML = conf_head_HTML; check_for_conf_calls(head_conf,taskrefresh); @@ -1825,7 +1826,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var LMAcontent_change=0; var LMAcontent_match=0; var conv_start=-1; - var live_conf_HTML = "ЖИВЫЕ ВЫЗОВЫ В ЭТОЙ КОНФЕРЕНЦИИ:
"; + var live_conf_HTML = "АКТИВНЫЕ ЗВОНКИ ДЛЯ ЭТОЙ КОНФЕРЕНЦИИ:
#УДАЛЕННЫЙ КАНАЛРАЗЪЕДИНЕНИЕПЕРЕВОД
"; if ( (LMAcount > live_conf_calls) || (LMAcount < live_conf_calls) || (LMAforce > 0)) { LMAe[0]=''; LMAe[1]=''; LMAe[2]=''; LMAe[3]=''; LMAe[4]=''; LMAe[5]=''; @@ -1841,7 +1842,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} {var row_color = '#CCCCFF';} var conv_ct = (loop_ct + conv_start); var channelfieldA = conf_chan_array[conv_ct]; - live_conf_HTML = live_conf_HTML + ""; + live_conf_HTML = live_conf_HTML + ""; if (!LMAe[ARY_ct]) {LMAe[ARY_ct] = channelfieldA; LMAcontent_change++; LMAalter++;} @@ -2063,7 +2064,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} } // ################################################################################ -// Send Originate command to manager to direct user to voicemail box +// Send Originate command to manager to direct user to ящик голосовой почты function SendCheckVoiceMail() { var xmlhttp=false; @@ -2290,7 +2291,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var VD_favlist_ct_half = parseInt(favlistCT / 2); if (VD_favlist_ct_half < 30) {VD_favlist_ct_half = 30;} var favlist_sec_col = 0; - var favedit_HTML = "
#УДАЛЕННАЯ ЛИНИЯЗАВЕРШЕНИЕПЕРЕВОД
" + loop_ct + "" + channelfieldA + "РАЗЪЕДИНЕНИЕПЕРЕВОД
" + loop_ct + "" + channelfieldA + "ЗАВЕРШЕНИЕПЕРЕВОД
ДОСТУПНЫЕ РАСШИРЕНИЯИЗБРАННОЕ
"; + var favedit_HTML = "
- - - - - + + + + +
ДОСТУПНЫЕ НОМЕРА ПРЕДПОЧТЕНИЯ
"; loop_ct = 0; while (loop_ct < favlistCT) { @@ -2387,7 +2388,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} hideDiv('MainPanel'); showDiv('LogouTBox'); - document.getElementById("LogouTBoxLink").innerHTML = "КЛИКНИТЕ ЗДЕСЬ, ЧТОБЫ СНОВА ВОЙТИ\n"; + document.getElementById("LogouTBoxLink").innerHTML = "КЛИКНИТЕ ЗДЕСЬ ДЛЯ ПОВТОРНОГО ВХОДА В СИСТЕМУ\n"; logout_stop_timeouts = 1; @@ -2468,7 +2469,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} start_all_refresh(); } function pause() // Pauses the refreshing of the lists - {active_display=2; display_message=" - ACTIVE DISPLAY PAUSED -";} + {active_display=2; display_message=" - АКТИВНОЕ ОТОБРАЖЕНИЕ ПРИОСТАНОВЛЕНО -";} function start() // resumes the refreshing of the lists {active_display=1; display_message='';} function faster() // lowers by 1000 milliseconds the time until the next refresh @@ -2489,13 +2490,13 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} function activeext_order_asc() // changes order of activeext list to ascending { activeext_order="asc"; getactiveext(); - desc_order_HTML ='ПОРЯДОК'; + desc_order_HTML ='ОРДЕР'; document.getElementById("activeext_order").innerHTML = desc_order_HTML; } function activeext_order_desc() // changes order of activeext list to descending { activeext_order="desc"; getactiveext(); - asc_order_HTML ='ПОРЯДОК'; + asc_order_HTML ='ОРДЕР'; document.getElementById("activeext_order").innerHTML = asc_order_HTML; } @@ -2505,13 +2506,13 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} function busytrunk_order_asc() // changes order of busytrunk list to ascending { busytrunk_order="asc"; getbusytrunk(); - desc_order_HTML ='ПОРЯДОК'; + desc_order_HTML ='ОРДЕР'; document.getElementById("busytrunk_order").innerHTML = desc_order_HTML; } function busytrunk_order_desc() // changes order of busytrunk list to descending { busytrunk_order="desc"; getbusytrunk(); - asc_order_HTML ='ПОРЯДОК'; + asc_order_HTML ='ОРДЕР'; document.getElementById("busytrunk_order").innerHTML = asc_order_HTML; } function busytrunkhangup_force_refresh() // forces immediate refresh of list content @@ -2523,13 +2524,13 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} function busyext_order_asc() // changes order of busyext list to ascending { busyext_order="asc"; getbusyext(); - desc_order_HTML ='ПОРЯДОК'; + desc_order_HTML ='ОРДЕР'; document.getElementById("busyext_order").innerHTML = desc_order_HTML; } function busyext_order_desc() // changes order of busyext list to descending { busyext_order="desc"; getbusyext(); - asc_order_HTML ='ПОРЯДОК'; + asc_order_HTML ='ОРДЕР'; document.getElementById("busyext_order").innerHTML = asc_order_HTML; } function busylocalhangup_force_refresh() // forces immediate refresh of list content @@ -2718,14 +2719,14 @@ echo "\n";
-ВЫХОД
\n"; ?> +ВЫХОД
\n"; ?>
Главная ПанельПанель Активных ЛинийПанель КонференцийПроверьте Голосовую почтуЖивой ВызовГлавная панельПанель активных линийПанель конференцийПроверить голосовую почтуАктивный звонок
@@ -2739,54 +2740,54 @@ echo "\n"; Hangup Trunk   |   Hijack Trunk   |   Listen Trunk   |   - Обновление   |   - Вернуться к Главному Окну + Обновить   |   + Вернуться в главное окно
-
ЛОКАЛЬНВЙ HANGUP

- Активное Локальное Меню
+
МЕСТНЫЙ ОТБОЙ

+ Активное местное меню
Hangup Local   |   Hijack Local   |   Listen Local   |   - Обновление   |   - Вернуться к Главному Окну + Обновить   |   + Вернуться в главное окно
- - +
ПЕРЕВОД ЖИВОГО ВЫЗОВА
Канал в который будет переведен: Channel
Расширения:
Меню Расширений
+ -
ПЕРЕВОД АКТИВНОГО ЗВОНКА
Линия будет переключена: Channel
Номера:
Меню номеров

- Отправить в выбранное расширение

- Отправить в выбранный vmail box

- Отправить в этот номер:


- Обновление


- Вернуться к Главному Окну

+ Перевести на выбранный номер

+ Перевести на выбранный номер голосовой почты

+ Перевести на этот номер:


+ Обновить


+ Вернуться в главное окно

Конференции:
(кликните на номере ниже, чтобы отправить в конференцию)
Отправить также мой канал
Меню Конференций
+
Конференции:
(кликните на номере внизу для отправки в конференцию)
Перевести также мою линию
Меню конференций
- - +
ЛОКАЛЬНОЕ Расширение Набора номера
Телефонный вызов от: Channel
Расширения:
Меню Расширений
+
Позвонить на МЕСТНЫЕ номера
Телефон звонит от: Channel
Номера:
Меню номеров

- Вызов в выбранное расширение

- Вызов в выбранный vmail box

- Обновление


- Вернуться к Главному Окну

+ Позвонить на выбранный номер

+ Позвонить на выбранный номер голосовой почты

+ Обновить


+ Вернуться в главное окно

- - + - + - + - + - +
ПАРКОВАТЬ ВЫЗОВ:
- Вернуться к Главному Окну

+
ЗАПАРКОВАННЫЕ ВЫЗОВЫ:
+ Вернуться в главное окно

@@ -2796,19 +2797,19 @@ echo "\n";
VOICEMAIL     НОВЫЙ:     СТАРЫЙ:             РУЧНОЙ НАБОР НОМЕРА       DIAL
ГОЛОСОВАЯПОЧТА     НОВЫЙ:     СТАРЫЙ:             РУЧНОЙ НАБОР       DIAL
ПАРКОВАТЬ ВЫЗОВ: 0                ЛОКАЛЬНЫЕ РАСШИРЕНИЯ НАБОРА НОМЕРА
ЗАПАРКОВАННЫЕ ВЫЗОВЫ: 0                МЕСТНЫЕ НОМЕРА ДЛЯ ВЫЗОВА
ИСХОДЯЩИЕ ВЫЗОВЫ:
ИСХОДЯЩИЕ ЗВОНКИ:
ВХОДЯЩИЕ ВЫЗОВЫ:
ВХОДЯЩИЕ ЗВОНКИ:
Версия web-клиента astGUIclient : СБОРКА:
Версия веб-клиента astGUIclient: СБОРКА:
- +
ИЗБРАННОЕ       редактировать
$h) @@ -2826,10 +2827,10 @@ echo "\n"; -
ПРЕДПОЧТЕНИЯ       изменить
+
ИЗБРАННОЕ
- - + +
ПРЕДПОЧТЕНИЯ

 
ПОДТВЕРДИТЕ ИЗМЕНЕНИЕ ИЗБРАННОГО - требование для выхода из системы
ВЕРНУТЬСЯ К ГЛАВНОМУ ОКНУ - игнорирует сделанные изменения
СОХРАНИТЬ ИЗМЕНЕНИЯ ПРЕДПОЧТЕНИЙ - нужно выйти
ВОЗВРАТ В ГЛАВНОЕ ОКНО - отмена произведенных изменений
@@ -2839,30 +2840,30 @@ echo "\n"; - - -
-STOP | START     Норма обновлений: 1000 ms Быстрее | Медленее

+STOP | START     Темп обновления: 1000 ms Быстрее | Медленнее

Инициализация..
Активные Расширения
+
Активные номера
ОБНОВИТЬ | -ПОРЯДОК | +ОРДЕР |
Внешние Линии
+
Внешние линии
ОБНОВИТЬ | -ПОРЯДОК | +ОРДЕР |
Локальные Расширения
+
Местные номера
ОБНОВИТЬ | -ПОРЯДОК | +ОРДЕР |
- Данные Идут Сюда

+ Данные идут сюда

- Данные Идут Сюда

Trunk Action + Данные идут сюда

Операция над транком
- Данные Идут Сюда

Local Action + Данные идут сюда

Местная операция
@@ -2874,12 +2875,12 @@ echo "\n";
-Список Конференций +Список конференций
-Для информации о конференции кликните на номер конференции слева +Кликните на номере конференции слева для сведений о ней
diff --git a/agc_2-X/trunk/LANG_www/agc_ru/calendar.css b/agc_2-X/trunk/LANG_www/agc_ru/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_ru/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/agc_2-X/trunk/LANG_www/agc_ru/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_ru/calendar_db.js new file mode 100644 index 00000000..1e736452 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_ru/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/agc_2-X/trunk/LANG_www/agc_ru/call_log_display.php b/agc_2-X/trunk/LANG_www/agc_ru/call_log_display.php index 9bb169dd..53f58e95 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/call_log_display.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/call_log_display.php @@ -74,7 +74,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else @@ -82,7 +82,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -94,7 +94,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -109,7 +109,7 @@ if ($format=='debug') echo "\n"; echo "\n"; echo "\n"; -echo "Показать Логи Вызовов"; +echo "<title>Отображение журнала вызовов"; echo "\n"; echo "\n"; echo "\n"; @@ -121,7 +121,7 @@ echo " if ( (strlen($exten)<1) or (strlen($protocol)<3) ) { $channel_live=0; - echo "Exten $exten это неправильно или протокол $protocol это неправильно\n"; + echo "Exten $exten неверный или протокол $protocol неверный\n"; exit; } else @@ -188,7 +188,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_ru/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_ru/conf_exten_check.php index 523cfec1..be2985db 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,17 +148,16 @@ $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 "Недопустимо Username/Пароль: |$user|$pass|\n"; + 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)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -158,7 +170,7 @@ $auth=$row[0]; $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Conf Extension Check"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Проверка номера конференции"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; - echo "Conf Exten $conf_exten это неправильно\n"; + echo "Conf Exten $conf_exten неверный\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check на calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Вызовов в очереди: $RingCalls";} + else {$RingCalls = "Вызовов в очереди: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check на calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Звонки в очереди: $RingCalls";} - else {$RingCalls = "Звонки в очереди: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - 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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; - echo "Conf Exten $conf_exten это неправильно or Exten $exten это неправильно\n"; + echo "Conf Exten $conf_exten неверный or Exten $exten неверный\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Конференция $conf_exten был зарегистрирован на $exten\n"; + echo "Конференция $conf_exten Был зарегистрирован $exten\n"; } @@ -653,7 +747,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_ru/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_ru/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_ru/functions.php b/agc_2-X/trunk/LANG_www/agc_ru/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_ru/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_ru/inbound_popup.php b/agc_2-X/trunk/LANG_www/agc_ru/inbound_popup.php index cb539374..48088456 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/inbound_popup.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/inbound_popup.php @@ -86,7 +86,7 @@ if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else @@ -94,7 +94,7 @@ if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -106,7 +106,7 @@ if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -234,7 +234,7 @@ echo ""; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_ru/live_exten_check.php b/agc_2-X/trunk/LANG_www/agc_ru/live_exten_check.php index f66f2252..869af157 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/live_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/live_exten_check.php @@ -75,7 +75,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else @@ -83,7 +83,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -95,7 +95,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -110,7 +110,7 @@ if ($format=='debug') echo "\n"; echo "\n"; echo "\n"; -echo "Live Extension Check"; +echo "<title>Проверка активного номера"; echo "\n"; echo "\n"; echo "\n"; @@ -132,7 +132,7 @@ echo "$row[0]|"; if ( (strlen($exten)<1) or (strlen($protocol)<3) ) { $channel_live=0; - echo "Exten $exten это неправильно или протокол $protocol это неправильно\n"; + echo "Exten $exten неверный или протокол $protocol неверный\n"; exit; } else @@ -270,7 +270,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_ru/manager_send.php b/agc_2-X/trunk/LANG_www/agc_ru/manager_send.php index 2f5829e0..00b7d561 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -94,12 +99,21 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -239,14 +264,14 @@ $auth=$row[0]; if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else { if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -259,7 +284,7 @@ else $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -274,7 +299,7 @@ if ($format=='debug') echo "\n"; echo "\n"; echo "\n"; - echo "Отослать Менеджеру: "; + echo "<title>Перевод менеджеру: "; if ($ACTION=="Originate") {echo "Originate";} if ($ACTION=="Redirect") {echo "Redirect";} if ($ACTION=="RedirectName") {echo "RedirectName";} @@ -289,6 +314,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<!-- $stmt -->";} + $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 @@ -297,7 +336,7 @@ if ($ACTION=="SysCIDOriginate") { if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($ext_context)<1) or (strlen($queryCID)<1) ) { - echo "Exten $exten это неправильно or queryCID $queryCID это неправильно, Originate команда не введена\n"; + echo "Exten $exten неверный or queryCID $queryCID неверный, Originate команда не включена\n"; } else { @@ -305,7 +344,7 @@ if ($ACTION=="SysCIDOriginate") if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02004',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Originate посылать команду для Exten $exten Канал $channel на $server_ip\n"; + echo "Originate команда отправлена Exten $exten Линия $channel на $server_ip\n"; } } @@ -319,13 +358,13 @@ if ($ACTION=="OriginateName") if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<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 "extenName $extenName должен быть установлен\n"; - echo "ext_context $ext_context должен быть установлен\n"; - echo "ext_priority $ext_priority должен быть установлен\n"; - echo "\nOriginateName Action не послано\n"; + echo "Одна из этих переменных неверный:\n"; + echo "Channel $channel должен быть длиннее 2 символов\n"; + echo "queryCID $queryCID должен быть длиннее 14 символов\n"; + echo "extenName $extenName должен быть указан\n"; + echo "ext_context $ext_context должен быть указан\n"; + echo "ext_priority $ext_priority должен быть указан\n"; + echo "\nOriginateName Action не отправлен\n"; } else { @@ -348,14 +387,14 @@ if ($ACTION=="OriginateNameVmail") if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) 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 "extenName $extenName должен быть установлен\n"; - echo "exten $exten должен быть установлен\n"; - echo "ext_context $ext_context должен быть установлен\n"; - echo "ext_priority $ext_priority должен быть установлен\n"; - echo "\nOriginateNameVmail Action не послано\n"; + echo "Одна из этих переменных неверный:\n"; + echo "Channel $channel должен быть длиннее 2 символов\n"; + echo "queryCID $queryCID должен быть длиннее 14 символов\n"; + echo "extenName $extenName должен быть указан\n"; + echo "exten $exten должен быть указан\n"; + echo "ext_context $ext_context должен быть указан\n"; + echo "ext_priority $ext_priority должен быть указан\n"; + echo "\nOriginateNameVmail Action не отправлен\n"; } else { @@ -390,15 +429,15 @@ 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) and ($alertCID < 1) ) ) { - echo "ERROR Exten $exten это неправильно or queryCID $queryCID это неправильно, Originate команда не введена\n"; + echo "ERROR Exten $exten неверный or queryCID $queryCID неверный, Originate команда не включена\n"; } else { if ( (eregi('MANUAL',$agent_dialed_type)) and ( (preg_match("/^\d860\d\d\d\d$/i",$exten)) or (preg_match("/^860\d\d\d\d$/i",$exten)) ) ) { - echo "ERROR Вы не можете набрать в других сессиях агент $exten\n"; + echo "ERROR Вам не разрешено звонить в сессии других агентов $exten\n"; exit; } @@ -410,22 +449,48 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02007',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Originate посылать команду для Exten $exten Канал $channel на $server_ip |$account|$variable|\n"; + echo "Originate команда отправлена Exten $exten Линия $channel на $server_ip |$account|$variable|\n"; 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<!-- $stmt -->";} + $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);} + } } } } @@ -442,7 +507,7 @@ if ($ACTION=="HangupConfDial") if ( (strlen($exten)<3) or (strlen($queryCID)<15) or (strlen($ext_context)<1) ) { $channel_live=0; - echo "conference $exten это неправильно or ext_context $ext_context or queryCID $queryCID это неправильно, Hangup команда не введена\n"; + echo "conference $exten неверный or ext_context $ext_context or queryCID $queryCID неверный, Hangup команда не включена\n"; } else { @@ -486,7 +551,7 @@ if ($ACTION=="Hangup") if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) { $channel_live=0; - echo "Channel $channel это неправильно or queryCID $queryCID это неправильно, Hangup команда не введена\n"; + echo "Channel $channel неверный or queryCID $queryCID неверный, Hangup команда не включена\n"; } else { @@ -517,7 +582,7 @@ if ($ACTION=="Hangup") $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { - echo "Call $CalLCID $channel это не активно на $call_server_ip, Checking Live Канал...\n"; + echo "Call $CalLCID $channel не активен на $call_server_ip, Checking Live Линия...\n"; $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; if ($format=='debug') {echo "\n<!-- $stmt -->";} @@ -527,7 +592,7 @@ if ($ACTION=="Hangup") if ($row[0]==0) { $channel_live=0; - echo "Channel $channel это не активно на $call_server_ip, Hangup команда не введена $rowx[0]\n$stmt\n"; + echo "Channel $channel не активен на $call_server_ip, Hangup команда не включена $rowx[0]\n$stmt\n"; } else { @@ -545,7 +610,7 @@ if ($ACTION=="Hangup") if ($row[0] > 0) { $channel_live=0; - echo "Channel $channel in use by another agent на $call_server_ip, Hangup команда не введена $rowx[0]\n$stmt\n"; + echo "Channel $channel in use by another agent на $call_server_ip, Hangup команда не включена $rowx[0]\n$stmt\n"; if ($WeBRooTWritablE > 0) { $fp = fopen ("./vicidial_debug.txt", "a"); @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n<!-- $caller_complete|$stmt -->";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -677,7 +758,7 @@ if ($ACTION=="Hangup") if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02020',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Hangup посылать команду для Канал $channel на $call_server_ip\n"; + echo "Hangup команда отправлена Линия $channel на $call_server_ip\n"; } } } @@ -693,17 +774,17 @@ if ($ACTION=="RedirectVD") if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($campaign)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($uniqueid)<2) or (strlen($lead_id)<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 "auto_dial_level $auto_dial_level должен быть установлен\n"; - echo "campaign $campaign должен быть установлен\n"; - echo "uniqueid $uniqueid должен быть установлен\n"; - echo "lead_id $lead_id должен быть установлен\n"; - echo "\nRedirectVD Action не послано\n"; + 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 "auto_dial_level $auto_dial_level должен быть указан\n"; + echo "campaign $campaign должен быть указан\n"; + echo "uniqueid $uniqueid должен быть указан\n"; + echo "lead_id $lead_id должен быть указан\n"; + echo "\nRedirectVD Action не отправлен\n"; } else { @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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<!-- $stmt -->";} + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -776,15 +850,15 @@ if ($ACTION=="RedirectToPark") 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"; + 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 { @@ -795,10 +869,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<!-- $stmt -->";} + $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<!-- $rowx[0]|$stmt -->";} + $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<!-- $affected_rows|$stmt -->";} + } + } + # $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<!-- $stmt -->";} + $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") @@ -806,13 +943,13 @@ if ($ACTION=="RedirectFromPark") 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"; + 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 { @@ -822,21 +959,293 @@ 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<!-- $stmt -->";} + $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<!-- $rowx[0]|$stmt -->";} + $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<!-- $affected_rows|$stmt -->";} + } + } + } } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n<!-- $stmt -->";} + $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<!-- $stmt -->";} + $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<!-- $stmt -->";} + $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<!-- $stmt -->";} + $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<!-- $rowx[0]|$stmt -->";} + $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<!-- $affected_rows|$stmt -->";} + } + } + # $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<!-- $stmt -->";} + $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<!-- $stmt -->";} + $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<!-- $stmt -->";} + $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<!-- $stmt -->";} + $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<!-- $rowx[0]|$stmt -->";} + $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<!-- $affected_rows|$stmt -->";} + } + } + } + } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n<!-- $stmt -->";} + $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) ) { $channel_live=0; - echo "Одна из этих переменных это неправильно:\n"; - echo "Channel $channel должно быть больше чем 2 символа\n"; - echo "queryCID $queryCID должно быть больше чем 14 символов\n"; - echo "extenName $extenName должен быть установлен\n"; - echo "ext_context $ext_context должен быть установлен\n"; - echo "ext_priority $ext_priority должен быть установлен\n"; - echo "\nRedirectName Action не послано\n"; + echo "Одна из этих переменных неверный:\n"; + echo "Channel $channel должен быть длиннее 2 символов\n"; + echo "queryCID $queryCID должен быть длиннее 14 символов\n"; + echo "extenName $extenName должен быть указан\n"; + echo "ext_context $ext_context должен быть указан\n"; + echo "ext_priority $ext_priority должен быть указан\n"; + echo "\nRedirectName Action не отправлен\n"; } else { @@ -859,14 +1268,14 @@ if ($ACTION=="RedirectNameVmail") if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) 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 "extenName $extenName должен быть установлен\n"; - echo "exten $exten должен быть установлен\n"; - echo "ext_context $ext_context должен быть установлен\n"; - echo "ext_priority $ext_priority должен быть установлен\n"; - echo "\nRedirectNameVmail Action не послано\n"; + echo "Одна из этих переменных неверный:\n"; + echo "Channel $channel должен быть длиннее 2 символов\n"; + echo "queryCID $queryCID должен быть длиннее 14 символов\n"; + echo "extenName $extenName должен быть указан\n"; + echo "exten $exten должен быть указан\n"; + echo "ext_context $ext_context должен быть указан\n"; + echo "ext_priority $ext_priority должен быть указан\n"; + echo "\nRedirectNameVmail Action не отправлен\n"; } else { @@ -899,14 +1308,14 @@ if ($ACTION=="RedirectXtraCXNeW") { $channel_liveX=0; $channel_liveY=0; - echo "Одна из этих переменных это неправильно:\n"; - echo "Channel $channel должно быть больше чем 2 символа\n"; - echo "ExtraChannel $extrachannel должно быть больше чем 2 символа\n"; - echo "queryCID $queryCID должно быть больше чем 14 символов\n"; - echo "exten $exten должен быть установлен\n"; - echo "ext_context $ext_context должен быть установлен\n"; - echo "ext_priority $ext_priority должен быть установлен\n"; - echo "\nRedirect Action не послано\n"; + echo "Одна из этих переменных неверный:\n"; + echo "Channel $channel должен быть длиннее 2 символов\n"; + echo "ExtraChannel $extrachannel должен быть длиннее 2 символов\n"; + echo "queryCID $queryCID должен быть длиннее 14 символов\n"; + echo "exten $exten должен быть указан\n"; + echo "ext_context $ext_context должен быть указан\n"; + echo "ext_priority $ext_priority должен быть указан\n"; + echo "\nRedirect Action не отправлен\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) { if ($WeBRooTWritablE > 0) @@ -986,8 +1395,8 @@ if ($ACTION=="RedirectXtraCXNeW") else { $channel_liveX=0; - echo "Cannot find empty vicidial_conference на $server_ip, Redirect команда не введена\n|$stmt|"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Не могу найти свободную конференцию на $server_ip";} + echo "Cannot find empty vicidial_conference на $server_ip, Redirect команда не включена\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Не найдена свободная конференция на $server_ip";} } } @@ -1008,8 +1417,8 @@ if ($ACTION=="RedirectXtraCXNeW") if ($rowx[0]==0) { $channel_liveX=0; - echo "Channel $channel это не активно на $call_server_ip, Redirect команда не введена\n"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel это не активно на $call_server_ip";} + echo "Channel $channel не активен на $call_server_ip, Redirect команда не включена\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel не активен на $call_server_ip";} } } $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; @@ -1027,11 +1436,11 @@ if ($ACTION=="RedirectXtraCXNeW") if ($rowx[0]==0) { $channel_liveY=0; - echo "Channel $channel это не активно на $server_ip, Redirect команда не введена\n"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel это не активно на $server_ip";} + echo "Channel $channel не активен на $server_ip, Redirect команда не включена\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel не активен на $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n<!-- $stmt -->";} @@ -1041,7 +1450,7 @@ if ($ACTION=="RedirectXtraCXNeW") if ($rowx[0] < 1) { $channel_liveY=0; - echo "No Local agent to send call to, Redirect команда не введена\n"; + echo "No Local agent to send call to, Redirect команда не включена\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "No Local agent to send call to";} } else @@ -1077,7 +1486,7 @@ if ($ACTION=="RedirectXtraCXNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02044',$user,$server_ip,$session_name,$one_mysql_log);} - echo "RedirectXtraCX посылать команду для Канал $channel на $call_server_ip and \nHungup $extrachannel на $server_ip\n"; + echo "RedirectXtraCX команда отправлена Линия $channel на $call_server_ip and \nHungup $extrachannel на $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel на $call_server_ip, Hungup $extrachannel на $server_ip";} } } @@ -1124,21 +1533,21 @@ if ($ACTION=="RedirectXtraNeW") { $channel_liveX=0; $channel_liveY=0; - echo "Одна из этих переменных это неправильно:\n"; - echo "Channel $channel должно быть больше чем 2 символа\n"; - echo "ExtraChannel $extrachannel должно быть больше чем 2 символа\n"; - echo "queryCID $queryCID должно быть больше чем 14 символов\n"; - echo "exten $exten должен быть установлен\n"; - echo "ext_context $ext_context должен быть установлен\n"; - echo "ext_priority $ext_priority должен быть установлен\n"; - echo "session_id $session_id должен быть установлен\n"; - echo "\nRedirect Action не послано\n"; + echo "Одна из этих переменных неверный:\n"; + echo "Channel $channel должен быть длиннее 2 символов\n"; + echo "ExtraChannel $extrachannel должен быть длиннее 2 символов\n"; + echo "queryCID $queryCID должен быть длиннее 14 символов\n"; + echo "exten $exten должен быть указан\n"; + echo "ext_context $ext_context должен быть указан\n"; + echo "ext_priority $ext_priority должен быть указан\n"; + echo "session_id $session_id должен быть указан\n"; + echo "\nRedirect Action не отправлен\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) { 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); } } @@ -1203,8 +1612,8 @@ if ($ACTION=="RedirectXtraNeW") else { $channel_liveX=0; - echo "Cannot find empty vicidial_conference на $server_ip, Redirect команда не введена\n|$stmt|"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Не могу найти свободную конференцию на $server_ip";} + echo "Cannot find empty vicidial_conference на $server_ip, Redirect команда не включена\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Не найдена свободная конференция на $server_ip";} } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n<!-- $stmt -->";} @@ -1225,8 +1634,8 @@ if ($ACTION=="RedirectXtraNeW") if ($rowx[0]==0) { $channel_liveX=0; - echo "Channel $channel это не активно на $call_server_ip, Redirect команда не введена\n"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel это не активно на $call_server_ip";} + echo "Channel $channel не активен на $call_server_ip, Redirect команда не включена\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel не активен на $call_server_ip";} } } $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n<!-- $stmt -->";} @@ -1244,11 +1653,11 @@ if ($ACTION=="RedirectXtraNeW") if ($rowx[0]==0) { $channel_liveY=0; - echo "Channel $channel это не активно на $server_ip, Redirect команда не введена\n"; - if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel это не активно на $server_ip";} + echo "Channel $channel не активен на $server_ip, Redirect команда не включена\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel не активен на $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1257,7 +1666,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02057',$user,$server_ip,$session_name,$one_mysql_log);} - echo "RedirectXtra посылать команду для Канал $channel and \nExtraChannel $extrachannel\n to $exten на $server_ip\n"; + echo "RedirectXtra команда отправлена Линия $channel and \nExtraChannel $extrachannel\n to $exten на $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten на $server_ip";} } else @@ -1284,7 +1693,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02059',$user,$server_ip,$session_name,$one_mysql_log);} - echo "RedirectXtra посылать команду для Канал $channel на $call_server_ip and \nExtraChannel $extrachannel\n to $exten на $server_ip\n"; + echo "RedirectXtra команда отправлена Линия $channel на $call_server_ip and \nExtraChannel $extrachannel\n to $exten на $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} } } @@ -1345,13 +1754,13 @@ if ($ACTION=="Redirect") 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 "\nRedirect Action не послано\n"; + 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 "\nRedirect Action не отправлен\n"; } else { @@ -1371,7 +1780,7 @@ if ($ACTION=="Redirect") if ($rowx[0]==0) { $channel_live=0; - echo "Channel $channel это не активно на $server_ip, Redirect команда не введена\n"; + echo "Channel $channel не активен на $server_ip, Redirect команда не включена\n"; } } if ($channel_live==1) @@ -1381,7 +1790,7 @@ if ($ACTION=="Redirect") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02064',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Redirect посылать команду для Канал $channel на $server_ip\n"; + echo "Redirect команда отправлена Линия $channel на $server_ip\n"; } } } @@ -1403,7 +1812,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($filename)<8) ) { $channel_live=0; - echo "Channel $channel это неправильно or queryCID $queryCID это неправильно or filename: $filename это неправильно, $ACTION команда не введена\n"; + echo "Channel $channel неверный or queryCID $queryCID неверный or filename: $filename неверный, $ACTION команда не включена\n"; } else { @@ -1422,7 +1831,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) if ($rowx[0]==0) { $channel_live=0; - echo "Channel $channel это не активно на $server_ip, $ACTION команда не введена\n"; + echo "Channel $channel не активен на $server_ip, $ACTION команда не включена\n"; } } if ($channel_live==1) @@ -1468,7 +1877,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02071',$user,$server_ip,$session_name,$one_mysql_log);} } } - echo "$ACTION посылать команду для Канал $channel на $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; + echo "$ACTION команда отправлена Линия $channel на $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n"; } } } @@ -1490,7 +1899,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) if ( (strlen($exten)<3) or (strlen($channel)<4) or (strlen($filename)<8) ) { $channel_live=0; - echo "Channel $channel это неправильно or exten $exten это неправильно or filename: $filename это неправильно, $ACTION команда не введена\n"; + echo "Channel $channel неверный or exten $exten неверный or filename: $filename неверный, $ACTION команда не включена\n"; } else { @@ -1624,7 +2033,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $i++; } } - echo "$ACTION посылать команду для Канал $channel на $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n ЗАПИСЬ МОЖЕТ ПРОДОЛЖАТЬСЯ ДО 60 МИН.\n"; + echo "$ACTION команда отправлена Линия $channel на $server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n ЗАПИСЬ БУДЕТ ПРОДОЛЖАТЬСЯ ДО 60 МИНУТ\n"; } } @@ -1639,7 +2048,7 @@ if ($ACTION=="VolumeControl") { if ( (strlen($exten)<1) or (strlen($channel)<1) or (strlen($stage)<1) or (strlen($queryCID)<1) ) { - echo "Конференция $exten, Stage $stage это неправильно or queryCID $queryCID это неправильно, Originate команда не введена\n"; + echo "Конференция $exten, Stage $stage неверный or queryCID $queryCID неверный, Originate команда не включена\n"; } else { @@ -1656,7 +2065,7 @@ if ($ACTION=="VolumeControl") if ($format=='debug') {echo "\n<!-- $stmt -->";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02082',$user,$server_ip,$session_name,$one_mysql_log);} - echo "Volume посылать команду для Конференция $exten, Stage $stage Канал $channel на $server_ip\n"; + echo "Volume команда отправлена Конференция $exten, Stage $stage Линия $channel на $server_ip\n"; } } @@ -1673,7 +2082,7 @@ if ($ACTION=="VolumeControl") $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); -if ($format=='debug') {echo "\n<!-- время выполнения скрипта: $RUNtime секунды -->";} +if ($format=='debug') {echo "\n<!-- время исполнения скрипта: $RUNtime секунд -->";} if ($format=='debug') {echo "\n</body>\n</html>\n";} exit; @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_ru/park_calls_display.php b/agc_2-X/trunk/LANG_www/agc_ru/park_calls_display.php index 33e44d5f..1c5274a6 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/park_calls_display.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/park_calls_display.php @@ -65,14 +65,14 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) ) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else { if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -84,7 +84,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -99,7 +99,7 @@ if ($format=='debug') echo "<html>\n"; echo "<head>\n"; echo "<!-- ВЕРСИЯ: $version СБОРКА: $build EXTEN: $exten server_ip: $server_ip-->\n"; -echo "<title>Показать Паркованные Вызовы"; +echo "<title>Отображение запаркованных вызовов"; echo "\n"; echo "\n"; echo "\n"; @@ -111,7 +111,7 @@ echo " if ( (strlen($exten)<1) or (strlen($protocol)<3) ) { $channel_live=0; - echo "Exten $exten это неправильно или протокол $protocol это неправильно\n"; + echo "Exten $exten неверный или протокол $protocol неверный\n"; exit; } else @@ -138,7 +138,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_ru/phone_only.php b/agc_2-X/trunk/LANG_www/agc_ru/phone_only.php new file mode 100644 index 00000000..5798ed96 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_ru/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Вы вышли из системы. Спасибо\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST на server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link на the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location на the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "телефон web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Табельные часы
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Russian
\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 "\n"; + echo "
\"VICIdial\" телефон-Only Вход
 
Ваш телефон:
Пароль телефона:
Ваше имя:
Ваш пароль:
  \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 "телефон web client: Ваш телефон\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Табельные часы
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Russian
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" телефон-Only Вход
 
Ваш телефон:
Пароль телефона:
  \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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Имя неверно, попробуйте еще раз, пожалуйста
"; + } + } + if ($VDloginDISPLAY) + { + echo "телефон web client: Login\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Табельные часы
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Russian
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" телефон-Only Вход
 
Ваше имя:
Ваш пароль:
  \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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "телефон web client: Ваш телефон Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " Табельные часы
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Russian
\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 "
\"VICIdial\" телефон-Only Вход 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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "телефон 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call секунд counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - секунд на call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " телефон: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web телефон:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_ru/timeclock.php b/agc_2-X/trunk/LANG_www/agc_ru/timeclock.php index e8d8114f..e643e66b 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/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 ##### @@ -120,10 +122,10 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($valid_user < 1) { ### NOT A VALID USER/PASS - $VDdisplayMESSAGE = "Пользователя и пароль, которые вы вступили, не действующих в системе
Пожалуйста, повторите попытку:"; + $VDdisplayMESSAGE = "Имя и пароль, введенные Вами, системе неизвестны
Пожалуйста, попробуйте еще раз:"; echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Табельные часы\n"; echo"\n"; echo"\n"; echo "\n"; @@ -138,14 +140,14 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "
Timeclock Табельные часы
 
Логин Пользователя:
Ваше имя:
Пароль Пользователя:
Ваш пароль:
 
 

ВЕРСИЯ: $version       СБОРКА: $build
\n"; echo "\n\n"; @@ -224,11 +226,11 @@ if ( ($stage == 'login') or ($stage == 'logout') ) } if ( ($last_action_sec < 30) and ($status != 'START') ) { - ### You cannot log in or out within 30 секунды of your last login/logout - $VDdisplayMESSAGE = "Вы не можете войти или в течение 30 секунд после вашего последнего входа в систему или Logout"; + ### You cannot log in or out within 30 секунд of your last login/logout + $VDdisplayMESSAGE = "Нельзя войти или выйти из системы в течение 30 секунд после последнего входа или выхода"; echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Табельные часы\n"; echo"\n"; echo"\n"; echo "\n"; @@ -243,14 +245,14 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "
Timeclock Табельные часы
 
Логин Пользователя:
Ваше имя:
Пароль Пользователя:
Ваш пароль:
 
 

ВЕРСИЯ: $version       СБОРКА: $build
\n"; echo "\n\n"; @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Вы вошли в систему"; + $LOGtimeMESSAGE = "Вы вошли в систему в $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -292,8 +294,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($status=='LOGIN') and ($stage=='logout') ) { - $VDdisplayMESSAGE = "Вы уже зарегистрированы отказа"; - $LOGtimeMESSAGE = "Вы вошли на$NOW_TIME
Количество раз, когда вы были зарегистрированы в:$totTIME_HMS"; + $VDdisplayMESSAGE = "Вы вышли из системы"; + $LOGtimeMESSAGE = "Вы вышли из системы в $NOW_TIME
Время, проведенное Вами в системе: $totTIME_HMS"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';"; @@ -333,24 +335,24 @@ if ( ($stage == 'login') or ($stage == 'logout') ) } if ( ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) ) - {echo "ОШИБКА: timeclock вход вход уже сделал:$status|$stage"; exit;} + {echo "ОШИБКА: запись в журнале табельных часов уже сделана: $status|$stage"; exit;} if ($referrer=='agent') - {$BACKlink = "BACK TO Агент Логин экрана";} + {$BACKlink = "ВОЗВРАТ к странице агентского входа в систему";} if ($referrer=='admin') - {$BACKlink = "BACK TO администрации";} + {$BACKlink = "ВОЗВРАТ к администрированию";} if ($referrer=='welcome') - {$BACKlink = "BACK приветствовать экрана";} + {$BACKlink = "ВОЗВРАТ к странице приветствия";} echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Табельные часы\n"; echo"\n"; echo"\n"; echo "\n"; echo "

$VDdisplayMESSAGE

"; echo ""; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo "\n"; @@ -368,21 +370,21 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) { - $VDdisplayMESSAGE = "Время с момента вашего последнего входа в:$totTIME_HMS"; + $VDdisplayMESSAGE = "Время после Вашего входа в систему:$totTIME_HMS"; $log_action = 'login'; $button_name = 'LOGIN'; - $LOGtimeMESSAGE = "Вы последнего зарегистрированного по адресу:$last_action_date

Нажмите кнопку Вход для входа в"; + $LOGtimeMESSAGE = "Ваш последний выход из системы был произведен в: $last_action_date

Кликните ВОЙТИ ниже для входа в систему"; } if ($status=='LOGIN') { - $VDdisplayMESSAGE = "Количество раз, когда вы вышли в:$totTIME_HMS"; + $VDdisplayMESSAGE = "Время, проведенное Вами в системе: $totTIME_HMS"; $log_action = 'logout'; $button_name = 'LOGOUT'; - $LOGtimeMESSAGE = "Вы вошли в по адресу: $last_action_date
Количество раз, когда вы вышли в:$totTIME_HMS

Нажмите LOGOUT для входа из"; + $LOGtimeMESSAGE = "Вы вошли в систему в: $last_action_date
Время, проведенное Вами в системе: $totTIME_HMS

Кликните ВЫЙТИ для выхода из системы"; } echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Табельные часы\n"; echo"\n"; echo"\n"; echo "\n"; @@ -400,7 +402,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) echo "

$VDdisplayMESSAGE

"; echo "
Timeclock Табельные часы
 
$LOGtimeMESSAGE
 
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; echo "\n"; @@ -421,7 +423,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) else { echo"\n"; - echo"AgentTimeclock\n"; + echo"Agent Табельные часы\n"; echo"\n"; echo"\n"; echo "\n"; @@ -436,14 +438,14 @@ else echo "

$VDdisplayMESSAGE

"; echo "
Timeclock Табельные часы
 
$LOGtimeMESSAGE
 
"; echo ""; - echo ""; + echo ""; echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo ""; + echo ""; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "
Timeclock Табельные часы
 
Логин Пользователя:
Ваше имя:
Пароль Пользователя:
Ваш пароль:
 
 

ВЕРСИЯ: $version       СБОРКА: $build
\n"; echo "\n\n"; diff --git a/agc_2-X/trunk/LANG_www/agc_ru/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_ru/vdc_db_query.php index 186becc2..ef735952 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadСостояние"])) {$CallBackLeadСостояние=$_GET["CallBackLeadСостояние"];} + elseif (isset($_POST["CallBackLeadСостояние"])) {$CallBackLeadСостояние=$_POST["CallBackLeadСостояние"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Агент busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Неверный number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to СОСТОЯНИЕ INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Входящие calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Неверный call reference value.", +88 => "Incompatible destination.", +95 => "Неверный message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Неверный information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery на timer expiry.", +103 => "Parameter non-existent or not implemented - passed на (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -489,14 +694,14 @@ else if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else { if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -509,7 +714,7 @@ else $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -525,7 +730,7 @@ if ($format=='debug') echo "\n"; echo "\n"; echo "\n"; - echo "VICIDiaL Скрипт Запроса Базы Данных"; + echo "<title>VICIDiaL Скрипт запроса базы данных"; echo "\n"; echo "\n"; echo "\n"; @@ -614,7 +819,7 @@ if ($ACTION == 'LogiNCamPaigns') $shift_ok=0; if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) ) { - $VDdisplayMESSAGE = "ОШИБКА: Есть сдвиги не включена для пользователя группы\n"; + $VDdisplayMESSAGE = "ОШИБКА: для Вашей группы нет разрешенных смен\n"; $VDloginDISPLAY=1; } else @@ -667,22 +872,22 @@ if ($ACTION == 'LogiNCamPaigns') if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) ) { - $VDdisplayMESSAGE = "ОШИБКА: Вы не можете войти в вашу за переход\n"; + $VDdisplayMESSAGE = "ОШИБКА: Вам не разрешено входить в систему вне своей смены\n"; $VDloginDISPLAY=1; } } if ($VDloginDISPLAY > 0) { $loginDATE = date("Ymd"); - $VDdisplayMESSAGE.= "

МЕНЕДЖЕР Переопределить:
\n"; + $VDdisplayMESSAGE.= "

УКАЗАТЬ ДРУГОГО НАЧАЛЬНИКА:
\n"; $VDdisplayMESSAGE.= "
\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; $VDdisplayMESSAGE.= "\n"; - $VDdisplayMESSAGE.= "МенеджерЛогин:
\n"; - $VDdisplayMESSAGE.= "МенеджерПароль:
\n"; - $VDdisplayMESSAGE.= "




\n"; + $VDdisplayMESSAGE.= "Начальник Имя:
\n"; + $VDdisplayMESSAGE.= "Начальник Пароль:
\n"; + $VDdisplayMESSAGE.= "



\n"; echo "$VDdisplayMESSAGE"; exit; } @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; } exit; @@ -729,7 +934,7 @@ if ($ACTION == 'regCLOSER') if ( (strlen($closer_choice)<1) || (strlen($user)<1) ) { $channel_live=0; - echo "Выбор Группы $closer_choice это неправильно\n"; + echo "Выбор группы $closer_choice неверный\n"; exit; } else @@ -778,6 +983,36 @@ 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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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]; + $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; + $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); @@ -786,7 +1021,7 @@ if ($ACTION == 'regCLOSER') { if (strlen($in_groups[$k])>1) { - $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $stmt="SELECT group_weight,calls_today,group_grade FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00013',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -794,24 +1029,51 @@ if ($ACTION == 'regCLOSER') if ($viga_ct > 0) { $row=mysql_fetch_row($rslt); - $group_weight = $row[0]; + $group_weight = $row[0]; $calls_today = $row[1]; + $group_grade = $row[2]; } else { $group_weight = 0; $calls_today = 0; + $group_grade = 1; } - $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME',group_grade='$group_grade';"; 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) ) + { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00388',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $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' $data4SQL;"; + $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++; } } - echo "Closer In Выбор Группы $closer_choice был зарегистрован пользователем $user\n"; + echo "Closer In Выбор группы $closer_choice был зарегистрирован $user\n"; } @@ -829,7 +1091,7 @@ if ($ACTION == 'regTERRITORY') if ( (strlen($agent_territories)<1) || (strlen($user)<1) ) { $channel_live=0; - echo "Territory Choice $agent_territories это неправильно\n"; + echo "Territory Choice $agent_territories неверный\n"; exit; } else @@ -869,7 +1131,7 @@ if ($ACTION == 'regTERRITORY') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00256',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Territory Choice $agent_territories был зарегистрован пользователем $user\n"; + echo "Territory Choice $agent_territories был зарегистрирован $user\n"; } @@ -998,18 +1260,21 @@ if ($ACTION == 'manDiaLnextCaLL') { $MT[0]=''; $row=''; $rowx=''; + $override_dial_number=''; $channel_live=1; + $lead_id = ereg_replace("[^0-9]","",$lead_id); if ( (strlen($conf_exten)<1) || (strlen($campaign)<1) || (strlen($ext_context)<1) ) { $channel_live=0; - echo "ПУСТОЙ КОНТЕЙНЕР\n"; - echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context это неправильно\n"; + echo "БУФЕР ПУСТ\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context неверный\n"; exit; } else { ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $eac_phone=''; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00015',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1017,7 +1282,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';} @@ -1047,31 +1313,143 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00016',$user,$server_ip,$session_name,$one_mysql_log);} } + ### check if this is a specific lead call, if it is, skip the grabbing of a new lead + elseif (strlen($lead_id)>0) + { + $affected_rows=1; + $CBleadIDset=1; + + if (strlen($phone_number) > 5) + {$override_dial_number = $phone_number;} + } else { if (strlen($phone_number)>3) { + if (ereg("ENABLED",$manual_dial_call_time_check)) + { + $secX = date("U"); + $hour = date("H"); + $min = date("i"); + $sec = date("s"); + $mon = date("m"); + $mday = date("d"); + $year = date("Y"); + $isdst = date("I"); + $Shour = date("H"); + $Smin = date("i"); + $Ssec = date("s"); + $Smon = date("m"); + $Smday = date("d"); + $Syear = date("Y"); + $pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; + $inSD = $pulldate0; + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $postalgmt=''; + $postal_code=''; + $state=''; + if (strlen($phone_code)<1) + {$phone_code='1';} + + $local_call_time='24hours'; + ##### gather local call time setting from campaign + $stmt="SELECT local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00353',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_lct_ct = mysql_num_rows($rslt); + if ($camp_lct_ct > 0) + { + $row=mysql_fetch_row($rslt); + $local_call_time = $row[0]; + } + + ### get current gmt_offset of the phone_number + $USarea = substr($phone_number, 0, 3); + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + $dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state); + + if ($dialable < 1) + { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00354',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00355',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "OUTSIDE OF LOCAL ВЫЗОВ TIME $VMDQaffected_rows|$VLAEDaffected_rows\n"; + exit; + } + } + if (ereg("DNC",$manual_dial_filter)) { - $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; + if (ereg("AREACODE",$use_internal_dnc)) + { + $phone_number_areacode = substr($phone_number, 0, 3); + $phone_number_areacode .= "XXXXXXX"; + $stmt="SELECT count(*) from vicidial_dnc where phone_number IN('$phone_number','$phone_number_areacode');"; + } + else + {$stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00017',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); - if ($row[0] > 0) { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00356',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00357',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + echo "DNC НОМЕР\n"; exit; } - $stmt="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign';"; + if (ereg("AREACODE",$use_campaign_dnc)) + { + $phone_number_areacode = substr($phone_number, 0, 3); + $phone_number_areacode .= "XXXXXXX"; + $stmt="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$phone_number','$phone_number_areacode') and campaign_id='$campaign';"; + } + else + {$stmt="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign';";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00018',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); - if ($row[0] > 0) { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00358',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00359',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + echo "DNC НОМЕР\n"; exit; } @@ -1088,7 +1466,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); @@ -1101,6 +1488,19 @@ if ($ACTION == 'manDiaLnextCaLL') if ($row[0] < 1) { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00360',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00361',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + echo "НОМЕР NOT IN CAMPLISTS\n"; exit; } @@ -1121,7 +1521,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00021',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00362',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $man_leadID_ct = mysql_num_rows($rslt); } @@ -1159,7 +1559,7 @@ if ($ACTION == 'manDiaLnextCaLL') else { ##### gather no hopper dialing settings from campaign - $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary,call_count_limit FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00236',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1174,6 +1574,9 @@ if ($ACTION == 'manDiaLnextCaLL') $drop_lockout_time = $row[4]; $lead_filter_id = $row[5]; $lead_order = $row[6]; + $lead_order_randomize = $row[7]; + $lead_order_secondary = $row[8]; + $call_count_limit = $row[9]; } if (eregi("N",$no_hopper_dialing)) { @@ -1510,6 +1913,12 @@ if ($ACTION == 'manDiaLnextCaLL') $DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )"; } + $CCLsql=''; + if ($call_count_limit > 0) + { + $CCLsql = "and (called_count < $call_count_limit)"; + } + $stmt="SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00239',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1518,7 +1927,8 @@ if ($ACTION == 'manDiaLnextCaLL') if ($filtersql_ct > 0) { $row=mysql_fetch_row($rslt); - $fSQL = $row[0]; + $fSQL = "and $row[0]"; + $fSQL = preg_replace('/\\\\/','',$fSQL); } $stmt="SELECT list_id FROM vicidial_lists where campaign_id='$campaign' and active='Y';"; @@ -1549,57 +1959,102 @@ if ($ACTION == 'manDiaLnextCaLL') $territory = $row[1]; } - $agent_territories=''; - $stmt="SELECT agent_territories FROM vicidial_live_agents where user='$user';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00258',$user,$server_ip,$session_name,$one_mysql_log);} - $userterrVLA_ct = mysql_num_rows($rslt); - if ($DB) {echo "$userterrVLA_ct|$stmt\n";} - if ($userterrVLA_ct > 0) - { - $row=mysql_fetch_row($rslt); - $agent_territories = $row[0]; - } - if (strlen($agent_territories) > 3) - { - $agent_territoriesSQL = preg_replace('/-$/','',$agent_territories); - $agent_territoriesSQL = preg_replace('/ $|^ /','',$agent_territoriesSQL); - $territory = preg_replace('/ /',"','",$agent_territoriesSQL); - } - $adooSQL = ''; + if (eregi("TERRITORY",$agent_dial_owner_only)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00406',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00407',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00408',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + + $adooSQL = $searchownerSQL; + } if (eregi("USER",$agent_dial_owner_only)) {$adooSQL = "and owner='$user'";} - if (eregi("TERRITORY",$agent_dial_owner_only)) {$adooSQL = "and owner IN('$territory')";} if (eregi("USER_GROUP",$agent_dial_owner_only)) {$adooSQL = "and owner='$user_group'";} + if ($lead_order_randomize == 'Y') {$last_order = "RAND()";} + else + { + $last_order = "lead_id asc"; + if ($lead_order_secondary == 'LEAD_ASCEND') {$last_order = "lead_id asc";} + if ($lead_order_secondary == 'LEAD_DESCEND') {$last_order = "lead_id desc";} + if ($lead_order_secondary == 'CALLTIME_ASCEND') {$last_order = "last_local_call_time asc";} + if ($lead_order_secondary == 'CALLTIME_DESCEND') {$last_order = "last_local_call_time desc";} + } + $order_stmt = ''; if (eregi("DOWN",$lead_order)){$order_stmt = 'order by lead_id asc';} if (eregi("UP",$lead_order)){$order_stmt = 'order by lead_id desc';} - if (eregi("UP LAST NAME",$lead_order)){$order_stmt = 'order by last_name desc, lead_id asc';} - if (eregi("DOWN LAST NAME",$lead_order)){$order_stmt = 'order by last_name, lead_id asc';} - if (eregi("UP PHONE",$lead_order)){$order_stmt = 'order by phone_number desc, lead_id asc';} - if (eregi("DOWN PHONE",$lead_order)){$order_stmt = 'order by phone_number, lead_id asc';} - if (eregi("UP COUNT",$lead_order)){$order_stmt = 'order by called_count desc, lead_id asc';} - if (eregi("DOWN COUNT",$lead_order)){$order_stmt = 'order by called_count, lead_id asc';} - if (eregi("UP LAST ВЫЗОВ TIME",$lead_order)){$order_stmt = 'order by last_local_call_time desc, lead_id asc';} - if (eregi("DOWN LAST ВЫЗОВ TIME",$lead_order)){$order_stmt = 'order by last_local_call_time, lead_id asc';} - if (eregi("RANDOM",$lead_order)){$order_stmt = 'order by RAND()';} - if (eregi("UP RANK",$lead_order)){$order_stmt = 'order by rank desc, lead_id asc';} - if (eregi("DOWN RANK",$lead_order)){$order_stmt = 'order by rank, lead_id asc';} - if (eregi("UP OWNER",$lead_order)){$order_stmt = 'order by owner desc, lead_id asc';} - if (eregi("DOWN OWNER",$lead_order)){$order_stmt = 'order by owner, lead_id asc';} - if (eregi("UP TIMEZONE",$lead_order)){$order_stmt = 'order by gmt_offset_now desc, lead_id asc';} - if (eregi("DOWN TIMEZONE",$lead_order)){$order_stmt = 'order by gmt_offset_now, lead_id asc';} + if (eregi("UP LAST NAME",$lead_order)){$order_stmt = "order by last_name desc, $last_order";} + if (eregi("DOWN LAST NAME",$lead_order)){$order_stmt = "order by last_name, $last_order";} + if (eregi("UP PHONE",$lead_order)){$order_stmt = "order by phone_number desc, $last_order";} + if (eregi("DOWN PHONE",$lead_order)){$order_stmt = "order by phone_number, $last_order";} + if (eregi("UP COUNT",$lead_order)){$order_stmt = "order by called_count desc, $last_order";} + if (eregi("DOWN COUNT",$lead_order)){$order_stmt = "order by called_count, $last_order";} + if (eregi("UP LAST ВЫЗОВ TIME",$lead_order)){$order_stmt = "order by last_local_call_time desc, $last_order";} + if (eregi("DOWN LAST ВЫЗОВ TIME",$lead_order)){$order_stmt = "order by last_local_call_time, $last_order";} + if (eregi("RANDOM",$lead_order)){$order_stmt = "order by RAND()";} + if (eregi("UP RANK",$lead_order)){$order_stmt = "order by rank desc, $last_order";} + if (eregi("DOWN RANK",$lead_order)){$order_stmt = "order by rank, $last_order";} + if (eregi("UP OWNER",$lead_order)){$order_stmt = "order by owner desc, $last_order";} + if (eregi("DOWN OWNER",$lead_order)){$order_stmt = "order by owner, $last_order";} + if (eregi("UP TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now desc, $last_order";} + if (eregi("DOWN TIMEZONE",$lead_order)){$order_stmt = "order by gmt_offset_now, $last_order";} - $stmt="UPDATE vicidial_list SET status='QUEUE',user='$user' where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; + $stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and user NOT LIKE \"QUEUE%\" and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $adooSQL $order_stmt LIMIT 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00242',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($link); + # $fp = fopen ("./DNNdebug_log.txt", "a"); + # fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province|$affected_rows|$stmt|\n"); + # fclose($fp); + 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,vendor_lead_code FROM vicidial_list where user='QUEUE$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";} @@ -1611,8 +2066,10 @@ if ($ACTION == 'manDiaLnextCaLL') $list_id = $row[1]; $gmt_offset_now = $row[2]; $state = $row[3]; + $entry_list_id = $row[4]; + $vendor_lead_code = $row[5]; - $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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -1645,7 +2102,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";} @@ -1685,10 +2142,85 @@ 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++; + if ( (strlen($agent_dialed_type) < 3) or (strlen($agent_dialed_number) < 6) ) + { + $agent_dialed_number = $phone_number; + if (strlen($agent_dialed_type) < 3) + {$agent_dialed_type = 'MAIN';} + } + if ( (strlen($callback_id)>0) and (strlen($lead_id)>0) ) + { + if ($agent_dialed_type=='ALT') + {$agent_dialed_number = $alt_phone;} + if ($agent_dialed_type=='ADDR3') + {$agent_dialed_number = $address3;} + } + + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00414',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $row=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $row[0]; + $local_call_time = $row[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($agent_dialed_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "телефон and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Телефон Код города Вне зоны Dialable $PHONEgmt_offset ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Индекс Вне зоны Dialable $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Телефон Код города Вне зоны Dialable $PHONEgmt_offset ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Индекс Вне зоны Dialable $POSTgmt_offset ";} + } + } + ##### END check for postal_code and phone time zones if alert enabled + + ##### check if system is set to generate logfile for transfers $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; $rslt=mysql_query($stmt, $link); @@ -1704,15 +2236,15 @@ 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);} - # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; # DATETIME|campaign|lead_id|phone_number|user|type # 2007-08-22 11:11:11|TESTCAMP|65432|3125551212|1234|M $fp = fopen ("./xfer_log.txt", "a"); - fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$phone_number|$user|M|$MqueryCID||$province\n"); + fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province\n"); fclose($fp); } @@ -1721,7 +2253,32 @@ if ($ACTION == 'manDiaLnextCaLL') $CBcallback_time = ''; $CBuser = ''; $CBcomments = ''; - if (ereg("CALLBK",$dispo)) + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00366',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00367',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or ($dispo == 'CBHOLD') ) { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); @@ -1747,6 +2304,8 @@ if ($ACTION == 'manDiaLnextCaLL') { $row=mysql_fetch_row($rslt); $local_gmt = $row[0]; + $isdst = date("I"); + if ($isdst) {$local_gmt++;} } $LLCT_DATE_offset = ($local_gmt - $gmt_offset_now); $LLCT_DATE = date("Y-m-d H:i:s", mktime(date("H")-$LLCT_DATE_offset,date("i"),date("s"),date("m"),date("d"),date("Y"))); @@ -1778,7 +2337,32 @@ if ($ACTION == 'manDiaLnextCaLL') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00032',$user,$server_ip,$session_name,$one_mysql_log);} - + + $stmt="UPDATE vicidial_lists set list_lastcalldate=NOW() where list_id='$list_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);} + + $campaign_cid_override=''; + $LISTweb_form_address=''; + $LISTweb_form_address_two=''; + ### check if there is a list_id override + if (strlen($list_id) > 1) + { + $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two FROM vicidial_lists where list_id='$list_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00245',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $lio_ct = mysql_num_rows($rslt); + if ($lio_ct > 0) + { + $row=mysql_fetch_row($rslt); + $campaign_cid_override = $row[0]; + $LISTweb_form_address = $row[1]; + $LISTweb_form_address_two = $row[2]; + } + } + ### if preview dialing, do not send the call if ( (strlen($preview)<1) || ($preview == 'NO') ) { @@ -1794,37 +2378,78 @@ if ($ACTION == 'manDiaLnextCaLL') $Local_dial_timeout = ($Local_dial_timeout * 1000); if (strlen($dial_prefix) > 0) {$Local_out_prefix = "$dial_prefix";} if (strlen($campaign_cid) > 6) {$CCID = "$campaign_cid"; $CCID_on++;} - $campaign_cid_override=''; - ### check if there is a list_id override - if (strlen($list_id) > 1) - { - $stmt = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00245',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $campaign_cid_override = $row[0]; - } - } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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 == 'AREACODE') + { + $temp_ac = substr("$agent_dialed_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00426',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; + + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00427',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$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);} - # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + ### 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: MmddhhmmssLLLLLLLLLL $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)) - {$Ndialstring = "$Local_out_prefix$phone_number";} + {$Ndialstring = "$Local_out_prefix$agent_dialed_number";} else - {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + {$Ndialstring = "$Local_out_prefix$phone_code$agent_dialed_number";} if ( ($usegroupalias > 0) and (strlen($account)>1) ) { @@ -1842,7 +2467,7 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00033',$user,$server_ip,$session_name,$one_mysql_log);} - $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; + $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$agent_dialed_number','$NOW_TIME','OUT')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00034',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1859,31 +2484,52 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00036',$user,$server_ip,$session_name,$one_mysql_log);} - #### update vicidial_agent_log if not MANUAL dial_method - if ($dial_method != 'MANUAL') - { - $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00301',$user,$server_ip,$session_name,$one_mysql_log);} - $VDpr_ct = mysql_num_rows($rslt); - if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) - { - $row=mysql_fetch_row($rslt); - $agent_log_id = $row[5]; - $pause_sec = (($StarTtime - $row[0]) + $row[1]); + # #### update vicidial_agent_log if not MANUAL dial_method + # if ($dial_method != 'MANUAL') + # { + # $pause_sec=0; + # $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + # if ($DB) {echo "$stmt\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00302',$user,$server_ip,$session_name,$one_mysql_log);} + # $VDpr_ct = mysql_num_rows($rslt); + # if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + # { + # $row=mysql_fetch_row($rslt); + # $agent_log_id = $row[5]; + # $pause_sec = (($StarTtime - $row[0]) + $row[1]); + # + # $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + # if ($format=='debug') {echo "\n";} + # $rslt=mysql_query($stmt, $link); + # if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} + # } + # } - $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00302',$user,$server_ip,$session_name,$one_mysql_log);} - } + + $val_pause_epoch=0; + $val_pause_sec=0; + $stmt = "SELECT pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00323',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) + { + $row=mysql_fetch_row($rslt); + $val_pause_epoch = $row[0]; + $val_pause_sec = ($StarTtime - $val_pause_epoch); } + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00324',$user,$server_ip,$session_name,$one_mysql_log);} + + if ($agent_dialed_number > 0) { - $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$phone_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; + $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','$agent_dialed_number','$Ndialstring','$lead_id','$CCID','$RAWaccount')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00191',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1891,7 +2537,7 @@ if ($ACTION == 'manDiaLnextCaLL') ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00037',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1905,30 +2551,46 @@ if ($ACTION == 'manDiaLnextCaLL') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### if ($enable_queuemetrics_logging > 0) { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00389',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); # UNPAUSEALL - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00038',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # ВЫЗОВOUTBOUND (formerly ENTERQUEUE) - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$agent_dialed_number',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00039',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00040',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1971,7 +2633,7 @@ if ($ACTION == 'manDiaLnextCaLL') $VDCL_xferconf_c_number=''; $VDCL_xferconf_d_number=''; $VDCL_xferconf_e_number=''; - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00277',$user,$server_ip,$session_name,$one_mysql_log);} @@ -1988,7 +2650,7 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2007,6 +2669,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); + } + } } @@ -2045,8 +2751,8 @@ if ($ACTION == 'manDiaLnextCaLL') $LeaD_InfO .= $CBcallback_time . "\n"; $LeaD_InfO .= $CBuser . "\n"; $LeaD_InfO .= $CBcomments . "\n"; - $LeaD_InfO .= $phone_number . "\n"; - $LeaD_InfO .= "MAIN\n"; + $LeaD_InfO .= $agent_dialed_number . "\n"; + $LeaD_InfO .= $agent_dialed_type . "\n"; $LeaD_InfO .= $source_id . "\n"; $LeaD_InfO .= $rank . "\n"; $LeaD_InfO .= $owner . "\n"; @@ -2057,12 +2763,19 @@ 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"; + $LeaD_InfO .= $LISTweb_form_address . "\n"; + $LeaD_InfO .= $LISTweb_form_address_two . "\n"; + $LeaD_InfO .= $post_phone_time_diff_alert_message . "\n"; echo $LeaD_InfO; } else { - echo "ПУСТОЙ КОНТЕЙНЕР\n"; + echo "БУФЕР ПУСТ\n"; } } } @@ -2080,8 +2793,8 @@ if ($ACTION == 'alt_phone_change') if ( (strlen($stage)<1) || (strlen($called_count)<1) || (strlen($lead_id)<1) || (strlen($phone_number)<1) ) { $channel_live=0; - echo "АЛЬТ. ТЕЛЕФОН НОМЕР СТАТУС NOT CHANGED\n"; - echo "$phone_number $stage $lead_id or $called_count это неправильно\n"; + echo "ДОП.ТЕЛЕФОН НОМЕР СОСТОЯНИЕ NOT CHANGED\n"; + echo "$phone_number $stage $lead_id or $called_count неверный\n"; exit; } else @@ -2091,7 +2804,7 @@ if ($ACTION == 'alt_phone_change') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00041',$user,$server_ip,$session_name,$one_mysql_log);} - echo "АЛЬТ. ТЕЛЕФОН НОМЕР СТАТУС CHANGED\n"; + echo "ДОП.ТЕЛЕФОН НОМЕР СОСТОЯНИЕ CHANGED\n"; } } @@ -2106,7 +2819,7 @@ if ($ACTION == 'AlertControl') { $channel_live=0; echo "AGENT ALERT SETTING NOT CHANGED\n"; - echo "$stage это неправильно\n"; + echo "$stage неверный\n"; exit; } else @@ -2137,18 +2850,23 @@ if ($ACTION == 'manDiaLskip') { $channel_live=0; echo "LEAD NOT REVERTED\n"; - echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context это неправильно\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context неверный\n"; exit; } else { $called_count = ($called_count - 1); - ### flag the lead as called and change it's status to INCALL + ### set the lead back to previous status and called_count $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00042',$user,$server_ip,$session_name,$one_mysql_log);} + ### log the skip event + $stmt = "INSERT INTO vicidial_agent_skip_log set campaign_id='$campaign', previous_status='$stage', previous_called_count='$called_count',user='$user', lead_id='$lead_id', event_date=NOW();"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00419',$user,$server_ip,$session_name,$one_mysql_log);} echo "LEAD REVERTED\n"; } @@ -2168,13 +2886,27 @@ if ($ACTION == 'manDiaLonly') { $channel_live=0; echo " ВЫЗОВ NOT PLACED\n"; - echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context это неправильно\n"; + echo "Conf Exten $conf_exten or campaign $campaign or ext_context $ext_context неверный\n"; exit; } else { + ##### clear out last call to same lead if exists ##### + if (strlen($old_CID) > 16) + { + $old_lead_id = substr($old_CID, -10); + $old_lead_id = ($old_lead_id + 0); + if ($lead_id == "$old_lead_id") + { + $stmt="DELETE FROM vicidial_auto_calls where callerid='$old_CID' and lead_id='$old_lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00428',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + ##### grab number of calls today in this campaign and increment - $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; + $stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00043',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2182,14 +2914,30 @@ 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=''; + $LISTweb_form_address=''; + $LISTweb_form_address_two=''; $local_DEF = 'Local/'; $local_AMP = '@'; $Local_out_prefix = '9'; @@ -2217,7 +2965,7 @@ if ($ACTION == 'manDiaLonly') if (strlen($list_id) > 1) { - $stmt = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two FROM vicidial_lists where list_id='$list_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00247',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2226,19 +2974,63 @@ if ($ACTION == 'manDiaLonly') { $row=mysql_fetch_row($rslt); $campaign_cid_override = $row[0]; + $LISTweb_form_address = $row[1]; + $LISTweb_form_address_two = $row[2]; } } } } if (strlen($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + ### check for custom cid use + $use_custom_cid=0; + $stmt = "SELECT use_custom_cid FROM vicidial_campaigns where 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 == 'AREACODE') + { + $temp_ac = substr("$phone_number", 0, 3); + $stmt = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$campaign' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00429',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vcca_ct = mysql_num_rows($rslt); + if ($vcca_ct > 0) + { + $row=mysql_fetch_row($rslt); + $temp_vcca = $row[0]; - $PADlead_id = sprintf("%09s", $lead_id); - while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);} + $stmt="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$campaign' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00430',$user,$server_ip,$session_name,$one_mysql_log);} + } + $temp_CID = preg_replace("/\D/",'',$temp_vcca); + } + if ($use_custom_cid == 'Y') + {$temp_CID = preg_replace("/\D/",'',$security);} + if (strlen($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} + } - # Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL + $PADlead_id = sprintf("%010s", $lead_id); + while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);} + + # Create unique calleridname to track the call: MmddhhmmssLLLLLLLLLL $MqueryCID = "M$CIDdate$PADlead_id"; - if ($CCID_on) {$CIDstring = "\"$MqueryCID\" <$CCID>";} - else {$CIDstring = "$MqueryCID";} + $EAC=''; + if ($use_eac > 0) + { + $eac_extension = preg_replace("/SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//",'',$eac_phone); + $EAC=" $eac_extension"; + } + if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";} + else {$CIDstring = "$MqueryCID$EAC";} if ( ($usegroupalias > 0) and (strlen($account)>1) ) { @@ -2288,27 +3080,91 @@ if ($ACTION == 'manDiaLonly') echo "$MqueryCID\n"; - #### update vicidial_agent_log if not MANUAL dial_method - if ($dial_method != 'MANUAL') +# #### update vicidial_agent_log if not MANUAL dial_method +# if ($dial_method != 'MANUAL') +# { +# $pause_sec=0; +# $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00304',$user,$server_ip,$session_name,$one_mysql_log);} +# $VDpr_ct = mysql_num_rows($rslt); +# if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) +# { +# $row=mysql_fetch_row($rslt); +# $agent_log_id = $row[5]; +# $pause_sec = (($StarTtime - $row[0]) + $row[1]); +# +# $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; +# if ($format=='debug') {echo "\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} +# } +# } + + $val_pause_epoch=0; + $val_pause_sec=0; + $val_dispo_epoch=0; + $val_dispo_sec=0; + $val_wait_epoch=0; + $val_wait_sec=0; + $stmt = "SELECT dispo_epoch,wait_epoch,pause_epoch FROM vicidial_agent_log where agent_log_id='$agent_log_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00326',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vald_ct = mysql_num_rows($rslt); + if ($vald_ct > 0) { - $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; - if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $val_dispo_epoch = $row[0]; + $val_wait_epoch = $row[1]; + $val_pause_epoch = $row[2]; + $val_dispo_sec = ($StarTtime - $val_dispo_epoch); + $val_wait_sec = ($StarTtime - $val_wait_epoch); + $val_pause_sec = ($StarTtime - $val_pause_epoch); + } + if ($val_dispo_epoch > 1000) + { + $stmt="UPDATE vicidial_agent_log set status='ALTNUM',dispo_sec='$val_dispo_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00303',$user,$server_ip,$session_name,$one_mysql_log);} - $VDpr_ct = mysql_num_rows($rslt); - if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00327',$user,$server_ip,$session_name,$one_mysql_log);} + + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00328',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) { $row=mysql_fetch_row($rslt); - $agent_log_id = $row[5]; - $pause_sec = (($StarTtime - $row[0]) + $row[1]); - - $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00304',$user,$server_ip,$session_name,$one_mysql_log);} + $user_group = trim("$row[0]"); } + + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group','ANDIAL');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00329',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + + $stmt="UPDATE vicidial_live_agents SET agent_log_id='$agent_log_id',last_state_change='$NOW_TIME' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00330',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAaffected_rows_update = mysql_affected_rows($link); } + else + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$val_pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00331',$user,$server_ip,$session_name,$one_mysql_log);} + } + + echo "$agent_log_id\n"; + if ($agent_dialed_number > 0) { @@ -2321,13 +3177,12 @@ if ($ACTION == 'manDiaLonly') ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00048',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); - $i=0; - while ($i < $qm_conf_ct) + if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; @@ -2336,31 +3191,46 @@ if ($ACTION == 'manDiaLonly') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; - $i++; + $queuemetrics_pe_phone_append = $row[6]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### if ($enable_queuemetrics_logging > 0) { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00390',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); # UNPAUSEALL - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00049',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # ВЫЗОВOUTBOUND (formerly ENTERQUEUE) - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00050',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00051',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2385,7 +3255,7 @@ if ($ACTION == 'manDiaLlookCaLL') if (strlen($MDnextCID)<18) { echo "NO\n"; - echo "MDnextCID $MDnextCID это неправильно\n"; + echo "MDnextCID $MDnextCID неверный\n"; exit; } else @@ -2406,7 +3276,7 @@ if ($ACTION == 'manDiaLlookCaLL') } else { - ### after 10 секунды, start checking for call termination in the carrier log + ### after 10 секунд, start checking for call termination in the carrier log if ( ($DiaL_SecondS > 0) and (preg_match("/0$/",$DiaL_SecondS)) ) { $stmt="SELECT uniqueid,channel,end_epoch FROM call_log where caller_code='$MDnextCID' and server_ip='$server_ip' order by start_time desc LIMIT 1;"; @@ -2433,9 +3303,10 @@ if ($ACTION == 'manDiaLlookCaLL') $dialstatus =$row[0]; $hangup_cause =$row[1]; - $channel = $dialstatus . "-" . $hangup_cause; + $channel = $dialstatus; + $hangup_cause_msg = "Cause: " . $hangup_cause . " - " . hangup_cause_description($hangup_cause); - $call_output = "$uniqueid\n$channel\nERROR"; + $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg; $call_good++; ### Delete call record @@ -2443,6 +3314,11 @@ if ($ACTION == 'manDiaLlookCaLL') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00293',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00399',$user,$server_ip,$session_name,$one_mysql_log);} } } } @@ -2452,7 +3328,7 @@ if ($ACTION == 'manDiaLlookCaLL') { $wait_sec=0; $dead_epochSQL = ''; - $stmt = "select wait_epoch,wait_sec,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec,dead_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,'00053',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2465,7 +3341,7 @@ if ($ACTION == 'manDiaLlookCaLL') if ( ($now_dead_epoch > 1000) and ($now_dead_epoch < $StarTtime) ) {$dead_epochSQL = ",dead_epoch='$StarTtime'";} } - $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' $dead_epochSQL where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' $dead_epochSQL where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00054',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2504,12 +3380,15 @@ 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 "LOG НЕ ВВЕДЕН\n"; - echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign это неправильно\n"; + echo "ЖУРНАЛ НЕ УКАЗАН\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign неверный\n"; exit; } else @@ -2526,6 +3405,13 @@ if ($stage == "start") $user_group = trim("$row[0]"); } + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$uniqueid',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00400',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + $manualVLexists=0; $beginUNIQUEID = preg_replace("/\..*/","",$uniqueid); $stmt="SELECT count(*) from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; @@ -2564,12 +3450,12 @@ if ($stage == "start") if ($affected_rows > 0) { - echo "VICIDiaL_LOG Введенный: $uniqueid|$channel|$NOW_TIME\n"; + echo "VICIDiaL_LOG Добавлено: $uniqueid|$channel|$NOW_TIME\n"; echo "$StarTtime\n"; } else { - echo "LOG НЕ ВВЕДЕН\n"; + echo "ЖУРНАЛ НЕ УКАЗАН\n"; } $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; @@ -2585,11 +3471,11 @@ if ($stage == "start") # if ($affected_rows > 0) # { - # echo "CALL_LOG Введенный: $uniqueid|$channel|$NOW_TIME"; + # echo "CALL_LOG Добавлено: $uniqueid|$channel|$NOW_TIME"; # } # else # { - # echo "LOG НЕ ВВЕДЕН\n"; + # echo "ЖУРНАЛ НЕ УКАЗАН\n"; # } } } @@ -2621,8 +3507,8 @@ if ($stage == "end") } if ( (strlen($uniqueid)<1) or (strlen($lead_id)<1) ) { - echo "LOG НЕ ВВЕДЕН\n"; - echo "uniqueid $uniqueid or lead_id: $lead_id это неправильно\n"; + echo "ЖУРНАЛ НЕ УКАЗАН\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id неверный\n"; exit; } else @@ -2635,13 +3521,13 @@ if ($stage == "end") $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); ##### look for the start epoch in the vicidial_closer_log table - $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id,status FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $VDIDselect = "VDCL_LID $lead_id $phone_number $user $four_hours_ago"; } else { ##### look for the start epoch in the vicidial_log table - $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } $rslt=mysql_query($stmt, $link); @@ -2655,6 +3541,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 @@ -2669,7 +3556,7 @@ if ($stage == "end") fclose($fp); ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log - $stmt="SELECT start_epoch,term_reason,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT start_epoch,term_reason,campaign_id,status FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00061',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2680,6 +3567,7 @@ if ($stage == "end") $start_epoch = $row[0]; $VDterm_reason = $row[1]; $VDcampaign_id = $row[2]; + $VDstatus = $row[3]; $length_in_sec = ($StarTtime - $start_epoch); } else @@ -2696,7 +3584,9 @@ if ($stage == "end") if ($VLA_inOUT == 'INBOUND') { - $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec', status='$status_dispo' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $vcl_statusSQL=''; + if ($VDstatus == 'INCALL') {$vcl_statusSQL = ",status='$status_dispo'";} + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vcl_statusSQL where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00062',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2704,6 +3594,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 { @@ -2715,7 +3609,7 @@ if ($stage == "end") ############################################# ##### 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_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00063',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2730,6 +3624,8 @@ if ($stage == "end") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_dispo_pause = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; if ($enable_queuemetrics_logging > 0) { @@ -2781,7 +3677,7 @@ if ($stage == "end") if ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)",$auto_alt_dial)) ) { $alt_dial_skip=0; - $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT alt_phone,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00065',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2793,6 +3689,7 @@ if ($stage == "end") $alt_phone = eregi_replace("[^0-9]","",$alt_phone); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$alt_phone = '';} if (strlen($alt_phone)>5) @@ -2841,7 +3738,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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -2858,7 +3755,7 @@ if ($stage == "end") if ( ( (eregi("(ALT)",$alt_dial)) and (eregi("ALT_AND_ADDR3",$auto_alt_dial)) ) or ( (eregi("(NONE|MAIN)",$alt_dial)) and (eregi("ADDR3_ONLY",$auto_alt_dial)) ) ) { $addr3_dial_skip=0; - $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; + $stmt="SELECT address3,gmt_offset_now,state,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00069',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2870,6 +3767,7 @@ if ($stage == "end") $address3 = eregi_replace("[^0-9]","",$address3); $gmt_offset_now = $row[1]; $state = $row[2]; + $vendor_lead_code = $row[3]; } else {$address3 = '';} if (strlen($address3)>5) @@ -2918,7 +3816,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',vendor_lead_code='$vendor_lead_code';"; 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);} @@ -2945,7 +3843,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,vendor_lead_code 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";} @@ -2956,6 +3854,8 @@ if ($stage == "end") $EA_gmt_offset_now = $row[0]; $EA_state = $row[1]; $EA_list_id = $row[2]; + $EA_entry_list_id = $row[3]; + $EA_vendor_lead_code = $row[4]; } $alt_dial_phones_count=0; $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; @@ -3033,7 +3933,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',vendor_lead_code='$EA_vendor_lead_code';"; 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);} @@ -3101,7 +4001,10 @@ if ($stage == "end") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00081',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $licf_SQL = ''; + if ($VLA_inOUT == 'INBOUND') + {$licf_SQL = ",last_inbound_call_finish='$NOW_TIME'";} + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' $licf_SQL where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00082',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3120,7 +4023,22 @@ if ($stage == "end") { if ($enable_queuemetrics_logging > 0) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00391',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00083',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3158,7 +4076,22 @@ if ($stage == "end") $CLstage = preg_replace("/XFER|CLOSER|-/",'',$CLstage); if ($CLstage < 0.25) {$CLstage=0;} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00392',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00085',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3193,7 +4126,7 @@ if ($stage == "end") { if ($enable_queuemetrics_logging > 0) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00088',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3209,15 +4142,16 @@ if ($stage == "end") if ( (ereg("NONE",$term_reason)) or (ereg("NONE",$VDterm_reason)) or (strlen($VDterm_reason) < 1) ) { ### check to see if lead should be alt_dialed - $stmt="SELECT term_reason,uniqueid from vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; + $stmt="SELECT term_reason,uniqueid,status from vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00089',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { $row=mysql_fetch_row($rslt); - $VDterm_reason = $row[0]; - $VDvicidial_id = $row[1]; + $VDterm_reason = $row[0]; + $VDvicidial_id = $row[1]; + $VDstatus = $row[2]; $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } if (ereg("CALLER",$VDterm_reason)) @@ -3230,18 +4164,25 @@ if ($stage == "end") } } + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$uniqueid',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00401',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + ### check to see if the vicidial_log record exists, if not, insert it $manualVLexists=0; $beginUNIQUEID = preg_replace("/\..*/","",$uniqueid); - $stmt="SELECT count(*) from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; + $stmt="SELECT status from vicidial_log where lead_id='$lead_id' and user='$user' and phone_number='$phone_number' and uniqueid LIKE \"$beginUNIQUEID%\";"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00223',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - $VL_exists_ct = mysql_num_rows($rslt); - if ($VL_exists_ct > 0) + $manualVLexists = mysql_num_rows($rslt); + if ($manualVLexists > 0) { $row=mysql_fetch_row($rslt); - $manualVLexists = $row[0]; + $VDstatus = $row[0]; } if ($manualVLexists < 1) @@ -3255,12 +4196,12 @@ if ($stage == "end") if ($affected_rows > 0) { - echo "VICIDiaL_LOG Введенный: $uniqueid|$channel|$NOW_TIME\n"; + echo "VICIDiaL_LOG Добавлено: $uniqueid|$channel|$NOW_TIME\n"; echo "$StarTtime\n"; } else { - echo "LOG НЕ ВВЕДЕН\n"; + echo "ЖУРНАЛ НЕ УКАЗАН\n"; } } else @@ -3273,7 +4214,8 @@ if ($stage == "end") } ##### update the duration and end time in the vicidial_log table - $stmt="UPDATE vicidial_log set $SQLterm end_epoch='$StarTtime', length_in_sec='$length_in_sec', status='$status_dispo' where uniqueid='$uniqueid' and lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; + if ($VDstatus == 'INCALL') {$vl_statusSQL = ",status='$status_dispo'";} + $stmt="UPDATE vicidial_log set $SQLterm end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vl_statusSQL where uniqueid='$uniqueid' and lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00090',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3285,7 +4227,7 @@ if ($stage == "end") } else { - echo "LOG НЕ ВВЕДЕН\n\n"; + echo "ЖУРНАЛ НЕ УКАЗАН\n\n"; } } else @@ -3322,7 +4264,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);} @@ -3361,7 +4303,22 @@ if ($stage == "end") if (strlen($VDqueue_position) < 1) {$VDqueue_position=1;} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$VDqueue_position',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00393',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='$VDqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00094',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3454,7 +4411,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);} @@ -3491,7 +4450,7 @@ if ($stage == "end") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00098',$user,$server_ip,$session_name,$one_mysql_log);} echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; - if (strlen($filename)>2) + if (strlen($filename[$loop_count])>2) { $stmt="SELECT recording_id,start_epoch,vicidial_id,lead_id FROM recording_log where filename='$filename[$loop_count]'"; if ($format=='debug') {echo "\n";} @@ -3517,9 +4476,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); @@ -3552,7 +4514,7 @@ if ($stage == "end") $dead_secSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_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,'00101',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3584,7 +4546,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);} @@ -3595,6 +4557,16 @@ if ($stage == "end") if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00299',$user,$server_ip,$session_name,$one_mysql_log);} + + ### if queuemetrics_dispo_pause dispo tag is enabled, log it here + if (strlen($queuemetrics_dispo_pause) > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$queuemetrics_dispo_pause';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00364',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } } } @@ -3612,8 +4584,8 @@ if ($ACTION == 'VDADREcheckINCOMING') { $channel_live=0; echo "0\n"; - echo "Кампания $campaign это неправильно\n"; - echo "lead_id $lead_id это неправильно\n"; + echo "Кампания $campaign неверный\n"; + echo "lead_id $lead_id неверный\n"; exit; } else @@ -3658,12 +4630,14 @@ if ($ACTION == 'VDADcheckINCOMING') $alt_phone_note=''; $alt_phone_active=''; $alt_phone_count=''; + $INclosecallid=''; + $INxfercallid=''; if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) { $channel_live=0; echo "0\n"; - echo "Кампания $campaign это неправильно\n"; + echo "Кампания $campaign неверный\n"; exit; } else @@ -3724,7 +4698,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";} @@ -3762,6 +4736,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 @@ -3769,7 +4745,32 @@ if ($ACTION == 'VDADcheckINCOMING') $CBcallback_time = ''; $CBuser = ''; $CBcomments = ''; - if (ereg("CALLBK",$dispo)) + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00368',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00369',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or ($dispo == 'CBHOLD') ) { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); @@ -3792,9 +4793,22 @@ 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;"; + $stmt="SELECT user_group,full_name FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3803,9 +4817,9 @@ if ($ACTION == 'VDADcheckINCOMING') { $row=mysql_fetch_row($rslt); $user_group = trim("$row[0]"); + $fullname = $row[1]; } - $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); @@ -3830,7 +4844,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00248',$user,$server_ip,$session_name,$one_mysql_log);} $VDAP_cid_ct = mysql_num_rows($rslt); - if ($VDACP_cid_ct > 0) + if ($VDAP_cid_ct > 0) { $row=mysql_fetch_row($rslt); $Xalt_phone_count =$row[0]; @@ -3840,7 +4854,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00249',$user,$server_ip,$session_name,$one_mysql_log);} $VDAPct_cid_ct = mysql_num_rows($rslt); - if ($VDACPct_cid_ct > 0) + if ($VDAPct_cid_ct > 0) { $row=mysql_fetch_row($rslt); $COUNTalt_phone_count =$row[0]; @@ -3872,7 +4886,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);} @@ -3880,13 +4894,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); } } @@ -3911,7 +4927,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);} @@ -3919,25 +4935,29 @@ 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 if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00281',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3958,7 +4978,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)) { @@ -3995,7 +5015,22 @@ 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);} - $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + 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); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00118',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4019,7 +5054,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);} @@ -4050,8 +5085,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);} @@ -4085,6 +5123,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) ) { @@ -4104,7 +5144,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00188',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4117,7 +5157,7 @@ if ($ACTION == 'VDADcheckINCOMING') if (strlen($VDCL_group_web_vars) < 1) { - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00189',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4130,7 +5170,7 @@ if ($ACTION == 'VDADcheckINCOMING') } ### update the comments in vicidial_live_agents record - $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND',last_inbound_call_time='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00120',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4139,7 +5179,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);} @@ -4162,6 +5202,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; @@ -4177,7 +5218,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00190',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4192,7 +5233,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_caller_id_number=''; if (strlen($VDCL_default_group_alias)>1) { - $stmt = "select caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; + $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00187',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4207,7 +5248,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00282',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4225,12 +5266,45 @@ if ($ACTION == 'VDADcheckINCOMING') {$VDCL_xferconf_d_number = $row[3];} if (strlen($row[4]) > 0) {$VDCL_xferconf_e_number = $row[4];} + if (strlen($row[5]) > 5) + {$VDCL_group_web = $row[5];} + if (strlen($row[6]) > 5) + {$VDCL_group_web_two = $row[6];} + } + } + + $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";} @@ -4272,6 +5346,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); @@ -4318,6 +5437,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; @@ -4325,7 +5448,7 @@ if ($ACTION == 'VDADcheckINCOMING') $wait_sec=0; $StarTtime = date("U"); - $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00123',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4340,8 +5463,33 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00124',$user,$server_ip,$session_name,$one_mysql_log);} - ### If ВЫЗОВBK, change vicidial_callback record to INACTIVE - if (eregi("CALLBK|CBHOLD", $dispo)) + ### If a scheduled callback, change vicidial_callback record to INACTIVE + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00370',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00371',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or (eregi("CALLBK|CBHOLD", $dispo)) ) { $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; if ($format=='debug') {echo "\n";} @@ -4375,7 +5523,7 @@ if ($ACTION == 'VDADcheckINCOMING') { if (eregi('--A--user_custom_',$VDCL_start_call_url)) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five 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,'00283',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4424,8 +5572,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); @@ -4452,11 +5600,83 @@ 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); + $VDCL_start_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($callerid)),$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 = urlencode(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++; + } + } + } + + $stmt="UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00420',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$VDCL_start_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='start',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00421',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### grab the call_start_url ### if ($DB > 0) {echo "$VDCL_start_call_url
\n";} $SCUfile = file("$VDCL_start_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00422',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + ##### BEGIN special filtering and response for Vtiger account balance function ##### + # http://vtiger/vicidial/api.php?mode=callxfer&contactwsid=--A--vendor_lead_code--B--&minuteswarning=3 $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00294',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4466,27 +5686,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); } } @@ -4514,7 +5778,7 @@ if ($ACTION == 'userLOGout') if ( (strlen($campaign)<1) || (strlen($conf_exten)<1) ) { echo "NO\n"; - echo "campaign $campaign or conf_exten $conf_exten это неправильно\n"; + echo "campaign $campaign or conf_exten $conf_exten неверный\n"; exit; } else @@ -4602,14 +5866,14 @@ if ($ACTION == 'userLOGout') $vla_delete = mysql_affected_rows($link); ##### Delete the vicidial_live_inbound_agents records for this session - $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + $stmt="DELETE from vicidial_live_inbound_agents where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00131',$user,$server_ip,$session_name,$one_mysql_log);} $vlia_delete = mysql_affected_rows($link); $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00136',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4630,7 +5894,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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append 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";} @@ -4638,13 +5902,17 @@ 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]; + $queuemetrics_dispo_pause = $row[9]; + $queuemetrics_pe_phone_append = $row[10]; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### @@ -4656,6 +5924,10 @@ if ($ACTION == 'userLOGout') if ($enable_queuemetrics_logging > 0) { + $QM_LOGOFF = 'AGENTLOGOFF'; + if ($queuemetrics_loginout=='CALLBACK') + {$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';} + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); @@ -4665,29 +5937,100 @@ 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;"; + $logintime=0; + $stmt = "SELECT time_id,data1 FROM queue_log where agent='Agent/$user' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > $check_time order by time_id desc limit 1;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00139',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} - echo "$stmt\n"; $li_conf_ct = mysql_num_rows($rslt); $i=0; while ($i < $li_conf_ct) { $row=mysql_fetch_row($rslt); $logintime = $row[0]; + $loginphone = $row[1]; $i++; } + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00394',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + $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';"; - 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_loginout != 'NONE') + { + $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' $data4SQL;"; + 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) + { + if ($queuemetrics_loginout == 'NONE') + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00396',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + if ( ($logintime < 1) or ($queuemetrics_loginout == 'NONE') ) + { + $stmtB = "SELECT time_id,data3 FROM queue_log where agent='Agent/$user' and verb='PAUSEREASON' and data1='LOGIN' order by time_id desc limit 1;"; + $rsltB=mysql_query($stmtB, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00365',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "
$stmtB\n";} + $qml_ct = mysql_num_rows($rsltB); + if ($qml_ct > 0) + { + $row=mysql_fetch_row($rsltB); + $logintime = $row[0]; + $loginphone = $row[1]; + } + } + $stmt = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$user' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$campaign' 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";} + $amq_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $amq_conf_ct) + { + $row=mysql_fetch_row($rslt); + $AMqueue[$i] = $row[0]; + $i++; + } + + ### add the logged-in campaign as well + $AMqueue[$i] = $campaign; + $i++; + $amq_conf_ct++; + + $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' $data4SQL;"; + $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); } } @@ -4708,12 +6051,12 @@ if ($ACTION == 'updateDISPO') $MAN_vl_insert=0; if ( (strlen($dispo_choice)<1) || (strlen($lead_id)<1) ) { - echo "Dispo Choice $dispo or lead_id $lead_id это неправильно\n"; + echo "Dispo Choice $dispo or lead_id $lead_id неверный\n"; exit; } else { - $stmt = "SELECT dispo_call_url from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT dispo_call_url,queuemetrics_callstatus_override from vicidial_campaigns vc,vicidial_live_agents vla where vla.campaign_id=vc.campaign_id and vla.user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00284',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4721,11 +6064,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);} @@ -4752,6 +6096,12 @@ 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); + $log_dispo_choice = $dispo_choice; + if (strlen($CallBackLeadСостояние) > 0) {$log_dispo_choice = $CallBackLeadСостояние;} + $stmt = "SELECT count(*) from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -4759,10 +6109,21 @@ if ($ACTION == 'updateDISPO') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { - $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; + $call_type='IN'; + $stmt = "UPDATE vicidial_closer_log set status='$log_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,'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";} @@ -4773,6 +6134,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)) ) @@ -4784,7 +6146,7 @@ if ($ACTION == 'updateDISPO') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { - $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; + $stmt="UPDATE vicidial_log set status='$log_dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00145',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4836,7 +6198,7 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00250',$user,$server_ip,$session_name,$one_mysql_log);} $VDAP_cid_ct = mysql_num_rows($rslt); - if ($VDACP_cid_ct > 0) + if ($VDAP_cid_ct > 0) { $row=mysql_fetch_row($rslt); $Xalt_phone_count =$row[0]; @@ -4846,7 +6208,7 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00251',$user,$server_ip,$session_name,$one_mysql_log);} $VDAPct_cid_ct = mysql_num_rows($rslt); - if ($VDACPct_cid_ct > 0) + if ($VDAPct_cid_ct > 0) { $row=mysql_fetch_row($rslt); $COUNTalt_phone_count =$row[0]; @@ -4872,14 +6234,21 @@ 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) > 9) {$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';"; + $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='$log_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";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00215',$user,$server_ip,$session_name,$one_mysql_log);} + ##### insert log into vicidial_log_extended for manual VICIDiaL call + $stmt="INSERT IGNORE INTO vicidial_log_extended SET uniqueid='$FAKEcall_id',server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='$server_ip',call_date='$NOW_TIME',lead_id='$lead_id',caller_code='$MDnextCID';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00402',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rowsX = mysql_affected_rows($link); + $MAN_vl_insert++; } @@ -4887,10 +6256,15 @@ if ($ACTION == 'updateDISPO') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00219',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt="UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00403',$user,$server_ip,$session_name,$one_mysql_log);} } else { - $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; + $stmt="UPDATE vicidial_log set status='$log_dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by uniqueid desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00145',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4931,27 +6305,27 @@ if ($ACTION == 'updateDISPO') } $insert_into_dnc=0; - if ( ($use_internal_dnc=='Y') and (eregi("\|$dispo_choice\|", $DNC_string_check) ) ) + if ( ($use_internal_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; + $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";} $insert_into_dnc++; } - if ( ($use_campaign_dnc=='Y') and (eregi("\|$dispo_choice\|", $DNC_string_check) ) ) + if ( ($use_campaign_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - $stmt="INSERT INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');"; + $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";} @@ -4963,7 +6337,7 @@ if ($ACTION == 'updateDISPO') $dispo_epochSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; + $stmt = "SELECT dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00150',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4996,7 +6370,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='$log_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);} @@ -5045,23 +6419,52 @@ if ($ACTION == 'updateDISPO') $comments = eregi_replace("'",'',$comments); $comments = eregi_replace(';','',$comments); $comments = eregi_replace("\\\\",' ',$comments); - $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; + $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group,lead_status) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group','$CallBackLeadСостояние');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00154',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc from vicidial_campaigns where campaign_id='$campaign';"; + ### BEGIN Call Примечания Logging ### + if (strlen($call_notes) > 1) + { + $VDADchannel_group=$campaign; + $stmt = "SELECT campaign_id,closecallid 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,'00372',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_cn_ct = mysql_num_rows($rslt); + if ($VDCL_cn_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group = $row[0]; + $vicidial_id = $row[1]; + } + else + {$vicidial_id = $uniqueid;} + + # Insert into vicidial_call_notes + $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$NOW_TIME',call_notes='" . mysql_real_escape_string($call_notes) . "';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00373',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $notesid = mysql_insert_id($link); + } + ### END Call Примечания Logging ### + + $stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,api_manual_dial from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $VC_auto_alt_dial_statuses = $row[0]; $use_internal_dnc = $row[1]; $use_campaign_dnc = $row[2]; + $api_manual_dial = $row[3]; if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) ) { - $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + $stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00156',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5152,6 +6555,13 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00158',$user,$server_ip,$session_name,$one_mysql_log);} } + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="DELETE from vicidial_manual_dial_queue where user='$user' and status='QUEUE';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00363',$user,$server_ip,$session_name,$one_mysql_log);} + } ####### START Vtiger Call Logging ####### $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; @@ -5187,7 +6597,7 @@ if ($ACTION == 'updateDISPO') if ( (ereg('ACCTID',$vtiger_search_category)) or (ereg('ACCOUNT',$vtiger_search_category)) ) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5199,7 +6609,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5340,7 +6750,7 @@ if ($ACTION == 'updateDISPO') if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00205',$user,$server_ip,$session_name,$one_mysql_log);} #Insert values into vtiger_activity - $stmt = "INSERT INTO vtiger_activity SET activityid='$activityid',subject='VC Call: $status_name',activitytype='Call',date_start='$TODAY',due_date='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL Пользователь $user',notime='0',visibility='Public',recurringtype='--None--';"; + $stmt = "INSERT INTO vtiger_activity SET activityid='$activityid',subject='VC Call: $status_name',activitytype='Call',date_start='$TODAY',due_date='$TODAY',time_start='$HHMMnow',time_end='$HHMMend',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL Агент $user',notime='0',visibility='Public',recurringtype='--None--';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $linkV); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkV,$mel,$stmt,'00206',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5543,7 +6953,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,queuemetrics_dispo_pause,queuemetrics_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00159',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5557,35 +6967,116 @@ if ($ACTION == 'updateDISPO') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_callstatus = $row[6]; + $queuemetrics_dispo_pause = $row[7]; + $queuemetrics_pe_phone_append = $row[8]; } ##### 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); if (strlen($stage) < 2) {$stage = $campaign;} - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + $qm_dispo_codeSQL=''; + if (strlen($qm_dispo_code) > 0) + {$qm_dispo_codeSQL = ",data3='$qm_dispo_code'";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id' $qm_dispo_codeSQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00160',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); + ### check to make sure a COMPLETE record is present for this call + $QLcomplete_records=0; + $stmt = "SELECT count(*) FROM queue_log where verb IN('COMPLETEAGENT','COMPLETECALLER') and call_id='$MDnextCID' and agent='Agent/$user' and queue='$stage';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00409',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $comp_ct = mysql_num_rows($rslt); + if ($comp_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_records = $row[0]; + } + + ### if there are no complete records, look up information to insert one for this call + if ($QLcomplete_records < 1) + { + $QLconnect_time=$StarTtime; + $QLcomplete_time=$StarTtime; + $QLconnect_one=''; + $QLconnect_four=''; + $QLcomplete_position=1; + + $stmt = "SELECT time_id,data1,data4 FROM queue_log where verb='CONNECT' and call_id='$MDnextCID' and agent='Agent/$user' and queue='$stage' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00410',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $connect_ct = mysql_num_rows($rslt); + if ($connect_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLconnect_time = $row[0]; + $QLconnect_one = $row[1]; + $QLconnect_four = $row[2]; + } + + $stmt = "SELECT time_id FROM queue_log where verb='PAUSEREASON' and call_id='$MDnextCID' and agent='Agent/$user' and data1='$queuemetrics_dispo_pause' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00411',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $pausereason_ct = mysql_num_rows($rslt); + if ($pausereason_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_time = $row[0]; + } + + $QLcomplete_length = ($QLcomplete_time - $QLconnect_time); + if ($QLcomplete_length < 0) {$QLcomplete_length=0;} + if ($QLcomplete_length > 86400) {$QLcomplete_length=1;} + + ## if inbound, check for initial queue position + if (preg_match("/^Y/",$MDnextCID)) + { + $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); + + $stmt = "SELECT queue_position FROM vicidial_closer_log where lead_id='$lead_id' and campaign_id='$stage' and call_date > \"$four_hours_ago\" 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,'00412',$user,$server_ip,$session_name,$one_mysql_log);} + $vcl_ct = mysql_num_rows($rslt); + if ($vcl_ct > 0) + { + $row=mysql_fetch_row($rslt); + $QLcomplete_position = $row[0]; + } + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$QLcomplete_time',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='COMPLETEAGENT',data1='$QLconnect_one',data2='$QLcomplete_length',data3='$QLcomplete_position',serverid='$queuemetrics_log_id',data4='$QLconnect_four';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00413',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } + 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; $talk_time_ms=0; $talk_time_min=0; - if (eregi('--A--user_custom_',$dispo_call_url)) + if ( (eregi('--A--user_custom_',$dispo_call_url)) or (eregi('--A--fullname',$dispo_call_url)) ) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $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,'00288',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5593,17 +7084,18 @@ if ($ACTION == 'updateDISPO') if ($VUC_ct > 0) { $row=mysql_fetch_row($rslt); - $user_custom_one = urlencode(trim($row[0])); - $user_custom_two = urlencode(trim($row[1])); - $user_custom_three = urlencode(trim($row[2])); - $user_custom_four = urlencode(trim($row[3])); - $user_custom_five = urlencode(trim($row[4])); + $user_custom_one = urlencode(trim($row[0])); + $user_custom_two = urlencode(trim($row[1])); + $user_custom_three = urlencode(trim($row[2])); + $user_custom_four = urlencode(trim($row[3])); + $user_custom_five = urlencode(trim($row[4])); + $fullname = urlencode(trim($row[5])); } } if (eregi('--A--talk_time',$dispo_call_url)) { - $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + $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,'00289',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5630,7 +7122,7 @@ if ($ACTION == 'updateDISPO') if (eregi('--A--dispo_name--B--',$dispo_call_url)) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00297',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5638,11 +7130,11 @@ if ($ACTION == 'updateDISPO') if ($vs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00298',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5650,17 +7142,89 @@ if ($ACTION == 'updateDISPO') if ($vcs_name_ct > 0) { $row=mysql_fetch_row($rslt); - $status_name = $row[0]; + $status_name = urlencode(trim($row[0])); } } 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 = urlencode(trim($row[0])); + $DID_description = urlencode(trim($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";} @@ -5698,6 +7262,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); @@ -5733,9 +7298,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); @@ -5765,10 +7330,81 @@ 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); + $dispo_call_url = eregi_replace('--A--call_id--B--',urlencode(trim($MDnextCID)),$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 = urlencode(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++; + } + } + } + + $stmt="UPDATE vicidial_log_extended set dispo_url_processed='Y' where uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00423',$user,$server_ip,$session_name,$one_mysql_log);} + $vle_update = mysql_affected_rows($link); + + ### insert a new url log entry + $SQL_log = "$dispo_call_url"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='dispo',url='$SQL_log',url_response='';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00424',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $url_id = mysql_insert_id($link); + + $URLstart_sec = date("U"); + + ### send dispo_call_url ### if ($DB > 0) {echo "$dispo_call_url
\n";} $SCUfile = file("$dispo_call_url"); if ($DB > 0) {echo "$SCUfile[0]
\n";} + ### update url log entry + $URLend_sec = date("U"); + $URLdiff_sec = ($URLend_sec - $URLstart_sec); + $SCUfile_contents = implode("", $SCUfile); + $SCUfile_contents = ereg_replace(';','',$SCUfile_contents); + $SCUfile_contents = addslashes($SCUfile_contents); + $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00425',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + + $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00296',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5787,8 +7423,95 @@ 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); + } + } } - echo 'Lead ' . $lead_id . ' был изменен на ' . $dispo_choice . " Статус\nNext agent_log_id:\n" . $agent_log_id . "\n"; + ############################################ + ### 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); + } + + # debug testing sleep + # sleep(5); + + echo 'Lead ' . $lead_id . ' был изменен на ' . $dispo_choice . " Состояние\nNext agent_log_id:\n" . $agent_log_id . "\n"; } ################################################################################ @@ -5803,7 +7526,7 @@ if ($ACTION == 'updateLEAD') $DO_NOT_UPDATE_text=''; if ( (strlen($phone_number)<1) || (strlen($lead_id)<1) ) { - echo "phone_number $phone_number or lead_id $lead_id это неправильно\n"; + echo "phone_number $phone_number or lead_id $lead_id неверный\n"; exit; } else @@ -5904,7 +7627,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $row=''; $rowx=''; if ( (strlen($stage)<2) || (strlen($server_ip)<1) ) { - echo "stage $stage это неправильно\n"; + echo "stage $stage неверный\n"; exit; } else @@ -5929,7 +7652,12 @@ 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";} + if ($ACTION == 'VDADpause') + {$vla_ring_resetSQL = ",ring_callerid=''";} + $stmt="UPDATE vicidial_live_agents set status='$stage' $vla_lead_wipeSQL $vla_ring_resetSQL 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);} @@ -5948,7 +7676,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00167',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5963,6 +7691,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -5986,7 +7715,22 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $user_group = trim("$row[0]"); } - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00395',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00168',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5997,7 +7741,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) } $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6085,7 +7829,17 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $VLAaffected_rows_update = mysql_affected_rows($link); } } - echo 'Agent ' . $user . ' новый статус ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n"; + if (strlen($sub_status) > 0) + { + ### if a pause code(sub_status) is sent with this pause request, continue на to that action without printing output + $stage = 0; + $status = $sub_status; + $ACTION = 'PauseCodeSubmit'; + } + else + { + echo 'Agent ' . $user . ' теперь находится в состоянии ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n"; + } } @@ -6098,12 +7852,12 @@ if ($ACTION == 'UpdatEFavoritEs') $channel_live=1; if ( (strlen($favorites_list)<1) || (strlen($user)<1) || (strlen($exten)<1) ) { - echo "favorites list $favorites_list это неправильно\n"; + echo "favorites list $favorites_list неверный\n"; exit; } else { - $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + $stmt = "SELECT count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00172',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6136,7 +7890,7 @@ if ($ACTION == 'PauseCodeSubmit') $row=''; $rowx=''; if ( (strlen($status)<1) || (strlen($agent_log_id)<1) ) { - echo "agent_log_id $agent_log_id or pause_code $status это неправильно\n"; + echo "agent_log_id $agent_log_id or pause_code $status неверный\n"; exit; } else @@ -6144,7 +7898,7 @@ if ($ACTION == 'PauseCodeSubmit') ### if this is the first pause code entry in a pause session, simply update and log to queue_log if ($stage < 1) { - $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; + $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id >= '$agent_log_id' and user='$user' and ( (sub_status is NULL) or (sub_status='') )order by agent_log_id limit 2;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00175',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6154,10 +7908,10 @@ if ($ACTION == 'PauseCodeSubmit') else { $pause_sec=0; - $stmt = "select pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00305',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -6167,12 +7921,12 @@ if ($ACTION == 'PauseCodeSubmit') $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00307',$user,$server_ip,$session_name,$one_mysql_log);} $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00309',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00308',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -6184,14 +7938,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); } @@ -6200,7 +7954,7 @@ if ($ACTION == 'PauseCodeSubmit') { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00176',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -6216,6 +7970,7 @@ if ($ACTION == 'PauseCodeSubmit') $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $allow_sipsak_messages = $row[6]; + $queuemetrics_pe_phone_append = $row[7]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -6227,10 +7982,12 @@ if ($ACTION == 'PauseCodeSubmit') } if ($enable_queuemetrics_logging > 0) { + $pause_call_id='NONE'; + if (strlen($campaign_cid) > 12) {$pause_call_id = $campaign_cid;} $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/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$pause_call_id',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00177',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6289,6 +8046,8 @@ if ($ACTION == 'AGENTSview') echo ""; ### Gather agents data and statuses + $agentviewlistSQL=''; + $j=0; $stmt="SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user $AGENTviewSQL order by vu.full_name;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -6302,6 +8061,7 @@ if ($ACTION == 'AGENTSview') $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; + $agentviewlistSQL .= "'$user',"; if ( ($status=='READY') or ($status=='CLOSER') ) { @@ -6337,10 +8097,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 { @@ -6353,8 +8115,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"; + echo "    -ОЖИДАНИЕ      -ВЫЗОВ      -ПАУЗА  \n"; + if (ereg("NOT-LOGGED-IN-AGENTS",$agent_status_viewable_groups)) + {echo "    -LOGGED-OUT  \n";} echo "\n"; } @@ -6375,7 +8218,7 @@ if ($ACTION == 'CALLSINQUEUEview') if (eregi('NONE',$view_calls_in_queue)) { - echo "Звонки в Очередь Открыть инвалидов для этой кампании\n"; + echo "Для этой кампании просмотр вызовов в очереди запрещен\n"; exit; } else @@ -6552,6 +8395,1358 @@ 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     ВЫЗОВ  
Нет звонков в этот день
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Закрыть журнал вызовов"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Вернуться"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Результаты Найдено: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set секунд='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     СОСТОЯНИЕ     LAST ВЫЗОВ     CITY     STATE     ZIP     INFO     ВЫЗОВ  
Ничего не найдено
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Ничего не найдено
"; + echo "
"; + echo "Вернуться"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Вернуться"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Кампания not found\n"; + echo "

"; + echo "Вернуться"; + echo "
"; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Вернуться"; + echo "
"; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Результаты Найдено: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set секунд='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Ничего не найдено
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Ничего не найдено
"; + echo "
"; + echo "Вернуться"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Вернуться"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Кампания not found\n"; + echo "

"; + echo "Вернуться"; + echo "
"; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Ответный статус:   $row[0]
Обратный вызов ведущий статус:   $row[7]
Время обратного вызова Вступление:   $row[1]
Обратный вызов Trigger время:   $row[2]
Ответный Комментарии:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $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 = 'Код п.'; + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "телефон and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Телефон Код города Вне зоны Dialable $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Индекс Вне зоны Dialable $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Телефон Код города Вне зоны Dialable $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " Индекс Вне зоны Dialable $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Состояние:   $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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$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]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
Журнал вызовов У объявления:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     СОСТОЯНИЕ     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Нет звонков найден
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6567,17 +9762,17 @@ if ($ACTION == 'CALLSINQUEUEgrab') if ( (eregi('NONE',$view_calls_in_queue)) or (eregi('N',$grab_calls_in_queue)) ) { - echo "ERROR: Звонки в Очередь Открыть инвалидов для этой кампании\n"; + echo "ERROR: Для этой кампании просмотр вызовов в очереди запрещен\n"; exit; } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_ru/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_ru/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_ru/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_ru/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_ru/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_ru/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_ru/vdc_script_notes.php new file mode 100644 index 00000000..4c802e14 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_ru/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 = 'Код п.'; +$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/agc_2-X/trunk/LANG_www/agc_ru/vicidial.php b/agc_2-X/trunk/LANG_www/agc_ru/vicidial.php index 5259eeae..df1d84c2 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -398,38 +507,96 @@ $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 + $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 +$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 Разъединить Клиента +$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 +$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 +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of секунд to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location на the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### 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 = 'Код п.'; +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -511,7 +686,7 @@ if ($campaign_login_list > 0) $SQL_log = "$stmt|"; $SQL_log = ereg_replace(';','',$SQL_log); $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='МЕНЕДЖЕР Переопределить OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';"; + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='УКАЗАТЬ ДРУГОГО НАЧАЛЬНИКА OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01060',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,443 +12720,790 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -ВЫХОД\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Живой Вызов
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Вход от имени + ring)";} + echo "  в кампании: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + ВЫХОД\n"; ?> +
- -РУЧНОЙ НАБОР НОМЕРА       БЫСТРЫЙ НАБОР НОМЕРА
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Активный звонок
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + СОСТОЯНИЕ:
+
+ Позвонить по следующему номеру
+ + + ПРЕДПРОСМОСТР СВЕДЕНИЙ О НОМЕРЕ
+ НАБОР ДОП.НОМЕРА
+ + ФАЙЛ ЗАПИСИ:
+
+
+ КОД ЗАПИСИ:
+
+ + Начать запись
+
+ Веб-форма
+ 0) + {echo "\"Веб-форма
\n";} + ?> +  
+ Запарковать вызов
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Перевод - конференция
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Пользовательские
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Завершить вызов
+
+
Набор DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  Время клиентов:                         Линия:
Сведения о клиенте:         + ВЕСТИ ПОИСК";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Вызовите Примечания: "; + if ($agent_call_log_view == '1') + {echo "
просмотра заметок ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+
+
+ + + + + +РУЧНОЙ НАБОР       БЫСТРЫЙ НАБОР
- -X АКТИВНЫЕ ВЫЗОВBACK
+ +
- -
+ +View Call LOG
- секунды: -     + +     + + + +
ВЕРСИЯ:   СБОРКА:     Сервер:              
+ + Показать сведения о линии конференции +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +КЛАВИШИ КОДОВ ВЫКЛЮЧЕНЫ + + + секунд: +    
- +
+
+ + +Ваше состояние:
Calls Dialing: +
+ + D1 - НАБОР НОМЕРА\n"; - echo "
\n"; - echo "D2 - НАБОР НОМЕРА\n"; + echo "D1 - ВЫЗОВ\n"; + echo "   \n"; + echo "D2 - ВЫЗОВ\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
ВЫЗОВBACK ДЛЯ ОПЕРАТОРА :
Чтобы позвонить клиенту сейчас, кликните на callback ниже. Если Вы нажмете на record ниже, чтобы позвонить, то это будет удалено из списка. -
-
-
  - Обновление -                 - Вернуться -
-
+
 Вызовы в очереди:  
 
- - height=>
НОВЫЙ LEAD РУЧНОЙ НАБОР НОМЕРА ДЛЯ :

Ведите информацию ниже для нового lead который вы хотите вызвать. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Код страны:   (Обычно 7 для России и некоторых стран СНГ)
Телефон Number: -   (12 digits max - digits only) -
Поиск Существующих Leads:   (Если эта опция выбрана, то будет предпринята попытка найти телефонный номер в системе, прежде чем вставить его как новый lead)
-

-     -
-

Если вы хотите набрать номер, но не добовлять новый lead, введите точный dialstring который вы хотите вызвать в поле Отмены Номера ниже. Для разъединения этого запроса вы должны будете открыть ссылку ЗАПРОСЫ В ЭТОЙ СЕССИИ внизу экрана, at the bottom of the screen and hang it up by clicking на its channel link there.
 
Отмененный набор номера:   (только цифры, пожалуйста) -
-
- Новый Набор номера -                 - Предварительный Звоните -                 - Вернуться -
-
- - - -
-
- - - - -Ваш Статус:
Calls Dialing: -
- - - - - > - - -
-
- - Перевод - Конференция            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - ЛОКАЛЬНЫЙ CLOSER     - - Разъединение Xfer Линии -
- seconds -   - channel - - КОНСУЛЬТАТИВНЫЙ   - - Разъединить Обе Линии -
- Номер для вызова -   -   - агенты - - - НАБЕРИТЕ ОТМЕНУ - - ОСТАВИТЬ 3-WAY ЗАПРОС -
- Слепой Перевод Набора номера -   - Набор номера С Клиентом -   - Парковать Набор номера Клиента -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Звонки в очередь:  
 
- - + 0) { if ($view_calls_in_queue_launch > 0) - {echo "Скрыть Звонки в очередь\n";} + {echo "Спрятать вызовы в очереди\n";} else - {echo "Показать Звонки в очередь\n";} + {echo "Показать вызовы в очереди\n";} } ?> + +X АКТИВНЫЕ ОБРАТНЫЕ ВЫЗОВЫ
+
-
  -Другие агенты Статус:  
 
+
  +Состояние других агентов:  
 
-
-Доступные Агенты передачи:
+$webphone_content
\n"; + } +else + { + echo "
  + Web телефон:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
Список агентов +
+ + + +
  Webтелефон View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "Dialable снабжении:
 \n"; } ?>
- + - - - height=70> - -
Lead Диспозицию как:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - - +
Горячие Клавиши Диспозиции: - Когда активно, просто нажмите клавишу желаемой диспозиции для этого запроса. Тогда запрос будет автоматически разъединен и dispositioned:
+ +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Перевод - конференция            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + МЕСТНОЕ ЗАВЕРШЕНИЕ     + + Отключить линию перевода +
+ seconds +   + channel + + СОВЕЩАТЕЛЬНЫЙ   + + Отключить обе линии +
+ Вызываемый номер +   + +                     + +   + + АГЕНТЫ + + + + + НАБОР ДРУГОГО НОМЕРА + + Покинуть трехсторонний вызов +
+ Перевести вслепую +   + Набрать с клиентом +   + Запарковать вызов клиента +   + + Кнопка Presets + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Перевод доступным агентам:
+ + + + + +
Вызов завершен с кодом:

+ -
+
+
+ + + + + - + - + -
Клавиши кодов завершения: + Если включено, просто нажмите клавишу выбора кода завершения. Вызов будет завершен автоматически:
- + - + -
+
- - height=70> - - - + +
Предыдущая Информация о Callback: close
+ + + - - + -
Сведения о предыдущем обратном вызове: close
-
-
-
-
+ +
+
+
+
-
+
- - height=70> - - - + +
Расширенная информация Alt Телефон: минимизировать
+ + + - - + -
Расширенные сведения о дополнительном номере: уменьшить
-
-
-
-
+
+
+
+
+
-
+
- - - - -
максимизировать
Alt Телефон Info
+ + + + +
увеличить
Alt телефон Info
- - height=>
Никого нет в вашей сессии:
+ +
No one is in your session:
Вернуться -

- Вызов Оператора Снова -
+

+ Снова вызвать агента +
- - height=>
Клиент разъединен:
+ +
Клиент повесил трубку:
Вернуться -

- Конец и Вызов Диспозиции -
+

+ Завершить вызов с кодом +
- - height=>
Call Wrapup: секунд осталось в wrapup

+ +
Передышка: секунд до окончание передышки

-

- Финиш Wrapup и Переход -
+

+ Окончить передышку и продолжить +
- -
-


+ +
+


Закрыть сообщение -
+
- - height=>
Ваша сессия отключена
ВЫХОД

Вернуться -
+ +
Ваша сессия отключена
ВЫХОД

Вернуться +
- - height=>
Существует проблема синхронизации времени с вашей системой, пожалуйста, сообщите об этом вашему системному администратору


Вернуться -
+ +
В вашей системе есть ошибки синхронизации времени, сообщите, пожалуйста, своему системному администратору


Вернуться +
- - height=>

ВЫХОД
+ +

ВЫХОД
- -
+ +
- -
 
+ +
 
- - height=47>
Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call.
+ +
Любые изменения в сведениях о клиенте, произведенные в настоящий момент не будут сохранены. Это нужно делать до завершения вызова.
- - height=>
DISPOSITION ВЫЗОВ :       Разъединить Снова       минимизировать
- Выбор Диспозиции End-of-call -
- ПАУЗА ВЫЗОВА
+ +
ЗАВЕРШИТЬ ВЫЗОВ :       Снова завершить вызов       уменьшить
+
\n";} + ?> + + + + Выбор кода завершения по окончании вызова +
+ ПРИОСТАНОВИТЬ ДОЗВОН АГЕНТА
ОЧИСТИТЬ ФОРМУ | - SUBMIT -

- WEB FORM SUBMIT -

  -
+ ВВОД +

+ WEB FORM ВВОД +

  +
- - height=>
ВЫБЕРИТЕ КОД ПАУЗЫ :
- Пауза Code Selection - -

  -
-
- - - height=>
ВЫБОР ГРУППЫ ALIAS :
- Группа Alias выбора - -

  -
-
- - - - - - height=>
Выберите дату для CallBack :
- - - Выберите Дату Ниже   + +
Выбрать дату обратного звонка :
+
\n";} + ?> + + + Выберите дату ниже       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
ТОЛЬКО МОИ ВЫЗОВBACK
";} + {echo " ТОЛЬКО МОИ ОБРАТНЫЕ ВЫЗОВЫ
";} ?> - CB Комментарии:

+ Примечания:

- SUBMIT

+ ВВОД

-

  -
+

  +
- - height=>
ВЫБОР INBOUND ГРУППЫ CLOSER
- Closer Inbound Group Selection -
+ +
ОБРАТНЫЕ ВЫЗОВЫ АГЕНТА :
Чтобы посмотреть информацию об одном из обратного вызова ниже, нажмите на ссылку INFO. Чтобы позвонить клиенту обратно сейчас, нажмите на ссылку ВЫЗОВ. Если вы нажмете на запись ниже, чтобы набрать его, то он будет удален из списка. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Обновить +                 + Вернуться +
+
+ + +
НОВЫЙ РУЧНОЙ НАБОР НОМЕРА ДЛЯ :

Введите сведения о номере, который Вы хотите вызвать. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Код набора:   (В США и Канаде это обычно единица)
телефон Number: +   (digits only) + + + +
Искать в имеющихся номерах:   (При включении этой функции перед добавлением номера в качестве нового, его наличие в системе перепроверяется)
+

+     +
+

Если Вы хотите набрать номер, но не добавлять его в буфер, введите полный номер, который хотите вызвать, в поле ВВОД ДРУГОГО НОМЕРА ниже. Чтобы завершить этот вызов, Вам придется открыть ссылку ВЫЗОВЫ В ЭТОЙ СЕССИИ снизу на экране и завершить его кликом по ссылке на соответствующую линию.
 
Ввод другого номера:   (только цифры, пожалуйста) +
+
+ Вызвать немедленно +                 + Предпросмотр сведений о вызове +                 + Вернуться +
+
+ + +
ВЫБОР ВХОДЯЩЕЙ ГРУППЫ
+
\n";} + ?> + Выбор входящей группы +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - BLENDED ВЫЗОВING(исходящие активированы)
+ Смешанный дозвон(исходящие активированы)
- RESET | - SUBMIT -



  -
+ СБРОС | + ВВОД +



  +
- - height=>
TERRITORY SELECTION
+ +
ВЫБОР ТЕРРИТОРИИ
+
\n";} + ?> Territory Selection -
- RESET | - SUBMIT -



  -
+
+ СБРОС | + ВВОД +



  +
- - - Канал - Канал + + Линия + Линия ТОЛЬКО МОИ ВЫЗОВBACK
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " BLENDED ВЫЗОВING
";} + {echo " ТОЛЬКО МОИ ОБРАТНЫЕ ВЫЗОВЫ
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " Смешанный дозвон
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT ВЫЗОВ LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Поиск контакта:             close [X]
+
\n";} + ?> +

+ Примечание: при выполнении поиска контакта, шаблона или частичное условия поиска не допускается.
Просьбы связаться с поиска всех зарегистрированных в системе. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Имя Name:
Фамилия Name:
BU Name:
Department:
Group Name:
Job Должность:
Location:

ВВОД SEARCH             восстановить форму
+

  +
+
+ + +
      Результаты КОНТАКТЫ ПОИСК:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      ПОИСК LEAD:             close [X]
+
\n";} + ?> +

+ Примечание: при выполнении поиска для свинца, номер телефона, или привести ID самые лучшие поля для использования.
Использование других областях может быть медленным. Ведущий поиски не позволяет шаблону или частичное условия поиска.
Ведущие поисковые запросы все вошли в систему. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
телефон Number:
телефон Number Fields: + Основной номер телефона + Альтернативный номер телефона + Адрес3 номер телефона +
Lead ID:
:
:
:
:
:
:

ВВОД SEARCH             восстановить форму
+

  +
+
+ + +
      РЕЗУЛЬТАТЫ ПОИСКА:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Call Примечания LOG:             close [X]
+
\n";} + ?> +
Call Примечания список
+

  + Закрыть Box информация +
+
+ + +
      Сведения о клиенте:             close [X] +
+
\n";} + ?> + Lead Info +

  + Закрыть Box информация +
+
+ + +
УКАЖИТЕ КОД ПАУЗЫ :
+
\n";} + ?> + Пауза Code Selection + +

  +
+
+ + +
Выбор занесенных в памяти :
+
\n";} + ?> + Presets Selection + +
+
+ + +
ВЫБРАТЬ ПСЕВДОНИМ ГРУППЫ :
+
\n";} + ?> + Выбор превдонима группы + +

  +
+
+ + +
ALERT :
+     +

Вернуться +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -НЕАКТИВНЫЕ ГОРЯЧИЕ КЛАВИШИ - + + + - -> +
Agent web-client version:     СБОРКА:               Сервер:              
- -Показать информацию о канале конференц-связи -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
СТАТУС:
-
-Набрать следующий номер
- ПРЕДВАРИТЕЛЬНЫЙ ПРОСМОТР LEAD
- НАБРАТЬ АЛЬТ. НОМЕР
- - -ФАЙЛ ЗАПИСИ:
-
-
-ID ЗАПИСИ:
-
- -Начать Запись
-
-Web Форма
- 0) - {echo "\"Web
\n";} -?> -
-Парковать Вызов
-Перевод - Конференция
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Разъединить Клиента
-
-
Послать DTMF

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Канал:
Информация Клиента:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Title:   Имя:   MI:   Фамилия:
Адрес1:
Адрес2: Адрес3:
Город: Округ: Индекс:
Область/Край: ID Вендора: Пол:
Телефон: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -Код: Альт. Телефон:
Показать: Email:
Комментарии: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_ru/voicemail_check.php b/agc_2-X/trunk/LANG_www/agc_ru/voicemail_check.php index 08966144..6d6491ff 100644 --- a/agc_2-X/trunk/LANG_www/agc_ru/voicemail_check.php +++ b/agc_2-X/trunk/LANG_www/agc_ru/voicemail_check.php @@ -62,7 +62,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) { - echo "Недопустимо Username/Пароль: |$user|$pass|\n"; + echo "Неверный Имя агента/Пароль: |$user|$pass|\n"; exit; } else @@ -70,7 +70,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { - echo "Недопустимо server_ip: |$server_ip| or Недопустимо session_name: |$session_name|\n"; + echo "Неверный server_ip: |$server_ip| or Неверный session_name: |$session_name|\n"; exit; } else @@ -82,7 +82,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;} $SNauth=$row[0]; if($SNauth==0) { - echo "Недопустимо session_name: |$session_name|$server_ip|\n"; + echo "Неверный session_name: |$session_name|$server_ip|\n"; exit; } else @@ -97,7 +97,7 @@ if ($format=='debug') echo "\n"; echo "\n"; echo "\n"; -echo "Проверка Voicemail"; +echo "<title>Проверка голосовой почты"; echo "\n"; echo "\n"; echo "\n"; @@ -108,7 +108,7 @@ echo " if (strlen($vmail_box)<1) { $channel_live=0; - echo "voicemail box $vmail_box это неправильно\n"; + echo "ящик голосовой почты $vmail_box неверный\n"; exit; } else @@ -132,7 +132,7 @@ if ($format=='debug') { $ENDtime = date("U"); $RUNtime = ($ENDtime - $StarTtime); - echo "\n"; + echo "\n"; echo "\n\n\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_se/active_list_refresh.php b/agc_2-X/trunk/LANG_www/agc_se/active_list_refresh.php index 605edadc..db2c69d8 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/active_list_refresh.php +++ b/agc_2-X/trunk/LANG_www/agc_se/active_list_refresh.php @@ -160,7 +160,7 @@ if ($format=='table') { echo "\n"; echo "\n"; -echo "\n"; +echo "\n"; echo "Visa Lista: "; if ($ADD==1) {echo "Aktiva anknytningar";} if ($ADD==2) {echo "Upptagna anknytningar";} diff --git a/agc_2-X/trunk/LANG_www/agc_se/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_se/astguiclient.php index a26a8a2d..e5faaf63 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_se/astguiclient.php @@ -1,7 +1,7 @@ <?php # astguiclient.php - the web-based version of the astGUIclient client application # -# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -168,7 +169,7 @@ echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/astguicli echo "<TR><TD ALIGN=RIGHT>Telefonlösenord: </TD>"; echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"$phone_pass\"></TD></TR>\n"; echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=SKICKA VALUE=SKICKA></TD></TR>\n"; - echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version       SKAPA: $build</TD></TR>\n"; + echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version       BUILD: $build</TD></TR>\n"; echo "</TABLE>\n"; echo "</FORM>\n\n"; echo "</body>\n\n"; @@ -188,7 +189,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -196,7 +197,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -207,7 +208,7 @@ header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 echo "<html>\n"; echo "<head>\n"; -echo "<!-- VERSION: $version SKAPA: $build ADD: $ADD-->\n"; +echo "<!-- VERSION: $version BUILD: $build ADD: $ADD-->\n"; if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) { @@ -231,7 +232,7 @@ echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=phone_login SIZE=10 maxlength=20 VALU echo "<TR><TD ALIGN=RIGHT>Telefonlösenord: </TD>"; echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"$phone_pass\"></TD></TR>\n"; echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=SKICKA VALUE=SKICKA></TD></TR>\n"; -echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version       SKAPA: $build</TD></TR>\n"; +echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version       BUILD: $build</TD></TR>\n"; echo "</TABLE>\n"; echo "</FORM>\n\n"; echo "</body>\n\n"; @@ -268,7 +269,7 @@ echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/astguicli echo "<TR><TD ALIGN=RIGHT>Telefonlösenord: </TD>"; echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"$phone_pass\"></TD></TR>\n"; echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=SKICKA VALUE=SKICKA></TD></TR>\n"; - echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version       SKAPA: $build</TD></TR>\n"; + echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version       BUILD: $build</TD></TR>\n"; echo "</TABLE>\n"; echo "</FORM>\n\n"; echo "</body>\n\n"; @@ -954,7 +955,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} } // ################################################################################ -// Send Redirect command for live call to Managersends phone name where call is going to +// Send Redirect command for live call to Manager sends phone name where call is going to function mainxfer_send_redirect(taskvar,taskxferconf) { var xmlhttp=false; @@ -1047,7 +1048,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} // ################################################################################ -// Send Originate command for local dial to Managersends phone name where call is going to +// Send Originate command for local dial to Manager sends phone name where call is going to function mainxfer_send_originate(taskvar,taskxferconf,taskentrypop) { var xmlhttp=false; @@ -1534,7 +1535,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";} var conv_start=0; if (out_calls > 0) { - var out_log_HTML = "<table width=580><tr bgcolor=#E6E6E6><td><font class=\"log_title\">#</td><td><font class=\"log_title\"> SAMTALSDATUM\/TID</td><td><font class=\"log_title\">NUNNER</td><td align=right><font class=\"log_title\">LENGTH (M:SS)</td><td><font class=\"log_title\"> </td></tr>" + var out_log_HTML = "<table width=580><tr bgcolor=#E6E6E6><td><font class=\"log_title\">#</td><td><font class=\"log_title\"> SAMTALSDATUM\/TID</td><td><font class=\"log_title\">NUMMER</td><td align=right><font class=\"log_title\">LENGTH (M:SS)</td><td><font class=\"log_title\"> </td></tr>" while (loop_ct < out_calls) { loop_ct++; @@ -2805,7 +2806,7 @@ echo "</head>\n"; <tr><td align=center><div class="scroll_log" id="outboundcallsspan"></div></td></tr> <tr><td align=center><font face="Arial,Helvetica"><B>INGÅENDE SAMTAL:</B></font></td></tr> <tr><td align=center><div class="scroll_log" id="inboundcallsspan"></div></td></tr> -<tr><td align=left><font face="Arial,Helvetica" size=1>astGUI webklientversion:<?php echo $version ?> SKAPA:<?php echo $build ?></font></td></tr> +<tr><td align=left><font face="Arial,Helvetica" size=1>astGUI webklientversion:<?php echo $version ?> BUILD:<?php echo $build ?></font></td></tr> </TABLE> <span style="position:absolute;left:640px;top:0px;z-index:33;" id="FavoriteSBox"> diff --git a/agc_2-X/trunk/LANG_www/agc_se/calendar.css b/agc_2-X/trunk/LANG_www/agc_se/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_se/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/agc_2-X/trunk/LANG_www/agc_se/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_se/calendar_db.js new file mode 100644 index 00000000..4e2aa492 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_se/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' : ['Januari', 'February', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December'], + '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 ("Felaktig 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 ("Felaktig 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("Felaktig 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('<img src="' + a_tpl.imgpath + 'cal.gif" id="' + this.s_iconId + '" onclick="A_TCALS[\'' + this.s_id + '\'].f_toggle()" class="tcalIcon" alt="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 = '<table class="ctrl"><tbody><tr>' + + (this.a_tpl.yearscroll ? '<td' + this.f_relDate(d_date, -1, 'y') + ' title="Previous Year"><img src="' + this.a_tpl.imgpath + 'prev_year.gif" /></td>' : '') + + '<td' + this.f_relDate(d_date, -1) + ' title="Previous Month"><img src="' + this.a_tpl.imgpath + 'prev_mon.gif" /></td><th>' + + this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear() + + '</th><td' + this.f_relDate(d_date, 1) + ' title="Next Month"><img src="' + this.a_tpl.imgpath + 'next_mon.gif" /></td>' + + (this.a_tpl.yearscroll ? '<td' + this.f_relDate(d_date, 1, 'y') + ' title="Next Year"><img src="' + this.a_tpl.imgpath + 'next_year.gif" /></td></td>' : '') + + '</tr></tbody></table><table><tbody><tr class="wd">'; + + // print weekdays titles + for (var i = 0; i < 7; i++) + s_html += '<th>' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + '</th>'; + s_html += '</tr>' ; + + // 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 +='<tr>'; + 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 += '<td onclick="A_TCALS[\'' + this.s_id + '\'].f_hide(' + d_current.valueOf() + ')"' + (a_class.length ? ' class="' + a_class.join(' ') + '">' : '>') + n_date + '</td>' + + 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 +='</tr>'; + } + s_html +='</tbody></table>'; + + // 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 + ? '<table><tbody><tr><td rowspan="2" colspan="2" width="6"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td width="7" height="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_tr.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tr><td height="' + (n_height - 7) + '" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_mr.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tr><td width="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_bl.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_bm.png\', sizingMethod=\'scale\');" height="7" align="left"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_br.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tbody></table>' + : '<table><tbody><tr><td rowspan="2" width="6"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td rowspan="2"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td width="7" height="7"><img src="' + this.a_tpl.imgpath + 'shade_tr.png"></td></tr><tr><td background="' + this.a_tpl.imgpath + 'shade_mr.png" height="' + (n_height - 7) + '"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tr><td><img src="' + this.a_tpl.imgpath + 'shade_bl.png"></td><td background="' + this.a_tpl.imgpath + 'shade_bm.png" height="7" align="left"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td><img src="' + this.a_tpl.imgpath + 'shade_br.png"></td></tr><tbody></table>'; + + 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/agc_2-X/trunk/LANG_www/agc_se/call_log_display.php b/agc_2-X/trunk/LANG_www/agc_se/call_log_display.php index 00f96202..1d6a1ebc 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/call_log_display.php +++ b/agc_2-X/trunk/LANG_www/agc_se/call_log_display.php @@ -108,7 +108,7 @@ if ($format=='debug') { echo "<html>\n"; echo "<head>\n"; -echo "<!-- VERSION: $version SKAPA: $build EXTEN: $exten server_ip: $server_ip-->\n"; +echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n"; echo "<title>Visa samtalslogg"; echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/LANG_www/agc_se/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_se/conf_exten_check.php index 3016acc7..fc4af128 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_se/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $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 "Felaktig Användarnamn/Lösenord: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Felaktig server_ip: |$server_ip| or Felaktig session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Kolla konfanknytningen"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Kolla konfanknytningen"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten är ej giltig\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check på calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Samtal i kö: $RingCalls";} + else {$RingCalls = "Samtal i kö: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check på calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Samtal i kö: $RingCalls";} - else {$RingCalls = "Samtal i kö: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $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 . '|Status: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten är ej giltig or Exten $exten är ej giltig\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Konferens $conf_exten har blivit registrerad $exten\n"; + echo "Konferens $conf_exten har blivit registrerad $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_se/functions.php b/agc_2-X/trunk/LANG_www/agc_se/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_se/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_se/inbound_popup.php b/agc_2-X/trunk/LANG_www/agc_se/inbound_popup.php index 824bf4cc..9b0b4560 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/inbound_popup.php +++ b/agc_2-X/trunk/LANG_www/agc_se/inbound_popup.php @@ -125,7 +125,7 @@ while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) echo "\n"; echo "\n"; -echo "\n"; +echo "\n"; ?> \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_once("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/agc_2-X/trunk/LANG_www/agc_se/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_se/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_se/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_se/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_se/vdc_script_notes.php new file mode 100644 index 00000000..c98f32b4 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_se/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 = 'Titel'; +$label_first_name = 'Förnamn'; +$label_middle_initial = 'MI'; +$label_last_name = 'Efternamn'; +$label_address1 = 'Adress1'; +$label_address2 = 'Adress2'; +$label_address3 = 'Adress3'; +$label_city = 'Stad'; +$label_state = 'Stat'; +$label_province = 'Provins'; +$label_postal_code = 'Postnummer'; +$label_vendor_lead_code = 'VendorID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'Landskod'; +$label_alt_phone = 'Alternativ telefon'; +$label_security_phrase = 'Visa'; +$label_email = 'Email'; +$label_comments = 'Kommentarer'; + +$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 "Felaktig Användarnamn/Lösenord: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Anteckningar"; +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 Anteckningar:

+
Please click SKICKA to commit the changes,           * denotes required fields
+
+ + + + +
+ + + + +
+
+ + + + diff --git a/agc_2-X/trunk/LANG_www/agc_se/vicidial.php b/agc_2-X/trunk/LANG_www/agc_se/vicidial.php index 609d5f49..e3f84439 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_se/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,120 @@ # 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-258'; -$build = '100413-1347'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -360,13 +458,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit 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";} @@ -385,6 +485,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -392,6 +495,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -419,22 +524,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT RING 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 på the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of sekunder to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location på the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### BEGIN find any custom field labels ### +$label_title = 'Titel'; +$label_first_name = 'Förnamn'; +$label_middle_initial = 'MI'; +$label_last_name = 'Efternamn'; +$label_address1 = 'Adress1'; +$label_address2 = 'Adress2'; +$label_address3 = 'Adress3'; +$label_city = 'Stad'; +$label_state = 'Stat'; +$label_province = 'Provins'; +$label_postal_code = 'Postnummer'; +$label_vendor_lead_code = 'VendorID'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefon'; +$label_phone_code = 'Landskod'; +$label_alt_phone = 'Alternativ telefon'; +$label_security_phrase = 'Visa'; +$label_email = 'Email'; +$label_comments = 'Kommentarer'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -452,19 +615,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; +echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -541,7 +712,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -559,7 +730,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -567,29 +738,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10599,249 +12721,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -LOGGA UT\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Livesamtal
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Inloggad som användare + ring)";} + echo "  till kampanj: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + LOGGA UT\n"; ?> +
- -MANUELL UPPRINGNING       SNABBUPPRINGNING
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Livesamtal
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STATUS:
+
+ Ring nästa nummer
+ + + FÖRHANDSGRANSKA LEAD
+ RING ALTERNATIVT NUMMER
+ + INSPELNINGSFIL:
+
+
+ INSPELNINGSID:
+
+ + Starta inspelning
+
+ Webformulär
+ 0) + {echo "\"Webformulär
\n";} + ?> +  
+ Parkera samtal
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Vidarekoppla - Konferens
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Anpassad
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Lägg på kund
+
+
Skicka DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  kund tid:                         Kanal:
Kundinformation:         + LEAD SÖK";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Ring Anmärkningar: "; + if ($agent_call_log_view == '1') + {echo "
visa anteckningar ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+
+
+ + + + + +MANUELL UPPRINGNING       SNABBUPPRINGNING
- -X AKTIVA ÅTERKOMSTER
+ +
- -
+ +VISA SAMTAL LOG
- sekunder: -     + +     + + + +
VERSION:   BUILD:     Server:              
+ + Visa konferenskanalsinformation +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +SNABBTANGENTER ÄR INAKTIVA + + + sekunder: +    
- +
+
+ + +Din status:
Calls Dialing: +
+ + D1 - RING\n"; - echo "
\n"; + echo "   \n"; echo "D2 - RING\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
PERSONLIGA ÅTERKOMSTER :
Klicka på en återkomst nedan för att ringa, numret försvinner då från listan och du får välja nytt utfall. -
-
-
  - Uppdatera -                 - Tillbaka -
-
+
 Samtalskö:  
 
- - height=>
NYTT MANUELLT UPPRINGT LEAD FÖR :

Skriv in informationen för det nya leadet du vill ringa. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Landskod   (Detta är 46 för Sverige)
Telefon Number: -   (12 digits max - digits only) -
Sök existerande leads:   (Detta val söker efter telefonnumret i systemet innan ett nytt lead läggs till.)
-

-     -
-

Om du vill ringa ett nummer och INTE lägga till det som en ny lead, skriv in det exakta numret i \"Dial override\" nedan.För att avsluta detta samtal måste du öppna SAMTAL I DENNA SESSION i botten av fönstret och klicka på kanallänken där..
 
Dial Override:   (enbart siffror) -
-
- Ring nu -                 - Förhandsgranska samtal -                 - Tillbaka -
-
- - - -
-
- - - - -Din status:
Calls Dialing: -
- - - - - > - - -
-
- - Vidarekoppla - Konferens            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - LOKAL CLOSER     - - Lägg på xfer linje -
- seconds -   - channel - - KONSULTERANDE   - - Lägg på båda linjerna -
- Nummer att ringa -   -   - AGENTER - - - RING OVERRIDE - - Lämna 3-partssamtal -
- Ring blindnummer -   - Ring med kund -   - Parkera kunduppringning -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Samtalskö:  
 
- - + 0) { @@ -10853,189 +13162,349 @@ if ($view_calls_in_queue > 0) ?> + +X AKTIVA ÅTERUPPNINGNINGAR
+
-
  -Andra agenters status:  
 
+
  +Andra agenters status:  
 
-
-Tillgängliga agenter koppla:
+$webphone_content
\n"; + } +else + { + echo "
  + Web Telefon:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
medel Se +
+ + + +
  WebTelefon View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "Dialable Leads:
 \n"; } ?>
- + - - - height=70> - -
Leadet utföll som:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
Snabbtangenter: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Vidarekoppla - Konferens            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LOKAL CLOSER     + + Lägg på xfer linje +
+ seconds +   + channel + + KONSULTERANDE   + + Lägg på båda linjerna +
+ Nummer att ringa +   + +                     + +   + + AGENTER + + + + + RING OVERRIDE + + Lämna 3-partssamtal +
+ Ring blindnummer +   + Ring med kund +   + Parkera kunduppringning +   + + Förinställningar Button + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Tillgängliga agenter koppla:
+ + + + + +
Leadet utföll som:

+ -
+
+
+ + + + - - + - + -
Snabbtangenter: Tryck på motsvarande snabbtangent för att välja utfallet av detta samtal. Samtalet kommer avslutas och registreras automatiskt.:
+ - + - + -
+
- - height=70> - - - + +
Informaci�n Anterior Del Servicio repetido: close
+ + + - - + -
Information från återuppringning: close
-
-
-
-
+ +
+
+
+
-
+
- - height=70> - - - + +
Utökad information om alternativt telefonnummer: minimera
+ + + - - + -
Utökad information om alternativt telefonnummer: minimera
-
-
-
-
+
+
+
+
+
-
+
- - - - -
maximera
Alt Telefon Info
+ + + + +
maximera
Alt Telefon Info
- - height=>
Ingen är i din session:
+ +
No one is in your session:
Tillbaka -

- Ring agent igen -
+

+ Ring agent igen +
- - height=>
Kunden har lagt på:
+ +
Kunden har lagt på:
Tillbaka -

+

Avsluta och välj utfall av samtalet -
+
- - height=>
Call Wrapup: kvarvarande sekunder till avslut

+ +
Call Wrapup: kvarvarande sekunder till avslut

-

+

Avsluta och gå vidare -
+
- -
-


+ +
+


Avslutningsmeddelande -
+
- - height=>
Din session har avbrytits
LOGGA UT

Tillbaka -
+ +
Din session har avbrutits
LOGGA UT

Tillbaka +
- - height=>
Det är problem med tidssynkroniseringen, kontakta din systemadministratör


Tillbaka -
+ +
Det är problem med tidssynkroniseringen, kontakta din systemadministratör


Tillbaka +
- - height=>

LOGGA UT
+ +

LOGGA UT
- -
+ +
- -
 
+ +
 
- - height=47>
Inga ändringar som gjorts nedan kommer inte att sparas. Du måste ändra kundinformationen innan du lägger på samtalet.
+ +
Inga ändringar som gjorts nedan kommer inte att sparas. Du måste ändra kundinformationen innan du lägger på samtalet.
- - height=>
SAMTALSUTFALL :       Lägg på igen       minimera
+ +
SAMTALSUTFALL :       Lägg på igen       minimera
+
\n";} + ?> + + + Val för utfallet av samtal -
- PAUSA AGENTUPPRINGNING
+
+ PAUSA AGENTUPPRINGNING
RENSA FORMULÄR | SKICKA -

+

WEB FORM SKICKA -

  -
+

  +
- - height=>
VÄLJ PAUSKOD :
- Paus Code Selection - -

  -
-
- - - height=>
VÄLJ ETT GRUPPALIAS :
- GRUPPALIAS val - -

  -
-
- - - - - - height=>
Välj ett datum för återkomsten :
- - + +
Välj ett datum för återuppringningen :
+
\n";} + ?> + + Välj datum       Hour: - @@ -11050,7 +13519,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11065,267 +13534,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
PERSONLIG ÅTERKOMST
";} + {echo " PERSONLIG ÅTERUPPRINGNING
";} ?> - Kommentar till ÅK:

+ Kommentar till Återuppringning:

- SKICKA

+ SKICKA

-

  -
+

  +
- - height=>
INGÅENDE CLOSER GRUPPVAL
- Ingående closer gruppval -
+ +
PERSONLIGA ÅTERUPPNINGNINGAR :
För att se information på en av de återbesök nedan, klicka på INFO länken. Att ringa kunden tillbaka nu, klicka på RING länken. Om du klickar på en post nedan för att slå det, kommer det att tas bort från listan. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Uppdatera +                 + Tillbaka +
+
+ + +
NYTT MANUELLT UPPRINGT LEAD FÖR :

Skriv in informationen för det nya leadet du vill ringa. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Landskod   (Detta är 46 för Sverige)
Telefon Number: +   (digits only) + + + +
Sök existerande leads:   (Detta val söker efter telefonnumret i systemet innan ett nytt lead läggs till.)
+

+     +
+

Om du vill ringa ett nummer och INTE lägga till det som en ny lead, skriv in det exakta numret i \"Dial override\" nedan.För att avsluta detta samtal måste du öppna SAMTAL I DENNA SESSION i botten av fönstret och klicka på kanallänken där..
 
Dial Override:   (enbart siffror) +
+
+ Ring nu +                 + Förhandsgranska samtal +                 + Tillbaka +
+
+ + +
INGÅENDE CLOSER GRUPPVAL
+
\n";} + ?> + Ingående closer gruppval +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - MIXAD RINGNING(utgående aktiverat)
+ MIXAD RINGNING(utgående aktiverat)
ÅTERSTÄLL | SKICKA -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
territorium SELECTION
+
\n";} + ?> Territory Selection -
+
ÅTERSTÄLL | SKICKA -



  -
+



  +
- - + Kanal Kanal PERSONLIG ÅTERKOMST
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " MIXAD RINGNING
";} + {echo " PERSONLIG ÅTERUPPRINGNING
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " MIXAD RINGNING
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT SAMTAL LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Sök efter en kontakt:             close [X]
+
\n";} + ?> +

+ Anteckningar: när du gör en sökning efter en kontakt, är wild card eller partiell söktermer inte tillåtet.
Kontakt Sök förfrågningar alla inloggade i systemet. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Förnamn Name:
Efternamn Name:
BU Name:
Department:
Group Name:
Job Titel:
Location:

SKICKA SEARCH             återställa formen
+

  +
+
+ + +
      KONTAKTER SÖKRESULTAT:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      SÖK Ett LEAD:             close [X]
+
\n";} + ?> +

+ Anteckningar: när du gör en sökning efter en bly, telefonnummer, bly-ID eller är de bästa fält som ska användas.
Med de övriga fält kan vara långsammare. Bly sökande tillåter inte jokertecken eller delvis sökord.
Lead sökförfrågningar alla inloggade i systemet. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefon Number:
Telefon Number Fields: + Huvud telefonnummer + Alternativt telefonnummer + Adress3 telefonnummer +
Lead ID:
:
:
:
:
:
:

SKICKA SEARCH             återställa formen
+

  +
+
+ + +
      SÖKRESULTAT:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      RING ANMÄRKNINGAR LOG:             close [X]
+
\n";} + ?> +
Ring listan över anteckningar
+

  + Stäng Info Box +
+
+ + +
      Kundinformation:             close [X] +
+
\n";} + ?> + Lead Info +

  + Stäng Info Box +
+
+ + +
VÄLJ PAUSKOD :
+
\n";} + ?> + Paus Code Selection + +

  +
+
+ + +
Välj en förinställd :
+
\n";} + ?> + Presets Selection + +
+
+ + +
VÄLJ ETT GRUPPALIAS :
+
\n";} + ?> + GRUPPALIAS val + +

  +
+
+ + +
ALERT :
+     +

Tillbaka +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -SNABBTANGENTER ÄR INAKTIVA - + + + - -> +
Agent web-client version:     SKAPA:               Server:              
- -Visa konferenskanalsinformation -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
STATUS:
-
-Ring nästa nummer
- FÖRHANDSGRANSKA LEAD
- RING ALTERNATIVT NUMMER
- - -INSPELNINGSFIL:
-
-
-INSPELNINGSID:
-
- -Starta inspelning
-
-Webformulär
- 0) - {echo "\"Webformulär
\n";} -?> -
-Parkera samtal
-Vidarekoppla - Konferens
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Lägg på kund
-
-
Skicka DTMF

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Kanal:
Kundinformation:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Titel:   Förnamn:   MI:   Efternamn:
Adress1:
Adress2: Adress3:
Stad: Stat: Postnummer:
Provins: VendorID: Kön:
Telefon: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -Landskod: Alternativ telefon:
Visa: Email:
Kommentarer: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11335,26 +13908,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_se/voicemail_check.php b/agc_2-X/trunk/LANG_www/agc_se/voicemail_check.php index 87152cc0..c256162e 100644 --- a/agc_2-X/trunk/LANG_www/agc_se/voicemail_check.php +++ b/agc_2-X/trunk/LANG_www/agc_se/voicemail_check.php @@ -96,7 +96,7 @@ if ($format=='debug') { echo "\n"; echo "\n"; -echo "\n"; +echo "\n"; echo "Lyssna av röstbrevlåda"; echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/LANG_www/agc_sk/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_sk/astguiclient.php index 14efa80b..30ac35a1 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_sk/calendar.css b/agc_2-X/trunk/LANG_www/agc_sk/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_sk/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/agc_2-X/trunk/LANG_www/agc_sk/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_sk/calendar_db.js new file mode 100644 index 00000000..1ac3b59b --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_sk/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' : ['Január', 'February', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'Decemeber'], + '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 ("Nesprávny 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 ("Nesprávny 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("Nesprávny 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/agc_2-X/trunk/LANG_www/agc_sk/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_sk/conf_exten_check.php index b3395669..ce513e4f 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $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 "Nesprávny Užívateľské meno/Heslo: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "Nesprávny server_ip: |$server_ip| or Nesprávny session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "Overiť konferenčnú pobočku"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "Overiť konferenčnú pobočku"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten Nie je správny\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check na calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "Hovory v Queue: $RingCalls";} + else {$RingCalls = "Hovory v Queue: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check na calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "Hovory v Queue: $RingCalls";} - else {$RingCalls = "Hovory v Queue: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Stav: ' . $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 . '|Stav: ' . $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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten Nie je správny or Exten $exten Nie je správny\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "Konferencia $conf_exten bol zaregistrovaný $exten\n"; + echo "Konferencia $conf_exten bol zaregistrovaný $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_sk/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_sk/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_sk/functions.php b/agc_2-X/trunk/LANG_www/agc_sk/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_sk/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_sk/manager_send.php b/agc_2-X/trunk/LANG_www/agc_sk/manager_send.php index 7ab8d978..749da988 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -94,12 +99,21 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -289,6 +314,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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten Nie je správny or queryCID $queryCID Nie je správny, Originate príkaz nebol vložený\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -795,10 +869,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='ZAPARKOVAŤ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='ZAPARKOVAŤ',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") @@ -822,9 +959,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='ZAPARKOVAŤ',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 "Jeden z týchto premených Nie je správny:\n"; + echo "Channel $channel musí byť viac ako 2 znaky\n"; + echo "queryCID $queryCID musí byť viac ako 14 znakov\n"; + echo "exten $exten musí byť nastavené\n"; + echo "extenName $extenName musí byť nastavené\n"; + echo "ext_context $ext_context musí byť nastavené\n"; + echo "ext_priority $ext_priority musí byť nastavené\n"; + echo "parkedby $parkedby musí byť nastavené\n"; + echo "\nRedirectToPark Action neodoslané\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='ZAPARKOVAŤ_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='IVRZAPARKOVAŤ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='IVRZAPARKOVAŤ',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 "Jeden z týchto premených Nie je správny:\n"; + echo "Channel $channel musí byť viac ako 2 znaky\n"; + echo "queryCID $queryCID musí byť viac ako 14 znakov\n"; + echo "exten $exten musí byť nastavené\n"; + echo "ext_context $ext_context musí byť nastavené\n"; + echo "ext_priority $ext_priority musí byť nastavené\n"; + echo "\nRedirectFromPark Action neodoslané\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='IVRZAPARKOVAŤ',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) ) @@ -1031,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie je živá na $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1138,7 +1547,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); } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1248,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel nie je živá na $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_sk/phone_only.php b/agc_2-X/trunk/LANG_www/agc_sk/phone_only.php new file mode 100644 index 00000000..488c9a00 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_sk/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "Práve ste sa odhlásili, Ďakujeme\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST na server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link na the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location na the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "Telefón 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 Slovensky
\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 "\n"; + echo "
\"VICIdial\" Telefón-Only Prihlásiť
 
Prihlásenie telefónu:
Heslo telefónu:
Meno užívateľa:
Heslo užívateľa:
  \n"; + echo "

VERZIA: $version       POSTAVENÉ: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Telefón web client: Prihlásenie telefónu\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Slovensky
\n"; + echo "
\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefón-Only Prihlásiť
 
Prihlásenie telefónu:
Heslo telefónu:
  \n"; + echo "

VERZIA: $version       POSTAVENÉ: $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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "Prihlasovacie meno je nesprávne, prosím skúste znova
"; + } + } + if ($VDloginDISPLAY) + { + echo "Telefón 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 Slovensky
\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 "\n"; + echo "\n"; + echo "
\"VICIdial\" Telefón-Only Prihlásiť
 
Meno užívateľa:
Heslo užívateľa:
  \n"; + echo "

VERZIA: $version       POSTAVENÉ: $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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Telefón web client: Prihlásenie telefónu Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo "Timeclock
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English Slovensky
\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 "
\"VICIdial\" Telefón-Only Prihlásiť Error
 
Prepáčte, Vaše prihlasovacie meno a heslo nie sú aktívne v tomto systéme, prosím skúste znova:
 
Prihlásenie telefónu:
Heslo telefónu:

VERZIA: $version       POSTAVENÉ: $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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "Telefón 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call sekúnd counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - sekúnd na call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " Telefón: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web Telefón:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_sk/timeclock.php b/agc_2-X/trunk/LANG_www/agc_sk/timeclock.php index 263b6d2f..50919fc8 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/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 ##### @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "Máte teraz prihlásených"; + $LOGtimeMESSAGE = "Ste prihlásení na $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -338,7 +340,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) if ($referrer=='agent') {$BACKlink = "SPÄŤ na Agent Prihlásiť obrazovky";} if ($referrer=='admin') - {$BACKlink = "SPÄŤ na administratívne";} + {$BACKlink = "SPÄŤ na administratívne";} if ($referrer=='welcome') {$BACKlink = "SPÄŤ na úvodnú obrazovku";} diff --git a/agc_2-X/trunk/LANG_www/agc_sk/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_sk/vdc_db_query.php index c2f3dcaa..c2a0e789 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLeadStav"])) {$CallBackLeadStav=$_GET["CallBackLeadStav"];} + elseif (isset($_POST["CallBackLeadStav"])) {$CallBackLeadStav=$_POST["CallBackLeadStav"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "Užívateľ busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "Nesprávny number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to STAV INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Príchodzie calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "Nesprávny call reference value.", +88 => "Incompatible destination.", +95 => "Nesprávny message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "Nesprávny information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery na timer expiry.", +103 => "Parameter non-existent or not implemented - passed na (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     STAV     PHONE     FULL NAME     CAMPAIGN     IN/OUT     ALT     HANGUP     INFO     VOLAŤ  
Žiadne vyzýva tento deň
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "Zavrieť Call Log"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "Vrátiť späť"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "Nájdené: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set sekúnd='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     STAV     LAST HOVOR     CITY     STATE     ZIP     INFO     VOLAŤ  
Neboli nájdené žiadne výsledky
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
Neboli nájdené žiadne výsledky
"; + echo "
"; + echo "Vrátiť späť"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Vrátiť späť"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampaň not found\n"; + echo "

"; + echo "Vrátiť späť"; + echo "
"; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "Vrátiť späť"; + echo "
"; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "Nájdené: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set sekúnd='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
Neboli nájdené žiadne výsledky
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
Neboli nájdené žiadne výsledky
"; + echo "
"; + echo "Vrátiť späť"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "Vrátiť späť"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: Kampaň not found\n"; + echo "

"; + echo "Vrátiť späť"; + echo "
"; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Spätné volanie Stav:   $row[0]
Spätné volanie Lead stavu:   $row[7]
Spätné volanie Vstup čas:   $row[1]
Spätné volanie oneskorenie:   $row[2]
Komentáre spätné volanie:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $label_title = 'Titul'; + $label_first_name = 'Prvý'; + $label_middle_initial = 'MI'; + $label_last_name = 'Posledný'; + $label_address1 = 'Adresa1'; + $label_address2 = 'Adresa2'; + $label_address3 = 'Adresa3'; + $label_city = 'Mesto'; + $label_state = 'Štát'; + $label_province = 'Kraj'; + $label_postal_code = 'PSČ'; + $label_vendor_lead_code = 'zákaznícke'; + $label_gender = 'Gender'; + $label_phone_number = 'Telefón'; + $label_phone_code = 'Volací kód'; + $label_alt_phone = 'Alter. číslo'; + $label_security_phrase = 'Prezrieť'; + $label_email = 'Email'; + $label_comments = 'Komentár'; + + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "Telefón and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefón Area Code Mimo Dialable zóny $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " PSČ Mimo Dialable zóny $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " Telefón Area Code Mimo Dialable zóny $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " PSČ Mimo Dialable zóny $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
Stav:   $row[0]
$label_vendor_lead_code:   $row[1]
List ID:   $row[2]
Timezone:   $row[3]
Volaný Since Posledný Reset:   $row[4]
$label_phone_code:   $row[5]
$label_phone_number:   $row[6] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$label_email:   $row[21]
$label_security_phrase:   $row[22]
$label_comments:   $row[23]
Volaný Count:   $row[24]
Posledný Local Call Time:   $row[25]
Rank:   $row[26]
Owner:   $row[27]
Entry List ID:   $row[28]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
VÝZVA PRE LOG tohto kábla:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     STAV     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
Žiadne volanie nájdené
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +9767,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_sk/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_sk/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_sk/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_sk/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_sk/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_sk/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_sk/vdc_script_notes.php new file mode 100644 index 00000000..9bf022c3 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_sk/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 = 'Titul'; +$label_first_name = 'Prvý'; +$label_middle_initial = 'MI'; +$label_last_name = 'Posledný'; +$label_address1 = 'Adresa1'; +$label_address2 = 'Adresa2'; +$label_address3 = 'Adresa3'; +$label_city = 'Mesto'; +$label_state = 'Štát'; +$label_province = 'Kraj'; +$label_postal_code = 'PSČ'; +$label_vendor_lead_code = 'zákaznícke'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefón'; +$label_phone_code = 'Volací kód'; +$label_alt_phone = 'Alter. číslo'; +$label_security_phrase = 'Prezrieť'; +$label_email = 'Email'; +$label_comments = 'Komentár'; + +$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 "Nesprávny Užívateľské meno/Heslo: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial Poznámka"; +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 Poznámka:

+
Please click POTVRDIŤ to commit the changes,           * denotes required fields
+
+ + + + +
+ + +
+ + + + + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_sk/vicidial.php b/agc_2-X/trunk/LANG_www/agc_sk/vicidial.php index 55a6ee0d..b5d4ea28 100644 --- a/agc_2-X/trunk/LANG_www/agc_sk/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_sk/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -414,22 +523,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT VOLAŤ 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 na the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of sekúnd to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location na the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### BEGIN find any custom field labels ### +$label_title = 'Titul'; +$label_first_name = 'Prvý'; +$label_middle_initial = 'MI'; +$label_last_name = 'Posledný'; +$label_address1 = 'Adresa1'; +$label_address2 = 'Adresa2'; +$label_address3 = 'Adresa3'; +$label_city = 'Mesto'; +$label_state = 'Štát'; +$label_province = 'Kraj'; +$label_postal_code = 'PSČ'; +$label_vendor_lead_code = 'zákaznícke'; +$label_gender = 'Gender'; +$label_phone_number = 'Telefón'; +$label_phone_code = 'Volací kód'; +$label_alt_phone = 'Alter. číslo'; +$label_security_phrase = 'Prezrieť'; +$label_email = 'Email'; +$label_comments = 'Komentár'; + +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,249 +12720,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -ODHLÁSIŤ\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    Živý hovor
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + Ste prihlásený ako užívateľ + ring)";} + echo "  do kampane: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + ODHLÁSIŤ\n"; ?> +
- -RUČNÉ VOLANIE       RÝCHLE VOLANIE
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    Živý hovor
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + STAV:
+
+ Volať ďalšie číslo
+ + + PREZRIET ZOZNAM KONTAKTOV
+ ALTER. ČÍSLO TELEFÓNU
+ + SÚBOR NAHRÁVKY:
+
+
+ ID NAHRÁVKY:
+
+ + Spustiť nahrávanie
+
+ Web formulár
+ 0) + {echo "\"Web
\n";} + ?> +  
+ Zaparkovaný hovor
+ \"IVR
\n";} + else + {echo "\n";} + ?> + Presmerovanie - Konferencia
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"Vlastný
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ Zložiť zákazníka
+
+
Poslať DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  zákazník čas:                         Kanál:
Informácia o zákazníkovi:         + HĽADANIE LEAD";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "Výzva Poznámky: "; + if ($agent_call_log_view == '1') + {echo "
zobraziť poznámky ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+ + +
+ + + + + +RUČNÉ VOLANIE       RÝCHLE VOLANIE
- -X AKTÍVNE PREPLÁNOVANÉ HOVORY
+ +
- -
+ +POHĽAD Denník hovorov
- sekúnd: -     + +     + + + +
VERZIA:   POSTAVENÉ:     Server:              
+ + Ukázať informáciu o konferenčnom kanále +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +NEAKTÍVNE RÝCHLE TLAČIDLÁ + + + sekúnd: +    
- +
+
+ + +Váš stav:
Calls Dialing: +
+ + D1 - VOLAŤ\n"; - echo "
\n"; + echo "   \n"; echo "D2 - VOLAŤ\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
PREPLÁNOVANÉ HOVORY PRE AGENTA :
Kliknite na preplánovanie hovoru na volanie zákaznikovi znova. Ak kliknete na záznam nižšie budete ho volať a bude odstránený zo zoznamu. -
-
-
  - Osviežiť -                 - Vrátiť späť -
-
+
 Hovorov vo fronte:  
 
- - height=>
NOVÉ manuálne vytáčanie pre zoznam kontaktov :

Zadajte nižšie uvedené informácie pre nový zoznam kontaktov, ktorý chcete volať. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Volať kód:   (To je obvykle 1 v USA-Kanada)
Telefón Number: -   (12 digits max - digits only) -
Vyhľadať existujúce zoznamy kontaktov:   (Táto voľba skontroluje, ak sa bude snažiť nájsť telefónne číslo do systému pred jeho vloženie ako nového zoznamu kontaktov)
-

-     -
-

Ak chcete vytočiť číslo, a nemáte ho v novom zozname kontaktov, vložte volané číslo , ktoré chcete volať do poľa Prepísať volanie. Pre ukončenie hovoru, budete musieť otvoriť odkaz HOVORY V TEJTO RELÁCII v spodnej časti obrazovky, a ukončiť požadovaný kanál.
 
Prepísanie volania:   (prosím len čísla) -
-
- Volať znova -                 - Náhľad Výzva -                 - Vrátiť späť -
-
- - - -
-
- - - - -Váš stav:
Calls Dialing: -
- - - - - > - - -
-
- - Presmerovanie - Konferencia            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - LOKALNE ROZSIRENIE     - - Zložiť Xfer linku -
- seconds -   - channel - - PORADNÝ   - - Zložiť obe linky -
- Číslo na volanie -   -   - AGENTI - - - PREPISAT VOLANIE - - PONECHAT 3 CESTNE VOLANIE -
- Volať slepé presmerovanie -   - Volanie so zákazníkom -   - Zaparkovať hovor so zákazníkom -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 Hovorov vo fronte:  
 
- - + 0) { @@ -10817,189 +13161,349 @@ if ($view_calls_in_queue > 0) ?> + +X AKTÍVNE PREPLÁNOVANÉ HOVORY
+
-
  -Ostatné zástupcovia Stav:  
 
+
  +Ostatné zástupcovia Stav:  
 
-
-Dostupných prostriedkov Transfer:
+$webphone_content
\n"; + } +else + { + echo "
  + Web Telefón:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
agenti Zobraziť +
+ + + +
  WebTelefón View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "vedie Dialable:
 \n"; } ?>
- + - - - height=70> - -
Kontakty pripravené ako:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
Rozloženie horúcich kláves: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + Presmerovanie - Konferencia            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LOKALNE ROZSIRENIE     + + Zložiť Xfer linku +
+ seconds +   + channel + + PORADNÝ   + + Zložiť obe linky +
+ Číslo na volanie +   + +                     + +   + + AGENTI + + + + + PREPISAT VOLANIE + + PONECHAT 3 CESTNE VOLANIE +
+ Volať slepé presmerovanie +   + Volanie so zákazníkom +   + Zaparkovať hovor so zákazníkom +   + + Tlačidlo predvoľby + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+Dostupných prostriedkov Transfer:
+ + + + + +
Kontakty pripravené ako:

+ -
+
+
+ + + + - - + - + -
Rozloženie horúcich kláves: Keď je aktívne, jednoducho stlačte na klávesnici tlačidlo pre požadovanú dispozíciu pre tento hovor. Hovor bude potom ukončený automaticky:
+ - + - + -
+
- - height=70> - - - + +
Predchádzajúca informácia o preplánovaní hovoru: close
+ + + - - + -
Predchádzajúca informácia o preplánovaní hovoru: close
-
-
-
-
+ +
+
+
+
-
+
+
- - height=70> - - - + +
Rozšírená Alt Telefón Informácie: minimalizovať
+ + + - - + -
Rozšírená Alt Telefón Informácie: minimalizovať
-
-
-
-
+
+
+
+
+
-
+
+
- - - - -
maximalizovať
Alt Telefón Info
+ + + + +
maximalizovať
Alt Telefón Info
- - height=>
Nikto nie je vo Vašej relácii:
+ +
Nikto nie je vo Vašej relácii:
Vrátiť späť -

- Volať agenta znova -
+

+ Volať agenta znova +
- - height=>
Zákazník položil:
+ +
Zákazník položil:
Vrátiť späť -

+

Ukončenie a umiestnenie hovoru -
+
- - height=>
Volanie Wrapup: sekúnd zostávajúcich na wrapup

+ +
Volanie Wrapup: sekúnd zostávajúcich na wrapup

-

+

Dokončiť Wrapup a presunúť na -
+
- -
-


+ +
+


Zavrieť správu -
+
- - height=>
Vaša relácia bola ukončená
ODHLÁSIŤ

Vrátiť späť -
+ +
Vaša relácia bola ukončená
ODHLÁSIŤ

Vrátiť späť +
- - height=>
Je synchronizácia času problém s vašim systémom, povedzte to, prosím, správcu systému


Vrátiť späť -
+ +
Je synchronizácia času problém s vašim systémom, povedzte to, prosím, správcu systému


Vrátiť späť +
- - height=>

ODHLÁSIŤ
+ +

ODHLÁSIŤ
- -
+ +
- -
 
+ +
 
- - height=47>
Všetky zmeny vykonané v informáciách o zákazníkovi teraz , budú vykonané, musíte zmeniť informácie o zákazníkovi pred ukončením hovoru.
+ +
Všetky zmeny vykonané v informáciách o zákazníkovi teraz , budú vykonané, musíte zmeniť informácie o zákazníkovi pred ukončením hovoru.
- - height=>
VYKONANIE HOVORU :       Položte znova       minimalizovať
+ +
VYKONANIE HOVORU :       Položte znova       minimalizovať
+
\n";} + ?> + + + Ukončenie hovoru vybranej dispozície -
- PAUZA VOLAJUCEHO AGENTA
+
+ PAUZA VOLAJUCEHO AGENTA
VYMAZAŤ FORMULÁR | POTVRDIŤ -

+

WEB FORM POTVRDIŤ -

  -
+

  +
- - height=>
VYBRAŤ KÓD PAUZY :
- Pauza Code Selection - -

  -
-
- - - height=>
VYBER GROUP ALIAS :
- Skupina Alias Výber - -

  -
-
- - - - - - height=>
Vyberte dátum preplánovania hovoru :
- - + +
Vyberte dátum preplánovania hovoru :
+
\n";} + ?> + + Vyberte dátum nižšie       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
LEN MOJE PREPLÁNOVANÉ HOVORY
";} + {echo " LEN MOJE PREPLÁNOVANÉ HOVORY
";} ?> - Poznámky CB:

+ Poznámky CB:

- POTVRDIŤ

+ POTVRDIŤ

-

  -
+

  +
- - height=>
Užší výber prichádzajúce skupiny
- Užší výber prichádzajúce skupiny -
+ +
PREPLÁNOVANÉ HOVORY PRE AGENTA :
Ak chcete zobraziť informácie o jednej z nižšie uvedených spätné volanie, kliknite na odkaz INFO. Ak chcete volať zákazníkovi späť, kliknite na odkaz VOLAŤ. Ak kliknete na záznam nižšie vytočiť ho, bude odstránený zo zoznamu. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + Osviežiť +                 + Vrátiť späť +
+
+ + +
NOVÉ manuálne vytáčanie pre zoznam kontaktov :

Zadajte nižšie uvedené informácie pre nový zoznam kontaktov, ktorý chcete volať. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Volať kód:   (To je obvykle 1 v USA-Kanada)
Telefón Number: +   (digits only) + + + +
Vyhľadať existujúce zoznamy kontaktov:   (Táto voľba skontroluje, ak sa bude snažiť nájsť telefónne číslo do systému pred jeho vloženie ako nového zoznamu kontaktov)
+

+     +
+

Ak chcete vytočiť číslo, a nemáte ho v novom zozname kontaktov, vložte volané číslo , ktoré chcete volať do poľa Prepísať volanie. Pre ukončenie hovoru, budete musieť otvoriť odkaz HOVORY V TEJTO RELÁCII v spodnej časti obrazovky, a ukončiť požadovaný kanál.
 
Prepísanie volania:   (prosím len čísla) +
+
+ Volať znova +                 + Náhľad Výzva +                 + Vrátiť späť +
+
+ + +
Užší výber prichádzajúce skupiny
+
\n";} + ?> + Užší výber prichádzajúce skupiny +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - ZMIESANE VOLANIE(Odchádzaúce volanie aktivované)
+ ZMIESANE VOLANIE(Odchádzaúce volanie aktivované)
ZNOVU INCIALIZOVAŤ | POTVRDIŤ -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
VÝBER ÚZEMIA
+
\n";} + ?> Territory Selection -
+
ZNOVU INCIALIZOVAŤ | POTVRDIŤ -



  -
+



  +
- - + Kanál Kanál LEN MOJE PREPLÁNOVANÉ HOVORY
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " ZMIESANE VOLANIE
";} + {echo " LEN MOJE PREPLÁNOVANÉ HOVORY
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " ZMIESANE VOLANIE
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT HOVOR LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      Hľadanie kontaktu:             close [X]
+
\n";} + ?> +

+ Poznámky: pri tom hľadaní kontaktu, sú zástupné alebo čiastočné vyhľadávacie termíny nie sú povolené.
Žiadosti Kontakt vyhľadávania sú prihlásení do systému. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
Prvý Name:
Posledný Name:
BU Name:
Department:
Group Name:
Job Titul:
Location:

POTVRDIŤ SEARCH             resetovať formulár
+

  +
+
+ + +
      VÝSLEDKY HĽADANIE KONTAKTY:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      Hľadanie olova:             close [X]
+
\n";} + ?> +

+ Poznámky: pri tom hľadaní na vedenie, telefónne číslo, vedie ID alebo sú najlepšie polia na použitie.
Použitie iných oblastiach môže byť pomalší. Vedúci vyhľadávania neumožňuje zástupných alebo čiastočnú vyhľadávacie termíny.
Olovo hľadanie požiadavky sú zaznamenané v systéme. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Telefón Number:
Telefón Number Fields: + Hlavné telefónne číslo + Alternatívne telefónne číslo + Adresa3 telefónne číslo +
Lead ID:
:
:
:
:
:
:

POTVRDIŤ SEARCH             resetovať formulár
+

  +
+
+ + +
      VÝSLEDKY HĽADANIE:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      VÝZVA NOTES LOG:             close [X]
+
\n";} + ?> +
Výzva Poznámky Zoznam
+

  + Zavrieť Info Box +
+
+ + +
      Informácia o zákazníkovi:             close [X] +
+
\n";} + ?> + Lead Info +

  + Zavrieť Info Box +
+
+ + +
VYBRAŤ KÓD PAUZY :
+
\n";} + ?> + Pauza Code Selection + +

  +
+
+ + +
SELECT PRESET :
+
\n";} + ?> + Presets Selection + +
+
+ + +
VYBER GROUP ALIAS :
+
\n";} + ?> + Skupina Alias Výber + +

  +
+
+ + +
ALERT :
+     +

Vrátiť späť +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -NEAKTÍVNE RÝCHLE TLAČIDLÁ - + + + - -> +
Agent web-client version:     POSTAVENÉ:               Server:              
- -Ukázať informáciu o konferenčnom kanále -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
STAV:
-
-Volať ďalšie číslo
- PREZRIET ZOZNAM KONTAKTOV
- ALTER. ČÍSLO TELEFÓNU
- - -SÚBOR NAHRÁVKY:
-
-
-ID NAHRÁVKY:
-
- -Spustiť nahrávanie
-
-Web formulár
- 0) - {echo "\"Web
\n";} -?> -
-Zaparkovaný hovor
-Presmerovanie - Konferencia
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-Zložiť zákazníka
-
-
Poslať DTMF

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   Kanál:
Informácia o zákazníkovi:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Titul:   Prvý:   MI:   Posledný:
Adresa1:
Adresa2: Adresa3:
Mesto: Štát: PSČ:
Kraj: zákaznícke: Pohlavie:
Telefón: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -Volací kód: Alter. číslo:
Prezrieť: Email:
Poznámky: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/LANG_www/agc_tw/astguiclient.php b/agc_2-X/trunk/LANG_www/agc_tw/astguiclient.php index 8eb6e941..f1c42b6e 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/astguiclient.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/LANG_www/agc_tw/calendar.css b/agc_2-X/trunk/LANG_www/agc_tw/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_tw/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/agc_2-X/trunk/LANG_www/agc_tw/calendar_db.js b/agc_2-X/trunk/LANG_www/agc_tw/calendar_db.js new file mode 100644 index 00000000..406cbb44 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_tw/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/agc_2-X/trunk/LANG_www/agc_tw/conf_exten_check.php b/agc_2-X/trunk/LANG_www/agc_tw/conf_exten_check.php index 77772f60..f63a6b9d 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/conf_exten_check.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 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,17 +50,25 @@ # 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 +# 101123-1105 - Added api manual dial queue feature to external_dial function +# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406) +# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-30'; +$build = '110610-0059'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=38; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -105,10 +113,15 @@ if ($qm_conf_ct > 0) ########################################### if ($non_latin < 1) -{ -$user=ereg_replace("[^0-9a-zA-Z]","",$user); -$pass=ereg_replace("[^0-9a-zA-Z]","",$pass); -} + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } # default optional vars if not set if (!isset($format)) {$format="text";} @@ -135,14 +148,13 @@ $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 "無效 Username/密碼: |$user|$pass|\n"; exit; } - else +else { - if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) { echo "無效 server_ip: |$server_ip| or 無效 session_name: |$session_name|\n"; @@ -169,30 +181,29 @@ $auth=$row[0]; } if ($format=='debug') -{ -echo "\n"; -echo "\n"; -echo "\n"; -echo "確認會議中分機"; -echo "\n"; -echo "\n"; -echo "\n"; -} - - if ($ACTION == 'refresh') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if (strlen($conf_exten)<1) + echo "\n"; + echo "\n"; + echo "\n"; + echo "確認會議中分機"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if ($ACTION == 'refresh') + { + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if (strlen($conf_exten)<1) { $channel_live=0; echo "Conf Exten $conf_exten 是無效的\n"; exit; } - else + else { - if ($client == 'vdc') { $Acount=0; @@ -200,6 +211,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';"; @@ -211,7 +224,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -220,6 +233,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -228,6 +252,53 @@ echo " # $row=mysql_fetch_row($rslt); # $AexternalDEAD=$row[0]; + ##### BEGIN check on calls in queue, number of active calls in the campaign + if ($campagentstdisp == 'YES') + { + $ADsql=''; + ### grab the status of this agent to display + $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $AccampSQL = ereg_replace(' -','', $AccampSQL); + $AccampSQL = ereg_replace(' ',"','", $AccampSQL); + if (eregi('AGENTDIRECT', $AccampSQL)) + { + $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $RingCalls=$row[0]; + if ($RingCalls > 0) {$RingCalls = "佇列中等待電話: $RingCalls";} + else {$RingCalls = "佇列中等待電話: $RingCalls";} + + ### grab the number of calls being placed from this server and campaign + $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $DiaLCalls=$row[0]; + } + else + { + $Alogin='N'; + $RingCalls='N'; + $DiaLCalls='N'; + } + ##### END check on calls in queue, number of active calls in the campaign + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -254,6 +325,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -281,59 +361,9 @@ echo " } } ##### END DEAD logging section ##### - - if ($campagentstdisp == 'YES') - { - $ADsql=''; - ### grab the status of this agent to display - $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $Alogin=$row[0]; - $Acampaign=$row[1]; - $AccampSQL=$row[2]; - $AccampSQL = ereg_replace(' -','', $AccampSQL); - $AccampSQL = ereg_replace(' ',"','", $AccampSQL); - if (eregi('AGENTDIRECT', $AccampSQL)) - { - $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL); - $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; - } - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $RingCalls=$row[0]; - if ($RingCalls > 0) {$RingCalls = "佇列中等待電話: $RingCalls";} - else {$RingCalls = "佇列中等待電話: $RingCalls";} - - ### grab the number of calls being placed from this server and campaign - $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysql_fetch_row($rslt); - $DiaLCalls=$row[0]; - - } - else - { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - } } else { - $Alogin='N'; - $RingCalls='N'; - $DiaLCalls='N'; - ### update the vicidial_live_agents every second with a new random number so it is shown to be alive $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} @@ -357,6 +387,15 @@ echo " $row=mysql_fetch_row($rslt); $AcalleridCOUNT=$row[0]; + if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) ) + { + $updateNOW_TIME = date("Y-m-d H:i:s"); + $stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) ) { $DEADcustomer++; @@ -387,7 +426,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 +440,56 @@ 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]; + + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' 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,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -569,8 +658,13 @@ echo " {$Alogin='DEAD_EXTERNAL';} if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} + if ($external_pause == 'LOGOUT') + { + $Alogin='API_LOGOUT'; + $external_pause=''; + } - 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 . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { @@ -611,40 +705,40 @@ echo " if ($format=='debug') {echo "\n";} } } - $channels_list = ($channels_list + $sip_list); - echo "$channels_list|"; + $channels_list = ($channels_list + $sip_list); + echo "$channels_list|"; - $counter=0; - $countecho=''; - while($total_conf > $counter) + $counter=0; + $countecho=''; + while($total_conf > $counter) { - $counter++; - $countecho = "$countecho$ChannelA[$counter] ~"; - # echo "$ChannelA[$counter] ~"; + $counter++; + $countecho = "$countecho$ChannelA[$counter] ~"; + # echo "$ChannelA[$counter] ~"; } echo "$countecho\n"; } - if ($ACTION == 'register') +if ($ACTION == 'register') { - $MT[0]=''; - $row=''; $rowx=''; - $channel_live=1; - if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + if ( (strlen($conf_exten)<1) || (strlen($exten)<1) ) { $channel_live=0; echo "Conf Exten $conf_exten 是無效的 or Exten $exten 是無效的\n"; exit; } - else + else { $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);} } - echo "會議 $conf_exten 被註冊至 $exten\n"; + echo "會議 $conf_exten 被註冊至 $exten\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_tw/dbconnect.php b/agc_2-X/trunk/LANG_www/agc_tw/dbconnect.php index 89d88689..e02ca392 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/dbconnect.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/dbconnect.php @@ -4,46 +4,49 @@ # # database connection settings and some global web settings # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # if ( file_exists("/etc/astguiclient.conf") ) -{ -$DBCagc = file("/etc/astguiclient.conf"); -foreach ($DBCagc as $DBCline) { - $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); - if (ereg("^PATHlogs", $DBCline)) - {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} - if (ereg("^PATHweb", $DBCline)) - {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} - if (ereg("^VARDB_server", $DBCline)) - {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} - if (ereg("^VARDB_database", $DBCline)) - {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} - if (ereg("^VARDB_user", $DBCline)) - {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} - if (ereg("^VARDB_pass", $DBCline)) - {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} - if (ereg("^VARDB_port", $DBCline)) - {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + $DBCagc = file("/etc/astguiclient.conf"); + foreach ($DBCagc as $DBCline) + { + $DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline); + if (ereg("^PATHlogs", $DBCline)) + {$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);} + if (ereg("^PATHweb", $DBCline)) + {$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);} + if (ereg("^VARserver_ip", $DBCline)) + {$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);} + if (ereg("^VARDB_server", $DBCline)) + {$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);} + if (ereg("^VARDB_database", $DBCline)) + {$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);} + if (ereg("^VARDB_user", $DBCline)) + {$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);} + if (ereg("^VARDB_pass", $DBCline)) + {$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);} + if (ereg("^VARDB_port", $DBCline)) + {$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);} + } + } +else + { + #defaults for DB connection + $VARDB_server = 'localhost'; + $VARDB_port = '3306'; + $VARDB_user = 'cron'; + $VARDB_pass = '1234'; + $VARDB_database = '1234'; + $WeBServeRRooT = '/usr/local/apache2/htdocs'; } -} -else -{ -#defaults for DB connection -$VARDB_server = 'localhost'; -$VARDB_user = 'cron'; -$VARDB_pass = '1234'; -$VARDB_database = '1234'; -$WeBServeRRooT = '/usr/local/apache2/htdocs'; -} - -$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass"); -if (!$link) { +$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass"); +if (!$link) + { die('MySQL connect ERROR: ' . mysql_error()); -} -mysql_select_db("$VARDB_database",$link); + } +mysql_select_db("$VARDB_database"); $local_DEF = 'Local/'; $conf_silent_prefix = '7'; diff --git a/agc_2-X/trunk/LANG_www/agc_tw/functions.php b/agc_2-X/trunk/LANG_www/agc_tw/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_tw/functions.php @@ -0,0 +1,1435 @@ + LICENSE: AGPLv2 +# +# +# CHANGES: +# 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions +# 110630-0026 - Added HIDDEN and READONLY field types +# 110719-0858 - Added HIDEBLOB field type +# 110730-2336 - Added call_id variable +# 120213-1709 - Commented out default of READONLY fields since they cannot change +# + + +##### 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]\|/i",$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]\|/i",$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]=='READONLY') + { + 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 .= " $A_field_value[$o]\n"; + } + if ( ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') ) + { + if (strlen($A_field_value[$o]) < 1) {$A_field_value[$o] = $A_field_default[$o];} + if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';} + $field_HTML .= "\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') and ($A_field_type[$o]!='HIDDEN') and ($A_field_type[$o]!='HIDEBLOB') ) + { + $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); + $CFoutput = eregi_replace('--A--call_id--B--',"$call_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 ##### + + + + +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + + +##### 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/agc_2-X/trunk/LANG_www/agc_tw/manager_send.php b/agc_2-X/trunk/LANG_www/agc_tw/manager_send.php index c332817c..0a6c16bf 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/manager_send.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -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,11 @@ # - $agent_dialed_number - ('1','') # - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...) # - $nodeletevdac - ('0','1') +# - $alertCID - ('0','1') +# - $preset_name = ('TESTING PRESET',...) +# - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign +# - $qm_extension # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -94,12 +99,21 @@ # 91112-1110 - Added CALLOUTBOUND value to QM entry lookup # 91205-2103 - Code cleanup # 91213-1208 - Added queue_position to queue_log COMPLETE... records -# +# 100327-0846 - Fix for list_id override answering machine message +# 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 +# 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# 110626-2320 - Added qm_extension -$version = '2.2.0-46'; -$build = '91213-1208'; +$version = '2.4-56'; +$build = '110626-2320'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=85; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -185,6 +199,17 @@ 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"];} +if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} + elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -289,6 +314,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 +429,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) and ($alertCID < 1) ) ) { echo "ERROR Exten $exten 是無效的 or queryCID $queryCID 是無效的, Originate 指令未插入\n"; } @@ -410,10 +449,12 @@ if ($ACTION=="Originate") { $RAWaccount = $account; $account = "Account: $account"; - $variable = "Variable: usegroupalias=1"; + $variable = "Variable: _usegroupalias=1"; + if (strlen($call_variables)>9) + {$variable = "Variable: _usegroupalias=1";} # |$call_variables } else - {$account=''; $variable='';} + {$variable=''; $account="Variable: $call_variables";} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); @@ -422,10 +463,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);} + } } } } @@ -572,7 +637,7 @@ if ($ACTION=="Hangup") { ############################################# ##### 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_pe_phone_append FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);} if ($format=='debug') {echo "\n";} @@ -587,6 +652,7 @@ if ($ACTION=="Hangup") $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; + $queuemetrics_pe_phone_append = $row[6]; $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -661,8 +727,23 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $pe_append=''; + if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) ) + {$pe_append = "-$qm_extension";} + $data4SQL = ",data4='$row[0]$pe_append'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -734,39 +815,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);} } - else + + if (strlen($preset_name) > 0) { - if (strlen($lead_id) > 1) + $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) { - $list_id=''; - $stmt = "SELECT list_id FROM vicidial_list where lead_id='$lead_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02084',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $list_id = $row[0]; - - if (strlen($list_id) > 1) - { - $stmt = "SELECT am_message_exten_override FROM vicidial_lists where list_id='$list_id';"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02085',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $lio_ct = mysql_num_rows($rslt); - if ($lio_ct > 0) - { - $row=mysql_fetch_row($rslt); - $am_message_exten_override = $row[0]; - if (strlen($am_message_exten_override) > 0) {$exten = "$am_message_exten_override";} - } - } - } + $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"; } } @@ -795,10 +869,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") @@ -822,9 +959,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 需大於兩個字元\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 需大於兩個字元\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) ) @@ -1031,7 +1440,7 @@ if ($ACTION=="RedirectXtraCXNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel 非可用 on $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} @@ -1138,7 +1547,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); } } @@ -1215,7 +1624,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02053',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} @@ -1234,7 +1643,7 @@ if ($ACTION=="RedirectXtraNeW") $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02055',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + if ( ($row[0]==0) and (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} @@ -1248,7 +1657,7 @@ if ($ACTION=="RedirectXtraNeW") if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel 非可用 on $server_ip";} } } - if ( ($channel_liveX==1) && ($channel_liveY==1) ) + if ( ($channel_liveX==1) and ($channel_liveY==1) ) { if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) { @@ -1683,7 +2092,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/agc_2-X/trunk/LANG_www/agc_tw/phone_only.php b/agc_2-X/trunk/LANG_www/agc_tw/phone_only.php new file mode 100644 index 00000000..02891375 --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_tw/phone_only.php @@ -0,0 +1,839 @@ + LICENSE: AGPLv2 +# +# CHANGELOG +# 110511-1336 - First Build +# 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled +# + +$version = '2.4-3p'; +$build = '120223-2124'; +$mel=1; # Mysql Error Log enabled = 1 +$mysql_log_count=72; +$one_mysql_log=0; + +require("dbconnect.php"); +require("functions.php"); + +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["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["VD_login"])) {$VD_login=$_GET["VD_login"];} + elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];} +if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];} + elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];} +if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} + elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];} +if (!isset($phone_login)) + { + if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];} + elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];} + } +if (!isset($phone_pass)) + { + if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];} + elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];} + } +if (!isset($flag_channels)) + { + $flag_channels=0; + $flag_string=''; + } + +### security strip all non-alphanumeric characters out of the variables ### +$DB=ereg_replace("[^0-9a-z]","",$DB); +$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); +$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); +$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login); +$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass); + + +$forever_stop=0; + +if ($force_logout) + { + echo "您已成功登出系統\n"; + exit; + } + +$isdst = date("I"); +$StarTtimE = date("U"); +$NOW_TIME = date("Y-m-d H:i:s"); +$tsNOW_TIME = date("YmdHis"); +$FILE_TIME = date("Ymd-His"); +$loginDATE = date("Ymd"); +$CIDdate = date("ymdHis"); +$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); +$past_month_date = date("Y-m-d H:i:s",$month_old); +$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); +$past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; +$PHP_SELF=$_SERVER['PHP_SELF']; + +$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,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,'09001',$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); + $non_latin = $row[0]; + $vdc_header_date_format = $row[1]; + $vdc_customer_date_format = $row[2]; + $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; + $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 ##### +########################################### + + +##### DEFINABLE SETTINGS AND OPTIONS +########################################### + +# set defaults for hard-coded variables +$clientDST = '1'; # set to 1 to check for DST on server for agent time +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link on the agent login screen + +$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window +$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500 +$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location on the agent screen 'right' or 'bar' +$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 +$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; +$SIDEBAR_COLOR = '#F6F6F6'; + +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } + +$US='_'; +$CL=':'; +$AT='@'; +$DS='-'; +$date = date("r"); +$ip = getenv("REMOTE_ADDR"); +$browser = getenv("HTTP_USER_AGENT"); +$script_name = getenv("SCRIPT_NAME"); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +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('phone_only.php','',$agcPAGE); +if (strlen($static_agent_url) > 5) + {$agcPAGE = $static_agent_url;} + + +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 +echo ' + + + + + + +'; +echo "\n"; +echo "\n"; + + +$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);} +$row=mysql_fetch_row($rslt); +$VU_user_group=$row[0]; + + +if ($relogin == 'YES') + { + echo "電話 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 "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" 電話-Only 登入
 
登入分機:
分機密碼:
使用者登入:
使用者密碼:
  \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 "電話 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 "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" 電話-Only 登入
 
登入分機:
分機密碼:
  \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 ( (strlen($VD_login)<2) or (strlen($VD_pass)<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,'09003',$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,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $LOGfullname = $row[0]; + $user_level = $row[1]; + $VU_user_group = $row[10]; + + ### 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,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $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;} + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$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++;} + + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "登入失敗,請重試
"; + } + } + if ($VDloginDISPLAY) + { + echo "電話 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 "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" 電話-Only 登入
 
使用者登入:
使用者密碼:
  \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,'09006',$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,'09007',$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_asterisk_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,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "電話 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 "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" 電話-Only 登入 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,'09009',$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 web_client_sessions 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,'09010',$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_asterisk_server='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowy=mysql_fetch_row($rslt); + + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers 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,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[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,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + + ### 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,'09014',$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]|$twin_not_live| "; + + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) + { + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + } + $pb++; + } + echo "\n"; + } + echo "電話 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,phone_ring_timeout,on_hook_agent,webphone_auto_answer 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,'09015',$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]; + $phone_ring_timeout=$row[77]; + $on_hook_agent=$row[78]; + $webphone_auto_answer=$row[79]; + + $no_empty_session_warnings=0; + if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') ) + { + $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,'09016',$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,'09017',$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"; + } + + + $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 = 'phone';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$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,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + + $VICIDiaL_is_logged_in=1; + + $webphone_content=''; + ### 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,'09020',$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,'09021',$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,'09022',$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 == 'N') {$webphone_options .= "--DIALPAD_N";} + if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";} + if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";} + if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";} + if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";} + + ### 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"; + if ($webphone_location == 'bar') + { + $webphone_content = ""; + } + else + { + $webphone_content = ""; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + } + } + + +### SCREEN WIDTH AND HEIGHT CALCULATIONS ### +### DO NOT EDIT! ### +if ($stretch_dimensions > 0) + { + if ($agent_status_view < 1) + { + if ($JS_browser_width >= 510) + {$BROWSER_WIDTH = ($JS_browser_width - 80);} + } + else + { + if ($JS_browser_width >= 730) + {$BROWSER_WIDTH = ($JS_browser_width - 300);} + } + 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';} +if ($MASTERheight < 300) {$MASTERheight = '300';} +if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);} + +$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...) +$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point +$MNwidth = ($MASTERwidth + 330); # 760 - main frame +$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference +$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks +$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings +$AMwidth = ($MASTERwidth + 270); # 700 - refresh links +$SCwidth = ($MASTERwidth + 230); # 670 - live call 秒 counter, sidebar link +$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links +$MUwidth = ($MASTERwidth + 180); # 610 - agent mute +$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 - 120); # 310 - Calls in queue link + + +$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span +$DBheight = ($MASTERheight + 260); # 560 - Debug span +$WRheight = ($MASTERheight + 160); # 460 - Warning boxes +$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section +$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link +$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link +$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button +$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons +$PBheight = ($MASTERheight + 90); # 390 - preset dial links +$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons +$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status +$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 +$SCheight = 49; # 49 - 秒 on call display +$SFheight = 65; # 65 - height of the script and form contents +$SRheight = 69; # 69 - height of the script and form refrech links +if ($webphone_location == 'bar') + { + $SCheight = ($SCheight + $webphone_height); +# $SFheight = ($SFheight + $webphone_height); + $SRheight = ($SRheight + $webphone_height); + } +$AVTheight = '0'; +if ($is_webphone) {$AVTheight = '20';} + + + + +echo "\n"; + +$zi=2; + +echo "\n"; + +echo " 電話: $original_phone_login - $server_ip           Logout
\n"; + +if ($webphone_location == 'bar') + { + echo "$webphone_content\n"; + } +else + { + echo "
  + Web 電話:  
$webphone_content
\n"; + } +?> + + + + + + diff --git a/agc_2-X/trunk/LANG_www/agc_tw/timeclock.php b/agc_2-X/trunk/LANG_www/agc_tw/timeclock.php index f80e0e9d..9675bb4d 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/timeclock.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/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 ##### @@ -264,8 +266,8 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') ) { - $VDdisplayMESSAGE = "You have now logged-in"; - $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; + $VDdisplayMESSAGE = "你現在登錄"; + $LOGtimeMESSAGE = "您在登錄 $NOW_TIME"; ### Add a record to the timeclock log $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; @@ -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/agc_2-X/trunk/LANG_www/agc_tw/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_tw/vdc_db_query.php index 8bbc6a3d..b9d9a64d 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/vdc_db_query.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to exchange information between vicidial.php and the database server for various actions # @@ -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,13 @@ # - $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|') +# - $call_notes +# - $disable_alter_custphone = ('N','Y','HIDE') +# - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code +# # # CHANGELOG: # 50629-1044 - First build of script @@ -231,18 +238,82 @@ # 100109-0745 - Added alt_num_status for ALTNUM dialing status # 100109-1336 - Fixed Manual dial live call detection # 100113-1949 - Fixed dispo_choice bug and added dispo_status to dispo URL call -# 100202-2306 - Fixed logging issues related to INBOUND_MAN dial_method -# 100207-1110 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100122-0757 - Added NOT-LOGGED-IN-AGENTS option for sidebar view and transfer view +# 100202-2305 - Fixed logging issues related to INBOUND_MAN dial_method +# 100207-1104 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100219-1437 - Added agent_dispo_log file option +# 100220-1041 - Added CALLLOGview and LEADINFOview functions +# 100221-1105 - Added custom CID use compatibility # 100301-1342 - Changed Available agents output for AGENTDIRECT selection +# 100309-0535 - Added queuemetrics_loginout option +# 100311-1559 - Added callcard logging to startcallurl and dispourl functions +# 100331-1217 - Added human-readable hangup codes for manual dial +# 100405-1430 - Added queuemetrics_callstatus option +# 100413-1341 - Fixes for extended alt-dial +# 100420-1006 - Added option for LIVE-only callback count +# 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 +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option +# 101128-0108 - Added list override for webforms +# 101208-0414 - Fixed Call Log dial bug (issue 393) +# 110103-1343 - Added queuemetrics_loginout NONE option +# 110124-1134 - Small query fix for large queue_log tables +# 110124-1456 - Fixed AREACODE DNC manual dial bug +# 110212-2103 - Added support for custom scheduled callback statuses +# 110214-2320 - Added support for lead_order_secondary option +# 110215-1125 - Added support for call_notes +# 110218-1519 - Added support for agent lead search +# 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging +# 110225-1237 - Added scheduled callback lead info display to the lead info view function +# 110303-1616 - Added vicidial_log_extended logging for manual dial calls +# 110304-1207 - Changed lead search with territory restriction to work with agents that cannot select territories +# 110310-0546 - Added ability to set a pause code at the same time of a pause +# 110310-1628 - removed callslogview, extended lead info function to be used instead +# 110317-0222 - Logging bug fixes +# 110413-1245 - Added ALT dialing from scheduled callback list +# 110430-1925 - Added post_phone_time_diff_alert campaign feature +# 110625-0814 - Added screen_labels and label hide functions +# 110626-0127 - Added queuemetrics_pe_phone_append +# 110718-1158 - Added logging of skipped leads +# 110723-2256 - Added disable_alter_custphone HIDE option for call logs display +# 110731-2318 - Added dispo/start call url logging to DB table +# 110901-1117 - Added areacode custom cid function +# 111006-1425 - Added call_count_limit campaign option +# 111015-2104 - Added SEARCHCONTACTSRESULTSview function +# 111018-1529 - Added more fields to contact search +# 111021-1549 - Added old_CID variable to help clear alt-dial-old calls +# 111021-1707 - Added callback_hours_block feature +# 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option +# 120104-2031 - Fixed missing fullname variable before dispo and start URLs +# 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.2.0-142'; -$build = '100301-1342'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=309; +$mysql_log_count=438; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -419,6 +490,40 @@ 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"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} +if (isset($_GET["CallBackLead狀態"])) {$CallBackLead狀態=$_GET["CallBackLead狀態"];} + elseif (isset($_POST["CallBackLead狀態"])) {$CallBackLead狀態=$_POST["CallBackLead狀態"];} +if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} + elseif (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} +if (isset($_GET["search"])) {$search=$_GET["search"];} + elseif (isset($_POST["search"])) {$search=$_POST["search"];} +if (isset($_GET["sub_status"])) {$sub_status=$_GET["sub_status"];} + elseif (isset($_POST["sub_status"])) {$sub_status=$_POST["sub_status"];} +if (isset($_GET["qm_extension"])) {$qm_extension=$_GET["qm_extension"];} + elseif (isset($_POST["qm_extension"])) {$qm_extension=$_POST["qm_extension"];} +if (isset($_GET["disable_alter_custphone"])) {$disable_alter_custphone=$_GET["disable_alter_custphone"];} + elseif (isset($_POST["disable_alter_custphone"])) {$disable_alter_custphone=$_POST["disable_alter_custphone"];} +if (isset($_GET["bu_name"])) {$bu_name=$_GET["bu_name"];} + elseif (isset($_POST["bu_name"])) {$bu_name=$_POST["bu_name"];} +if (isset($_GET["department"])) {$department=$_GET["department"];} + elseif (isset($_POST["department"])) {$department=$_POST["department"];} +if (isset($_GET["group_name"])) {$group_name=$_GET["group_name"];} + elseif (isset($_POST["group_name"])) {$group_name=$_POST["group_name"];} +if (isset($_GET["job_title"])) {$job_title=$_GET["job_title"];} + elseif (isset($_POST["job_title"])) {$job_title=$_POST["job_title"];} +if (isset($_GET["location"])) {$location=$_GET["location"];} + elseif (isset($_POST["location"])) {$location=$_POST["location"];} +if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} + elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -434,10 +539,103 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; $US='_'; +while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);} +$check_time = ($StarTtime - 86400); + +$secX = date("U"); +$hour = date("H"); +$min = date("i"); +$sec = date("s"); +$mon = date("m"); +$mday = date("d"); +$year = date("Y"); +$isdst = date("I"); +$Shour = date("H"); +$Smin = date("i"); +$Ssec = date("s"); +$Smon = date("m"); +$Smday = date("d"); +$Syear = date("Y"); + +### Grab Server GMT value from the database +$stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; +$rslt=mysql_query($stmt, $link); +$gmt_recs = mysql_num_rows($rslt); +if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } +else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + +$LOCAL_GMT_OFF = $SERVER_GMT; +$LOCAL_GMT_OFF_STD = $SERVER_GMT; + +##### Hangup Cause Dictionary ##### +$hangup_cause_dictionary = array( +0 => "Unspecified. No other cause codes applicable.", +1 => "Unallocated (unassigned) number.", +2 => "No route to specified transit network (national use).", +3 => "No route to destination.", +6 => "Channel unacceptable.", +7 => "Call awarded, being delivered in an established channel.", +16 => "Normal call clearing.", +17 => "使用者 busy.", +18 => "No user responding.", +19 => "No answer from user (user alerted).", +20 => "Subscriber absent.", +21 => "Call rejected.", +22 => "Number changed.", +23 => "Redirection to new destination.", +25 => "Exchange routing error.", +27 => "Destination out of order.", +28 => "無效 number format (address incomplete).", +29 => "Facilities rejected.", +30 => "Response to 狀態 INQUIRY.", +31 => "Normal, unspecified.", +34 => "No circuit/channel available.", +38 => "Network out of order.", +41 => "Temporary failure.", +42 => "Switching equipment congestion.", +43 => "Access information discarded.", +44 => "Requested circuit/channel not available.", +50 => "Requested facility not subscribed.", +52 => "Outgoing calls barred.", +54 => "Incoming calls barred.", +57 => "Bearer capability not authorized.", +58 => "Bearer capability not presently available.", +63 => "Service or option not available, unspecified.", +65 => "Bearer capability not implemented.", +66 => "Channel type not implemented.", +69 => "Requested facility not implemented.", +79 => "Service or option not implemented, unspecified.", +81 => "無效 call reference value.", +88 => "Incompatible destination.", +95 => "無效 message, unspecified.", +96 => "Mandatory information element is missing.", +97 => "Message type non-existent or not implemented.", +98 => "Message not compatible with call state or message type non-existent or not implemented.", +99 => "Information element / parameter non-existent or not implemented.", +100 => "無效 information element contents.", +101 => "Message not compatible with call state.", +102 => "Recovery on timer expiry.", +103 => "Parameter non-existent or not implemented - passed on (national use).", +111 => "Protocol error, unspecified.", +127 => "Interworking, unspecified." +); + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -448,6 +646,11 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; + $alt_log_server_ip = $row[3]; + $alt_log_dbname = $row[4]; + $alt_log_login = $row[5]; + $alt_log_pass = $row[6]; + $tables_use_alt_log_db = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -458,7 +661,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 { @@ -466,6 +669,8 @@ else $pass = ereg_replace("'|\"|\\\\|;","",$pass); } +$session_name = ereg_replace("'|\"|\\\\|;","",$session_name); +$server_ip = ereg_replace("'|\"|\\\\|;","",$server_ip); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -696,7 +901,7 @@ if ($ACTION == 'LogiNCamPaigns') $camps_to_print = mysql_num_rows($rslt); 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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + $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     WÄHLEN  
在這一天沒有電話
$u$ALLcall_date[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $Allfirst_name[$i] $Alllast_name[$i] $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i] INFO DIAL
"; + echo "
"; + echo "關閉通話記錄"; + echo "
"; + } + + +################################################################################ +### SEARCHRESULTSview - display search results for lead search +################################################################################ +if ($ACTION == 'SEARCHRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $lead_id=ereg_replace("[^0-9]","",$lead_id); + $vendor_lead_code = ereg_replace("'|\"|\\\\|;","",$vendor_lead_code); + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $city = ereg_replace("'|\"|\\\\|;","",$city); + $state = ereg_replace("'|\"|\\\\|;","",$state); + $postal_code = ereg_replace("'|\"|\\\\|;","",$postal_code); + + if (strlen($lead_id) > 0) + { + ### lead ID entered, search by this + $searchSQL = "lead_id='$lead_id'"; + } + elseif (strlen($vendor_lead_code) > 0) + { + ### vendor ID entered, search by this + $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + } + elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) + { + ### phone number entered, search by this + if (preg_match('/MAIN|ALT|ADDR3/',$search)) + {$searchSQL = "(";} + if (preg_match('/MAIN/',$search)) + {$searchSQL .= "phone_number='$phone_number'";} + if (preg_match('/ALT/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "alt_phone='$phone_number'"; + } + if (preg_match('/ADDR3/',$search)) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " or ";} + $searchSQL .= "address3='$phone_number'"; + } + if (strlen($searchSQL) > 10) + {$searchSQL .= ")";} + } + elseif (strlen($last_name) > 0) + { + ### last name entered, search by this and other fields + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($city) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "city='$city'"; + } + if (strlen($state) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "state='$state'"; + } + if (strlen($postal_code) > 0) + { + if (strlen($searchSQL) > 10) + {$searchSQL .= " and ";} + $searchSQL .= "postal_code='$postal_code'"; + } + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name\n"; + echo "

"; + echo "回上一頁"; + echo "
"; + exit; + } + + $searchownerSQL=''; + ### limit results to specified search method + # USER_, GROUP_, TERRITORY_ + if (preg_match('/USER_/',$agent_lead_search_method)) + {$searchownerSQL=" and owner='$user'";} + if (preg_match('/GROUP_/',$agent_lead_search_method)) + { + $stmt="SELECT user_group from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00386',$user,$server_ip,$session_name,$one_mysql_log);} + $groups_to_parse = mysql_num_rows($rslt); + if ($groups_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $searchownerSQL=" and owner='$rowx[0]'"; + } + } + if (preg_match('/TERRITORY_/',$agent_lead_search_method)) + { + $agent_territories=''; + $agent_choose_territories=0; + $stmt="SELECT agent_choose_territories from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00404',$user,$server_ip,$session_name,$one_mysql_log);} + $Uterrs_to_parse = mysql_num_rows($rslt); + if ($Uterrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_choose_territories = $rowx[0]; + } + + if ($agent_choose_territories < 1) + { + $stmt="SELECT territory from vicidial_user_territories where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00405',$user,$server_ip,$session_name,$one_mysql_log);} + $vuts_to_parse = mysql_num_rows($rslt); + $o=0; + while ($vuts_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories .= "'$rowx[0]',"; + $o++; + } + $agent_territories = preg_replace("/\,$/",'',$agent_territories); + $searchownerSQL=" and owner IN($agent_territories)"; + if ($vuts_to_parse < 1) + {$searchownerSQL=" and lead_id < 0";} + } + else + { + $stmt="SELECT agent_territories from vicidial_live_agents where user='$user';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00387',$user,$server_ip,$session_name,$one_mysql_log);} + $terrs_to_parse = mysql_num_rows($rslt); + if ($terrs_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $agent_territories = $rowx[0]; + $agent_territories = preg_replace("/ -$|^ /",'',$agent_territories); + $agent_territories = preg_replace("/ /","','",$agent_territories); + $searchownerSQL=" and owner IN('$agent_territories')"; + } + } + } + + ### limit results to specified search method + # 'SYSTEM','CAMPAIGNLISTS','CAMPLISTS_ALL','LIST' + if (preg_match('/SYSTEM/',$agent_lead_search_method)) + {$searchmethodSQL='';} + if (preg_match('/LIST/',$agent_lead_search_method)) + {$searchmethodSQL=" and list_id='$manual_dial_list_id'";} + if (preg_match('/CAMPLISTS_ALL/',$agent_lead_search_method)) + { + $stmt="SELECT list_id from vicidial_lists where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00375',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + if (preg_match('/CAMPAIGNLISTS/',$agent_lead_search_method)) + { + $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign' and active='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00376',$user,$server_ip,$session_name,$one_mysql_log);} + $lists_to_parse = mysql_num_rows($rslt); + $camp_lists=''; + $o=0; + while ($lists_to_parse > $o) + { + $rowx=mysql_fetch_row($rslt); + $camp_lists .= "'$rowx[0]',"; + $o++; + } + $camp_lists = eregi_replace(".$","",$camp_lists); + $searchmethodSQL=" and list_id IN($camp_lists)"; + } + + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00377',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00378',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rslt); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00379',$user,$server_ip,$session_name,$one_mysql_log);} + + + echo "
\n"; + echo ""; + echo "結果發現: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} + $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"; + $ALLname[$g] = "$row[0] $row[1]"; + $ALLphone_code[$g] = $row[2]; + $ALLphone_number[$g] = $row[3]; + $ALLstatus[$g] = $row[4]; + $ALLcall_date[$g] = $row[5]; + $ALLlead_id[$g] = $row[6]; + $ALLcity[$g] = $row[7]; + $ALLstate[$g] = $row[8]; + $ALLpostal_code[$g] = $row[9]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set 秒='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00381',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     NAME     PHONE     狀態     LAST 撥號     CITY     STATE     ZIP     INFO     WÄHLEN  
沒有找到結果
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$i] INFO DIAL
沒有找到結果
"; + echo "
"; + echo "回上一頁"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "回上一頁"; + echo "
"; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: 活動 not found\n"; + echo "

"; + echo "回上一頁"; + echo "
"; + exit; + } + } + + + +################################################################################ +### SEARCHCONTACTSRESULTSview - display search results for contacts search +################################################################################ +if ($ACTION == 'SEARCHCONTACTSRESULTSview') + { + if (strlen($stage) < 3) + {$stage = '670';} + + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + if ($camps_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $agent_lead_search_method = $row[0]; + $manual_dial_list_id = $row[1]; + + $searchSQL=''; + $searchmethodSQL=''; + + $last_name = ereg_replace("'|\"|\\\\|;","",$last_name); + $first_name = ereg_replace("'|\"|\\\\|;","",$first_name); + $phone_number = ereg_replace("'|\"|\\\\|;","",$phone_number); + $bu_name = ereg_replace("'|\"|\\\\|;","",$bu_name); + $department = ereg_replace("'|\"|\\\\|;","",$department); + $group_name = ereg_replace("'|\"|\\\\|;","",$group_name); + $job_title = ereg_replace("'|\"|\\\\|;","",$job_title); + $location = ereg_replace("'|\"|\\\\|;","",$location); + + if (strlen($phone_number) >= 2) + { + $searchSQL .= "office_num='$phone_number'"; + } + elseif (strlen($last_name) > 0) + { + $searchSQL = "last_name='$last_name'"; + if (strlen($first_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "first_name='$first_name'"; + } + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($first_name) > 0) + { + $searchSQL = "first_name='$first_name'"; + if (strlen($bu_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "bu_name='$bu_name'"; + } + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($bu_name) > 0) + { + $searchSQL = "bu_name='$bu_name'"; + if (strlen($department) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "department='$department'"; + } + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($department) > 0) + { + $searchSQL = "department='$department'"; + if (strlen($group_name) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "group_name='$group_name'"; + } + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($group_name) > 0) + { + $searchSQL = "group_name='$group_name'"; + if (strlen($job_title) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "job_title='$job_title'"; + } + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($job_title) > 0) + { + $searchSQL = "job_title='$job_title'"; + if (strlen($location) > 0) + { + if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} + $searchSQL .= "location='$location'"; + } + } + elseif (strlen($location) > 0) + { + $searchSQL = "location='$location'"; + } + else + { + echo "ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name\n"; + echo "

"; + echo "回上一頁"; + echo "
"; + exit; + } + + ##### BEGIN search queries and output ##### + $stmt="SELECT count(*) from contact_information where $searchSQL;"; + + ### LOG INSERTION Search Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = ereg_replace(';','',$SQL_log); + $SQL_log = addslashes($SQL_log); + $stmtL="INSERT INTO vicidial_lead_search_log set event_date='$NOW_TIME', user='$user', source='agent', results='0', search_query=\"$SQL_log\";"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00432',$user,$server_ip,$session_name,$one_mysql_log);} + $search_log_id = mysql_insert_id($link); + + if ( (preg_match("/contact_information/",$tables_use_alt_log_db)) and (strlen($alt_log_server_ip)>4) and (strlen($alt_log_dbname)>0) ) + { + $linkALT=mysql_connect("$alt_log_server_ip", "$alt_log_login", "$alt_log_pass"); + mysql_select_db("$alt_log_dbname", $linkALT); + } + else + {$linkALT = $link;} + + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00433',$user,$server_ip,$session_name,$one_mysql_log);} + $counts_to_print = mysql_num_rows($rsltALT); + if ($counts_to_print > 0) + { + $row=mysql_fetch_row($rsltALT); + $search_result_count = $row[0]; + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set results='$search_result_count',seconds='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00434',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "
\n"; + echo ""; + echo "結果發現: $search_result_count"; + echo "\n"; + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if ($search_result_count) + { + $stmt="SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where $searchSQL order by first_name,last_name desc limit 1000;"; + $rsltALT=mysql_query($stmt, $linkALT); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkALT,$mel,$stmt,'00435',$user,$server_ip,$session_name,$one_mysql_log);} + $out_logs_to_print = mysql_num_rows($rsltALT); + if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} + + $g=0; + $u=0; + while ($out_logs_to_print > $u) + { + $row=mysql_fetch_row($rsltALT); + $ALLsort[$g] = "$row[0]-----$g"; + $ALLfirst[$g] = $row[0]; + $ALLlast[$g] = $row[1]; + $ALLoffice_num[$g] = $row[2]; + $ALLcell_num[$g] = $row[3]; + $ALLother_num1[$g] = $row[4]; + $ALLother_num2[$g] = $row[5]; + $ALLbu_name[$g] = $row[6]; + $ALLdepartment[$g] = $row[7]; + $ALLgroup_name[$g] = $row[8]; + $ALLjob_title[$g] = $row[9]; + $ALLlocation[$g] = $row[10]; + + $g++; + $u++; + } + + if ($g < 1) + {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 "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + $end_process_time = date("U"); + $search_seconds = ($end_process_time - $StarTtime); + + $stmtL="UPDATE vicidial_lead_search_log set 秒='$search_seconds' where search_log_id='$search_log_id';"; + if ($DB) {echo "|$stmtL|\n";} + $rslt=mysql_query($stmtL, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00436',$user,$server_ip,$session_name,$one_mysql_log);} + } + else + {echo "";} + + echo "
  #     FIRST NAME     LAST NAME     OFFICE     MOBILE     OTHER 1     OTHER 2     BU NAME  
沒有找到結果
$u $ALLfirst[$i] $ALLlast[$i]   $ALLoffice_num[$i]   $ALLcell_num[$i]   $ALLother_num1[$i]   $ALLother_num2[$i] $ALLbu_name[$i]
            Dept: $ALLdepartment[$i]       Group: $ALLgroup_name[$i]       Job: $ALLjob_title[$i]       Location: $ALLlocation[$i]
沒有找到結果
"; + echo "
"; + echo "回上一頁"; + echo "
"; + } + else + { + echo "ERROR: There was a problem with your search terms\n"; + echo "

"; + echo "回上一頁"; + echo ""; + exit; + } + ##### END search queries and output ##### + } + else + { + echo "ERROR: 活動 not found\n"; + echo "

"; + echo "回上一頁"; + echo ""; + exit; + } + } + + + +################################################################################ +### LEADINFOview - display the information for a lead and logs for that lead +################################################################################ +if ($ACTION == 'LEADINFOview') + { + if (strlen($lead_id) < 1) + {echo "ERROR: no Lead ID";} + else + { + $hide_dial_links=0; + echo "
\n"; + + if ($search == 'logfirst') + {$hide_dial_links++;} + + ### BEGIN Display callback information ### + $callback_id = preg_replace('/\D/','',$callback_id); + if (strlen($callback_id) > 0) + { + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} + $cb_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$cb_to_print|$stmt|";} + if ($cb_to_print > 0) + { + $row=mysql_fetch_row($rslt); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
回調狀態:   $row[0]
回調鉛狀態:   $row[7]
回調錄入時間:   $row[1]
回調觸發時間:   $row[2]
回調評論:   $row[6]
"; + echo "
"; + $hide_dial_links++; + } + } + ### END Display callback information ### + + ### find the screen_label for this campaign + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} + $csl_to_print = mysql_num_rows($rslt); + if ($format=='debug') {echo "|$csl_to_print|$stmt|";} + if ($csl_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $screen_labels = $row[0]; + } + + ### BEGIN Display lead info and custom fields ### + ### BEGIN find any custom field labels ### + $INFOout=''; + $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 = 'Vendor ID'; + $label_gender = 'Gender'; + $label_phone_number = '電話'; + $label_phone_code = 'DialCode'; + $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,label_hide_field_logs from system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00417',$user,$server_ip,$session_name,$one_mysql_log);} + $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];} + $label_hide_field_logs = $row[19]; + + if ( ($screen_labels != '--SYSTEM-SETTINGS--') and (strlen($screen_labels)>1) ) + { + $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,label_hide_field_logs from vicidial_screen_labels where label_id='$screen_labels' and active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00418',$user,$server_ip,$session_name,$one_mysql_log);} + $screenlabels_count = mysql_num_rows($rslt); + if ($screenlabels_count > 0) + { + $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];} + $label_hide_field_logs = $row[19]; + ### END find any custom field labels ### + $hide_gender=0; + if ($label_gender == '---HIDE---') + {$hide_gender=1;} + } + } + ### END find any custom field labels ### + + $INFOout .= ""; + + $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); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} + $info_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$INFOout .= "|$out_logs_to_print|$stmt|";} + + if ($info_to_print > 0) + { + $row=mysql_fetch_row($rslt); + + ##### BEGIN check for postal_code and phone time zones if alert enabled + $post_phone_time_diff_alert_message=''; + $stmt="SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00415',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_pptda_ct = mysql_num_rows($rslt); + if ($camp_pptda_ct > 0) + { + $rowx=mysql_fetch_row($rslt); + $post_phone_time_diff_alert = $rowx[0]; + $local_call_time = $rowx[1]; + } + if ( ($post_phone_time_diff_alert == 'ENABLED') or (preg_match("/OUTSIDE_CALLTIME/",$post_phone_time_diff_alert)) ) + { + $postal_code = $row[17]; + $phone_code = $row[5]; + $phone_number = $row[6]; + $state = $row[15]; + ### get current gmt_offset of the phone_number + $postalgmtNOW = ''; + $USarea = substr($phone_number, 0, 3); + $PHONEgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$PHONEgmt_offset,$state); + + $postalgmtNOW = 'POSTAL'; + $POSTgmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmtNOW,$postal_code); + $POSTdialable = dialable_gmt($DB,$link,$local_call_time,$POSTgmt_offset,$state); + + # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; + $post_phone_time_diff_alert_message = ''; + + if ($PHONEgmt_offset != $POSTgmt_offset) + { + $post_phone_time_diff_alert_message .= "電話 and Post Code Time Zone Mismatch! "; + + if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') + { + $post_phone_time_diff_alert_message=''; + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " 可撥打區外的電話區號 $PHONEgmt_offset       ";} + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " 可撥打區外的郵政編碼 $POSTgmt_offset";} + } + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + {$post_phone_time_diff_alert_message = '';} + + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($PHONEdialable < 1) + {$post_phone_time_diff_alert_message .= " 可撥打區外的電話區號 $PHONEgmt_offset       ";} + } + if ( ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL') or ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') ) + { + if ($POSTdialable < 1) + {$post_phone_time_diff_alert_message .= " 可撥打區外的郵政編碼 $POSTgmt_offset ";} + } + + if (strlen($post_phone_time_diff_alert_message)>5) + {$INFOout .= "";} + } + ##### END check for postal_code and phone time zones if alert enabled + + $INFOout .= ""; + if ( ($label_vendor_lead_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + $INFOout .= ""; + if ( ($label_phone_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_phone_number!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_middle_initial!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_last_name!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address1!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address2!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_address3!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_city!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_state!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_province!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_postal_code!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + if ( ($label_gender!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_alt_phone!='---HIDE---') or ($label_hide_field_logs=='N') ) + { + $INFOout .= ""; + if ( ($label_email!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_security_phrase!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + if ( ($label_comments!='---HIDE---') or ($label_hide_field_logs=='N') ) + {$INFOout .= "";} + $INFOout .= ""; + $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + # $INFOout .= ""; + + $entry_list_id = $row[28]; + $CFoutput=''; + $stmt="SHOW TABLES LIKE \"custom_$entry_list_id\";"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00382',$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_$entry_list_id where lead_id='$lead_id';"; + if ($DB>0) {$INFOout .= "$stmt";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00383',$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="SHOW COLUMNS FROM custom_$entry_list_id where Field != 'lead_id';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00384',$user,$server_ip,$session_name,$one_mysql_log);} + $fields_to_print = mysql_num_rows($rslt); + $select_SQL=''; + $o=0; + while ($fields_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $select_SQL .= "$rowx[0],"; + $A_field_name[$o] = $rowx[0]; + $o++; + } + $select_SQL = preg_replace("/.$/",'',$select_SQL); + if (strlen($select_SQL) > 0) + { + $stmt="SELECT $select_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,'00385',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {$INFOout .= "$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 = trim("$row[$o]"); + + $INFOout .= ""; + + $o++; + } + } + } + } + } + } + + $INFOout .= "
$post_phone_time_diff_alert_message
狀態:   $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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   DIAL"; + } + $INFOout .= "
$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] -         "; + if ($hide_dial_links < 1) + {$INFOout .= "DIAL";} + } + $INFOout .= "
$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]
$A_field_name[$o]:   $A_field_value
"; + $INFOout .= "
"; + ### END Display lead info and custom fields ### + + + ### BEGIN Gather Call Log and notes ### + $NOTESout=''; + if ($search != 'logfirst') + {$NOTESout .= "
這導致通話記錄:
\n";} + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + # $NOTESout .= ""; + # $NOTESout .= ""; + $NOTESout .= ""; + + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $out_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLin_out[$g] = "OUT-AUTO"; + if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";} + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLuniqueid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $out_notes_to_print = mysql_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $in_logs_to_print = mysql_num_rows($rslt); + if ($format=='debug') {$NOTESout .= "|$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]; + $ALLuniqueid[$g] = $row[10]; + $ALLclosecallid[$g] = $row[11]; + $ALLuser[$g] = $row[12]; + $ALLalt_dial[$g] = "MAIN"; + $ALLin_out[$g] = "IN"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='$ALLlead_id[$g]' and vicidial_id='$ALLclosecallid[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $in_notes_to_print = mysql_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $Allcall_notes[$g] = $rowA[0]; + if (strlen($Allcall_notes[$g]) > 0) + {$Allcall_notes[$g] = "NOTES: $Allcall_notes[$g]";} + } + $stmtA="SELECT full_name FROM vicidial_users WHERE user='$ALLuser[$g]';"; + $rsltA=mysql_query($stmtA, $link); + $users_to_print = mysql_num_rows($rslt); + if ($users_to_print > 0) + { + $rowA=mysql_fetch_row($rsltA); + $ALLuser[$g] .= " - $rowA[0]"; + } + + $Allcounter[$g] = $g; + + $g++; + $u++; + } + + if ($g > 0) + {sort($ALLsort, SORT_NUMERIC);} + else + {$NOTESout .= "";} + + $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"';} + + $phone_number_display = $ALLphone_number[$i]; + if ($disable_alter_custphone == 'HIDE') + {$phone_number_display = 'XXXXXXXXXX';} + + $u++; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= "\n"; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= ""; + $NOTESout .= "\n"; + } + + $NOTESout .= "
  #     DATE/TIME     AGENT     LENGTH     狀態     PHONE     CAMPAIGN     IN/OUT     ALT     HANGUP  
  FULL NAME  
沒有調用發現
$u$ALLcall_date[$i] $ALLuser[$i] $ALLlength_in_sec[$i] $ALLstatus[$i] $ALLphone_code[$i] $phone_number_display $ALLcampaign_id[$i] $ALLin_out[$i] $ALLalt_dial[$i] $ALLhangup_reason[$i]
$Allcall_notes[$i]
"; + $NOTESout .= "
"; + ### END Gather Call Log and notes ### + + + if ($search == 'logfirst') + {echo "$NOTESout\n$INFOout\n";} + else + {echo "$INFOout\n$NOTESout\n";} + + echo "
"; + } + } + + + ################################################################################ ### CALLSINQUEUEgrab - grab a call in queue and reserve it for that agent ################################################################################ @@ -6572,12 +9767,12 @@ if ($ACTION == 'CALLSINQUEUEgrab') } else { - $stmt="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; + $stmtU="UPDATE vicidial_auto_calls set agent_grab=\"$user\" where auto_call_id='$stage' and agent_grab='' and status='LIVE';"; if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); + $rslt=mysql_query($stmtU, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00234',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - if ($affected_rows > 0) + $VACaffected_rows = mysql_affected_rows($link); + if ($VACaffected_rows > 0) { $stmt="SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='$stage';"; $rslt=mysql_query($stmt, $link); @@ -6602,13 +9797,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; } } @@ -6618,11 +9827,28 @@ if ($ACTION == 'CALLSINQUEUEgrab') ################################################################################ if ($ACTION == 'CalLBacKLisT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + $callback_list_calltime = $row[1]; + $local_call_time = $row[2]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6644,13 +9870,18 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); - echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; + $PHONEdialable=1; + if ($callback_list_calltime == 'ENABLED') + { + $PHONEdialable = dialable_gmt($DB,$link,$local_call_time,$row[3],$row[4]); + } + echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count] ~$PHONEdialable\n"; $loop_count++; } @@ -6662,18 +9893,56 @@ if ($ACTION == 'CalLBacKLisT') ################################################################################ if ($ACTION == 'CalLBacKCounT') { + $campaignCBhoursSQL = ''; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$camp_count = mysql_num_rows($rslt);} + if ($camp_count > 0) + { + $row=mysql_fetch_row($rslt); + $callback_hours_block = $row[0]; + if ($callback_hours_block > 0) + { + $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-$callback_hours_block,date("i"),date("s"),date("m"),date("d"),date("Y"))); + $campaignCBhoursSQL = "and entry_time < \"$x_hours_ago\""; + } + } + $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - else - {$campaignCBsql = '';} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql and status NOT IN('INACTIVE','DEAD');"; + + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - echo "$cbcount"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL 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"; } @@ -6684,7 +9953,7 @@ if ($ACTION == 'CalLBacKCounT') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats 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,'00252',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6699,41 +9968,41 @@ 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') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; - - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) +##### Hangup Cause Description Map ##### +function hangup_cause_description($code) { - $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); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/LANG_www/agc_tw/vdc_form_display.php b/agc_2-X/trunk/LANG_www/agc_tw/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_tw/vdc_form_display.php @@ -0,0 +1,469 @@ + 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 +# 110719-0856 - Added HIDEBLOB type +# 110730-2335 - Added call_id variable +# 111025-1433 - Fixed case sensitivity on list fields +# 120315-1729 - Filtere out single quotes and backslashes from custom fields +# + +$version = '2.4-8'; +$build = '120315-1729'; + +require("dbconnect.php"); +require_once("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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + + +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"];} + $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes + + 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') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') ) + { + $A_field_value[$o]='----IGNORE----'; + } + else + { + if (preg_match("/\|$A_field_label[$o]\|/i",$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_once("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/agc_2-X/trunk/LANG_www/agc_tw/vdc_script_display.php b/agc_2-X/trunk/LANG_www/agc_tw/vdc_script_display.php index 8c9bb87d..6cd51669 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/vdc_script_display.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/vdc_script_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed display the contents of the SCRIPT tab in the agent interface # @@ -11,10 +11,16 @@ # 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 +# 110420-1201 - Added web_vars variable +# 110730-2339 - Added call_id variable +# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll # -$version = '2.2.0-5'; -$build = '100116-0702'; +$version = '2.4-11'; +$build = '120227-2017'; require("dbconnect.php"); @@ -160,10 +166,33 @@ 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"];} +if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];} + elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];} +if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];} + elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];} + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -177,7 +206,6 @@ $CIDdate = date("mdHis"); $ENTRYdate = date("YmdHis"); $MT[0]=''; $agents='@agents'; - $script_height = ($script_height - 20); $IFRAME=0; @@ -252,6 +280,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 +303,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 +322,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 +391,19 @@ 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); + $web_vars = eregi_replace(' ','+',$web_vars); } $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 +471,38 @@ $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); +$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text); +$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$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); @@ -422,12 +510,12 @@ $script_text = stripslashes($script_text); echo "\n"; echo "\n"; echo "
\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
$script_name
\n"; echo "$script_text\n"; -if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) - { echo "
";} +if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) ) + {echo "
";} echo "
\n"; exit; diff --git a/agc_2-X/trunk/LANG_www/agc_tw/vdc_script_notes.php b/agc_2-X/trunk/LANG_www/agc_tw/vdc_script_notes.php new file mode 100644 index 00000000..f18fc7ce --- /dev/null +++ b/agc_2-X/trunk/LANG_www/agc_tw/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 = 'Vendor ID'; +$label_gender = 'Gender'; +$label_phone_number = '電話'; +$label_phone_code = 'DialCode'; +$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 "無效 Username/密碼: |$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/agc_2-X/trunk/LANG_www/agc_tw/vicidial.php b/agc_2-X/trunk/LANG_www/agc_tw/vicidial.php index 96a53353..1a3ac785 100644 --- a/agc_2-X/trunk/LANG_www/agc_tw/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_tw/vicidial.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # Other scripts that this application depends on: # - vdc_db_query.php: Updates information in the database # - 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,19 +273,120 @@ # 100109-0801 - Added ALTNUM alt number status, fixed alt number dialing from setting # 100109-1338 - Fixed Manual dial live call detection # 100116-0709 - Added presets to script and web form variables -# 100203-0640 - Fixed logging issues related to INBOUND_MAN dial method -# 100207-1109 - Changed Pause Codes function to allow for multiple pause codes per pause period -# 100228-1257 - Fixed no-selected default transfer group issue on inbound calls -# 100301-1329 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100123-0954 - changes to AGENTDIRECT selection span +# 100131-2233 - Added functions to allow for a webphone loaded in a separate IFRAME +# 100203-0639 - Fixed logging issues related to INBOUND_MAN dial method +# 100207-1103 - Changed Pause Codes function to allow for multiple pause codes per pause period +# 100220-1040 - Added Call Log View and Customer Info View and fixed HotKeys position +# 100221-1107 - Added Custom CID compatibility +# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field +# 100302-2145 - Added scheduled callbacks alert feature +# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade +# 100309-0525 - Added queuemetrics_loginout option +# 100313-0053 - Added display options for transfer/conf buttons +# 100315-1148 - fix for rare recording_log uniqueid issue on manual dial calls to same number +# 100317-1301 - Added agent_fullscreen User Group option +# 100327-0901 - fix for manual dial answering machine message +# 100331-1220 - Added human-readable hangup codes for manual dial +# 100401-0019 - Added agent_choose_blended option +# 100413-1349 - Various small logging fixes and extended alt-dial fixes +# 100420-1009 - Added scheduled_callbacks_count option +# 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 +# 101124-0436 - Added manual dial queue and manual dial call time check features +# 101125-2151 - Changed CIDname for 3way calls +# 101128-0102 - Added list webform override options +# 101207-1621 - Added scroll to the top after in-group, pause code, etc... selections, and added focus blur to several functions +# 101208-1210 - Fixed focus/blur coding to work after Dispo +# 101216-1758 - Added the ability to hide fields if the label is set to ---HIDE--- in System Settings +# 101227-1645 - Added dialplan off toggle options, and settings and code changes for top bar webphone +# 110109-1205 - Added queuemetrics_loginout NONE option +# 110112-1254 - Added options.php option for focus/blur/enter functions +# 110129-1050 - Changed to XHTML compliant formatting, issue #444 +# 110208-1202 - Made scheduled callbacks notice move when on script/form tabs +# 110212-2206 - Added scheduled callback custom statuses compatibility +# 110215-1412 - Added my_callback_option and per_call_notes options +# 110218-1522 - Added agent_lead_search feature +# 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check +# 110225-1231 - Changed scheduled callbacks list to allow clicking to see lead info without dialing, and separate dial link +# 110303-2321 - Added notice of on-hook phone use, and ability to click 'ring' to call into session, minor queue_log fix +# 110304-1623 - Added callback count notification defer options +# 110310-0331 - Added auto-pause/resume functions in auto-dial mode for pre-call work +# 110310-1627 - Changed most browser alerts to HTML alerts, other bug fixes +# 110322-0923 - Allowed hiding of gender pulldown +# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes +# 110420-1211 - Added web_vars variable +# 110428-1549 - Added use of manual_dial_cid setting +# 110430-1126 - Added ability to use external_dial API function with lead_id and alt_dial options +# 110430-1924 - Added post_phone_time_diff_alert campaign feature +# 110506-1612 - Added custom_3way_button_transfer button feature +# 110510-1637 - Added number validation to custom_3way_button_transfer function +# 110526-1723 - Added webphone_auto_answer option +# 110528-1033 - Added waiting_on_dispo manual dial check +# 110531-2158 - Added callback_days_limit campaign feature +# 110619-2005 - Added disable_dispo_ options +# 110624-2311 - Added screen labels option and status display fields option +# 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility +# 110713-0048 - Allow for full hiding of the phone number field label +# 110718-1159 - Added logging of skipped leads +# 110719-0854 - Removed debug output and small display alignment changes +# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE +# 110730-2240 - Added option to hide dispo statuses, only to be used with API +# 110802-0122 - Added call_id variable +# 110911-1604 - Added API logout function +# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds +# 110919-1603 - Added Phone login load balancing grouping options +# 111015-2037 - Added contact search functions +# 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates +# 111021-1623 - Fix for rare stuck vac issue with manual alt dial +# 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options +# 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options +# 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled +# 120308-1617 - Added compatibility for DAHDI phones using asterisk version for server > 1.4.21.2 +# 120403-1204 - Fixed issue with MANUAL dial method hotkeys, added 1 second delay # -$version = '2.2.0-254'; -$build = '100301-1329'; +$version = '2.4-344c'; +$build = '120403-1204'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=64; +$mysql_log_count=75; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -355,13 +457,15 @@ $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y")); $past_minutes_date = date("Y-m-d H:i:s",$minutes_old); +$webphone_width = 460; +$webphone_height = 500; $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,pllb_grouping_limit FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -380,6 +484,9 @@ 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]; + $SSpllb_grouping_limit = $row[13]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -387,6 +494,8 @@ if ($qm_conf_ct > 0) ##### DEFINABLE SETTINGS AND OPTIONS ########################################### + +# set defaults for hard-coded variables $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 @@ -414,22 +523,80 @@ $PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT WÄHLEN 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 on the agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$focus_blur_enabled = '0'; # set to 1 to enable the focus/blur enter key blocking(some IE instances have issues) +$consult_custom_delay = '2'; # number of 秒 to delay consultative transfers when customfields are active -$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen +$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen, FOR DEBUG ONLY $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 +$webphone_width = 460; # set the webphone frame width +$webphone_height = 500; # set the webphone frame height +$webphone_pad = 0; # set the table cellpadding for the webphone +$webphone_location = 'right'; # set the location on the agent screen 'right' or 'bar' $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6 $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0 +$FORM_COLOR = '#EFEFEF'; $SIDEBAR_COLOR = '#F6F6F6'; -# 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 +# if options file exists, use the override values for the above variables +# see the options-example.php file for more information +if (file_exists('options.php')) + { + require('options.php'); + } +### 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 = 'Vendor ID'; +$label_gender = 'Gender'; +$label_phone_number = '電話'; +$label_phone_code = 'DialCode'; +$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 ### + +$hide_gender=0; +if ($label_gender == '---HIDE---') + {$hide_gender=1;} $US='_'; $CL=':'; @@ -447,19 +614,27 @@ 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"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 -echo "\n"; -echo "\n"; +echo ' + + + + + + +'; echo "\n"; echo "\n"; if ($campaign_login_list > 0) { - $camp_form_code = "\n"; $camp_form_code .= "\n"; $LOGallowed_campaignsSQL=''; @@ -536,7 +711,7 @@ if ($campaign_login_list > 0) if ($VD_campaign) { if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) ) - {$camp_form_code .= "\n";} + {$camp_form_code .= "\n";} else { if (!ereg('login_allowable_campaigns',$camp_form_code)) @@ -554,7 +729,7 @@ if ($campaign_login_list > 0) } else { - $camp_form_code = "\n"; + $camp_form_code = "\n"; } @@ -562,29 +737,32 @@ if ($LogiNAJAX > 0) { ?> - @@ -10563,249 +12720,436 @@ else \n"; +$zi=2; ?> - -
- - MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 VALIGN=TOP ALIGN=LEFT> -
- - - -     - - 0) {echo "TERRITORIES     \n";} ?> - 0) {echo "GROUPS     \n";} ?> -登出\n"; ?> -
-
+ - - height=30> - - - - - -
MAINSCRIPT VALIGN=MIDDLE ALIGN=CENTER>  LIVE   session ID:    通話中電話
+ + + +
+
+
+
+
+
+
+           Loading +
+
+
- - - height=>

Agent Screen
+ + + +
+ + + + + 以使用者身份登入 + ring)";} + echo "  to campaign: $VD_campaign  \n"; + ?> +     + + 0) {echo "TERRITORIES     \n";} ?> + 0) {echo "GROUPS     \n";} ?> + 登出\n"; ?> +
- -人工撥號       快速撥號
+ + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   session ID:    通話中電話
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + 狀態:
+
+ 撥下一個號碼
+ + + LEAD PREVIEW
+ 撥打其他電話
+ + 錄音檔:
+
+
+ 音檔編號:
+
+ + 啟動錄音
+
+ 表格
+ 0) + {echo "\"表格
\n";} + ?> +  
+ Park Call
+ \"IVR
\n";} + else + {echo "\n";} + ?> + 轉接 - 電話會議
+ + 0) + {echo "\"Quick
\n";} + if ($custom_3way_button_transfer_enabled > 0) + {echo "\"自定義傳輸\"
\n";} + ?> + + + + 0) + {echo "
\n";} + ?> + +
+ 掛斷客戶電話
+
+
傳送 DTMF

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
  客戶的時間:                         渠道:
客戶資訊:         + 引領搜索";} + ?> +
+ + + + +
+ ";} + else + {echo "$label_title: ";} + if ($label_first_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_first_name: ";} + if ($label_middle_initial == '---HIDE---') + {echo "  ";} + else + {echo "  $label_middle_initial: ";} + if ($label_last_name == '---HIDE---') + {echo "  ";} + else + {echo "  $label_last_name: ";} + + echo "
"; + + if ($label_address1 == '---HIDE---') + {echo " ";} + else + {echo "$label_address1: ";} + + echo "
"; + + if ($label_address2 == '---HIDE---') + {echo " ";} + else + {echo "$label_address2: ";} + + echo ""; + + if ($label_address3 == '---HIDE---') + {echo " ";} + else + {echo "$label_address3: ";} + + echo "
"; + + if ($label_city == '---HIDE---') + {echo " ";} + else + {echo "$label_city: ";} + + echo ""; + + if ($label_state == '---HIDE---') + {echo " ";} + else + {echo "$label_state: ";} + + echo ""; + + if ($label_postal_code == '---HIDE---') + {echo " ";} + else + {echo "$label_postal_code: ";} + + echo "
"; + + if ($label_province == '---HIDE---') + {echo " ";} + else + {echo "$label_province: ";} + + echo ""; + + if ($label_vendor_lead_code == '---HIDE---') + {echo " ";} + else + {echo "$label_vendor_lead_code: ";} + + echo ""; + + if ($label_gender == '---HIDE---') + { + echo ""; + } + else + { + echo "$label_gender: "; + } + + echo "
"; + + if ($label_phone_number == '---HIDE---') + { + echo " "; + echo "   "; + } + else + { + echo "$label_phone_number: "; + + if ( (ereg('Y',$disable_alter_custphone)) or (ereg('HIDE',$disable_alter_custphone)) ) + { + echo "                     "; + echo ""; + } + else + { + echo ""; + } + } + + echo ""; + + if ($label_phone_code == '---HIDE---') + {echo " ";} + else + {echo "$label_phone_code: ";} + + echo ""; + + if ($label_alt_phone == '---HIDE---') + {echo " ";} + else + {echo "$label_alt_phone: ";} + + echo "
"; + + if ($label_security_phrase == '---HIDE---') + {echo " ";} + else + {echo "$label_security_phrase: ";} + + echo ""; + + if ($label_email == '---HIDE---') + {echo " ";} + else + {echo "$label_email: ";} + + echo "
"; + + if ($label_comments == '---HIDE---') + { + echo " \n"; + } + else + { + echo "$label_comments: "; + if ( ($multi_line_comments) ) + {echo "\n";} + else + {echo "\n";} + } + + echo "
\n"; + + if ($per_call_notes == 'ENABLED') + { + echo "呼叫備註: "; + if ($agent_call_log_view == '1') + {echo "
查看筆記 ";} + echo "
"; + echo "\n"; + } + else + { + echo " \n"; + } + + + ?> + +
+
+ +
+
+  
+  
+ + +
+ + + + + +人工撥號       快速撥號
- -X 生效的回撥電話
+ +
- -
+ +查看通話記錄
- 秒: -     + +     + + + +
版本:   版次:     主機:              
+ + 顯示電話會議中的來電通道資訊 +

 
+
+ 0) ) + {echo "Alert is ON";} + else + {echo "Alert is OFF";} + ?> +
+ + +
+
+ + 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> +關閉快捷鍵 + + + 秒: +    
- +
+
+ + +您目前的狀態:
Calls Dialing: +
+ + D1 - WÄHLEN\n"; - echo "
\n"; + echo "   \n"; echo "D2 - WÄHLEN\n"; } - else {echo "
\n";} + else {echo "
\n";} ?> -

 
+

 
- - height=>
值機員的回撥電話 :
點選以下回撥紀錄進行客戶回撥,如果點選紀錄進行撥號,該筆紀錄將會從名單內移除. -
-
-
  - 更新 -                 - 回上一頁 -
-
+
 呼籲在隊列:  
 
- - height=>
新的人工撥號紀錄給 :

請輸入下面的資訊給您想要外撥的新紀錄. -
- \n"; - } - ?> - Note: all new manual dial leads will go into list

- - - - - - - - - - - - - - - -
Dial Code:   (This is usually a 1 in the USA-Canada)
電話 Number: -   (12 digits max - digits only) -
搜尋存在的紀錄:   (本選項勾選時,在增加新的紀錄時會尋找系統中的電話號碼)
-

-     -
-

If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the 撥號S IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there.
 
Dial Override:   (限數字碼輸入) -
-
- 立即撥號 -                 - 預覽電話 -                 - 回上一頁 -
-
- - - -
-
- - - - -您目前的狀態:
Calls Dialing: -
- - - - - > - - -
-
- - 轉接 - 電話會議            
- - - - - - - - - - - - - - - - - - - - - - - -
- - - LOCAL CLOSER     - - 掛斷轉接線 -
- seconds -   - channel - - 協商   - - 全部掛斷 -
- 撥打號碼 -   -   - 經營者 - - - 重撥 - - 離開三方通話 -
- Dial Blind Transfer -   - Dial With Customer -   - Park Customer Dial -   - - D1 - D2 - D3 - D4 - D5 - -   - Blind Transfer VMail Message -
- -
-
-
-
- - - -
 呼籲在隊列:  
 
- - + 0) { @@ -10817,189 +13161,349 @@ if ($view_calls_in_queue > 0) ?> + +X 生效的回撥電話
+
-
  -其他代理狀態:  
 
+
  +其他代理狀態:  
 
-
-可用代理轉讓:
+$webphone_content
\n"; + } +else + { + echo "
  + Web 電話:  
$webphone_content
\n"; + } +?> -
Agents View +
- +
代理商查看 +
+ + + +
  Web電話 View -
+ + + + 0) { - echo "Dialable Leads:
 \n"; + echo "可撥打信息:
 \n"; } ?>
- + - - - height=70> - -
設定結束碼為:

- -
-
+ +
\n";} + ?> +
AGENT SCRIPT
- - height=70> - +
結束碼快捷鍵: + +refresh + + + +
\n";} + ?> +
+
+ + +refresh + + + + + + + +
+ + + 轉接 - 電話會議            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + LOCAL CLOSER     + + 掛斷轉接線 +
+ seconds +   + channel + + 協商   + + 全部掛斷 +
+ 撥打號碼 +   + +                     + +   + + 經營者 + + + + + 重撥 + + 離開三方通話 +
+ Dial Blind Transfer +   + Dial With Customer +   + Park Customer Dial +   + + 預設按鈕 + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+可用代理轉讓:
+ + + + + +
設定結束碼為:

+ -
+
+
+ + + + - - + - + -
結束碼快捷鍵: 啟用時,只需點選結束碼對應之快捷鍵,系統即會自動下結束碼與掛斷電話:
+ - + - + -
+
- - height=70> - - - + +
過去的回撥資訊: close
+ + + - - + -
過去的回撥資訊: close
-
-
-
-
+ +
+
+
+
-
+
+
- - height=70> - - - + +
擴充的其他電話資訊: 最小
+ + + - - + -
擴充的其他電話資訊: 最小
-
-
-
-
+
+
+
+
+
-
+
+
- - - - -
最大
Alt 電話 Info
+ + + + +
最大
Alt 電話 Info
- - height=>
無人在你主持的會議中:
+ +
無人在你主持的會議中:
回上一頁 -

- 再次呼叫值機員 -
+

+ 再次呼叫值機員 +
- - height=>
客戶已掛斷電話:
+ +
客戶已掛斷電話:
回上一頁 -

+

結束通話並註記結束碼 -
+
- - height=>
電話文書: 文書狀態尚餘秒數

+ +
電話文書: 文書狀態尚餘秒數

-

+

結束文書並繼續 -
+
- -
-


+ +
+


關閉消息 -
+
- - height=>
Your session has been disabled
登出

回上一頁 -
+ +
Your session has been disabled
登出

回上一頁 +
- - height=>
系統中有時間同步問題,請洽系統管理者


回上一頁 -
+ +
系統中有時間同步問題,請洽系統管理者


回上一頁 +
- - height=>

登出
+ +

登出
- -
+ +
- -
 
+ +
 
- - height=47>
你必須先更改客戶資料,再掛斷電話。否則所做變更將不會生效!.
+ +
你必須先更改客戶資料,再掛斷電話。否則所做變更將不會生效!.
- - height=>
通話結束 :       再次掛斷       最小
+ +
通話結束 :       再次掛斷       最小
+
\n";} + ?> + + + 結束碼選擇 -
- 暫停值機員撥號
+
+ 暫停值機員撥號
清除表單 | 確認送出 -

+

WEB FORM 確認送出 -

  -
+

  +
- - height=>
選擇暫停原因代碼 :
- 暫停 Code Selection - -

  -
-
- - - height=>
選擇群組代名 :
- 群組代名選擇 - -

  -
-
- - - - - - height=>
選擇回撥日期 :
- - + +
選擇回撥日期 :
+
\n";} + ?> + + 選擇日期小於       Hour: - @@ -11014,7 +13518,7 @@ if ($agent_display_dialable_leads > 0)   Minutes: - @@ -11029,267 +13533,371 @@ if ($agent_display_dialable_leads > 0)   - -  
+  
只有個人回撥
";} + {echo " 只有個人回撥
";} ?> - CB 備註:

+ CB 備註:

- 確認送出

+ 確認送出

-

  -
+

  +
- - height=>
CLOSER INBOUND GROUP SELECTION
- Closer Inbound Group Selection -
+ +
值機員的回撥電話 :
看到下面的回調的信息,請單擊“信息”鏈接。現在回頭來調用客戶,單擊撥號鏈接。如果您單擊下面的記錄撥打它,它會被從名單中剔除. +
0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') ) + if ($webphone_location == 'bar') + {echo "

\n";} + ?> +
+
  + 更新 +                 + 回上一頁 +
+
+ + +
新的人工撥號紀錄給 :

請輸入下面的資訊給您想要外撥的新紀錄. +
+ \n"; + } + ?> + Note: all new manual dial leads will go into list

+ + + + + + + + + + + + + + + +
Dial Code:   (This is usually a 1 in the USA-Canada)
電話 Number: +   (digits only) + + + +
搜尋存在的紀錄:   (本選項勾選時,在增加新的紀錄時會尋找系統中的電話號碼)
+

+     +
+

If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the 撥號S IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there.
 
Dial Override:   (限數字碼輸入) +
+
+ 立即撥號 +                 + 預覽電話 +                 + 回上一頁 +
+
+ + +
CLOSER INBOUND GROUP SELECTION
+
\n";} + ?> + Closer Inbound Group Selection +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) { ?> - INBOUND/OUTBOUND BLENDING(啟動外撥)
+ INBOUND/OUTBOUND BLENDING(啟動外撥)
重置 | 確認送出 -



  -
+



  +
- - height=>
TERRITORY SELECTION
+ +
領地的選擇
+
\n";} + ?> Territory Selection -
+
重置 | 確認送出 -



  -
+



  +
- - + 渠道 渠道 只有個人回撥
";} - if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') ) - {echo " INBOUND/OUTBOUND BLENDING
";} + {echo " 只有個人回撥
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " INBOUND/OUTBOUND BLENDING
";} ?>
- - - height=>
AGENT SCRIPT
+ +
      AGENT 撥號 LOG:             close [X]
+
\n";} + ?> +
Call log List
+

  +
- -refresh + +
      搜索聯繫人:             close [X]
+
\n";} + ?> +

+ 注:時,做了一個接觸搜索,通配符或部分搜索條件不允許.
聯繫人搜索請求都記錄在系統. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
名 Name:
姓 Name:
BU Name:
Department:
Group Name:
Job 職銜:
Location:

確認送出 SEARCH             復位形式
+

  +
+
+ + +
      聯繫人搜索結果:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      作者:帶頭作用:             close [X]
+
\n";} + ?> +

+ 注:做一個領先的搜索時,電話號碼,導致ID或 是最好的領域使用.
使用的其他領域可能會比較慢。鉛搜索不允許通配符或部分搜索字詞.
鉛的搜索請求都記錄在系統. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
電話 Number:
電話 Number Fields: + 主要電話號碼 + 備用電話號碼 + 地址3電話號碼 +
Lead ID:
:
:
:
:
:
:

確認送出 SEARCH             復位形式
+

  +
+
+ + +
      搜尋結果:             close [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      調用注意日誌:             close [X]
+
\n";} + ?> +
呼叫債券清單
+

  + 關閉信息框 +
+
+ + +
      客戶資訊:             close [X] +
+
\n";} + ?> + Lead Info +

  + 關閉信息框 +
+
+ + +
選擇暫停原因代碼 :
+
\n";} + ?> + 暫停 Code Selection + +

  +
+
+ + +
選擇預設 :
+
\n";} + ?> + Presets Selection + +
+
+ + +
選擇群組代名 :
+
\n";} + ?> + 群組代名選擇 + +

  +
+
+ + +
ALERT :
+     +

回上一頁 +
- 0) && ( ($user_level>=$HKuser_level) or ($VU_hotkeys_active > 0) ) ) { ?> -關閉快捷鍵 - + + + - -> +
Agent web-client version:     版次:               主機:              
- -顯示電話會議中的來電通道資訊 -

 
+
+ + + + + + +
+ +
+ + + + - - - -
+   Agent Alert!
- 0) ) - {echo "Alert is ON";} -else - {echo "Alert is OFF";} -?> -
- - +
+ + + + + + -
  +

+alert +
  +

+ + Alert Box +

+
+ +
  +
+
+
- - - - id="MainTable"> - - - - - - - - - - - - - - - -
狀態:
-
-撥下一個號碼
- LEAD PREVIEW
- 撥打其他電話
- - -錄音檔:
-
-
-音檔編號:
-
- -啟動錄音
-
-表格
- 0) - {echo "\"表格
\n";} -?> -
-Park Call
-轉接 - 電話會議
- - 0) - {echo "\"Quick
\n";} -?> - - - - 0) - {echo "
\n";} -?> - - -
-掛斷客戶電話
-
-
傳送 DTMF

-
-
-
align=left valign=top> - - - - - - - - - - - - -
- - - - - - - -
  Customer Time:   渠道:
客戶資訊:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
職銜:   名:   MI:  姓:
地址1:
地址2: 地址3:
市: 州: 郵遞區號:
省: Vendor ID: 性別:
電話: -                     "; - echo ""; - } -else - { - echo ""; - } -?> - -DialCode: 其他電話:
展現: 電郵:
備註: - -\n";} -else - {echo "\n";} -?> - -
-
- -
-
> - 
- + @@ -11299,26 +13907,4 @@ else exit; - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) - { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } - } -$one_mysql_log=0; -return $errno; -} - -?> +?> \ No newline at end of file diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 1b305c3a..49677aae 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -839,6 +839,8 @@ OTHER CHANGES: NOTE: IMPORTANT !!!!! disable this script on the crontab of all but one server on your cluster. +194. Added Danish agent web interface translation + diff --git a/agc_2-X/trunk/translations/br_language.txt b/agc_2-X/trunk/translations/br_language.txt index 6513292d..0e6f004a 100644 --- a/agc_2-X/trunk/translations/br_language.txt +++ b/agc_2-X/trunk/translations/br_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"JAN"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DEZ"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number_ptbr.gif| vdc_XB_channel.gif|vdc_XB_channel_ptbr.gif| vdc_XB_seconds.gif|vdc_XB_seconds_ptbr.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Você fez o logoff. Obrigado| astGUIclient web-client VERSION|Versão do cliente web do astGUIClient| astGUIclient web client|astGUIclient web client| @@ -490,3 +498,73 @@ CONSULTATIVE|CONSULTIVO| Close Message|Fechar Mensagem| TIMER NOTIFICATION|NOTIFICAÇÃO TIMER| >AGENTS<|>AGENTES<| +### START translations for 2.4 release ### +VIEW CALL LOG|VEJA Registro de chamadas| +click to dial|clique para marcar| +Close Call Log|Feche Registro de chamadas| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|VOCÊ DEVE ESTAR EM PAUSA PARA VER seu registro de chamadas| +Close Info Box|Info Box Fechar| +No calls on this day|Nenhuma chamada neste dia| +You are in ALT dial mode, you must finish the lead before logging out|Você está em ALT modo de discagem, você deve terminar a liderança antes de sair| +Presets Button|Botão Presets| +SELECT A PRESET|Selecione um Preset| +Customer Hung-up, 3-way Call Ended Automatically|Cliente Hung-up, 3-way chamada foi terminada automaticamente| +Manual Dial Queue Calls Waiting|Fila de Marcação Manual Chamadas em espera| +Manual Queue|Manual de fila| +This phone number is outside of the local call time|Este número de telefone se encontra fora do tempo chamada local| +Manual Queue is Off|Manual de fila é Off| +Manual Queue is On|Manual de fila está Ligado| +Call Notes:|Chame Notas:| +Call Notes List|Call List Notes| +view notes|ver as notas| +CALL NOTES LOG|Registro de chamadas NOTAS| +Close Call Notes|Feche as notas de chamada| +CALL LOG FOR THIS LEAD|CONVITE PARA ESTE LOG LEAD| +SEARCH FOR A LEAD|BUSCA POR UMA LEAD| +SEARCH RESULTS|RESULTADOS DA PROCURA| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|VOCÊ DEVE ser pausado Para procurar um LEAD| +Notes: when doing a search for a lead, the phone number, lead ID or|Notas: ao fazer uma busca por um chumbo, o número de telefone, levar identidade ou| +are the best fields to use|são as melhores campos para usar| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Usando os outros campos pode ser mais lento. Busca de chumbo não permite termos de pesquisa curinga ou parcial| +Lead search requests are all logged in the system|Solicitações de pesquisa de chumbo são todos registrados no sistema| +Main Phone Number|Número de telefone principal| +Alternate Phone Number|Número de telefone alternativo| +Address3 Phone Number|Endereço3 número de telefone| +No results found|Não foram encontrados resultados| +Results Found:|Resultados Encontrado:| +No calls found|Nenhuma chamada encontrado| +reset form|repor forma| +Callback Status|Estado de retorno de chamada| +Callback Lead Status|Callback Estado de chumbo| +Callback Entry Time|Tempo de entrada de retorno de chamada| +Callback Trigger Time|Callback tempo de disparo| +Callback Comments|Comentários de retorno de chamada| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Para ver informações sobre um dos callbacks abaixo, clique no link INFO. Para chamar o cliente de volta agora, clique no link DIAL. Se você clicar em um registro abaixo para marcá-lo, ele será removido da lista| +rings all available agents until one picks up the phone|anéis de todos os agentes disponíveis até que um pega o telefone| +No calls for this lead|Nenhuma chamada para essa liderança| +Time Zone Warning|Aviso de fuso horário| +Phone Area Code Outside Dialable Zone|Telefone Código de Área fora da zona discável| +Postal Code Outside Dialable Zone|Código Postal fora da zona discável| +Custom Transfer|Transferência personalizado| +System Delay, Please try again|Atraso do Sistema, por favor, tente novamente| +Disposition Status List Hidden|Lista disposição Estado Escondido| +The system has received a command to log you out, you have been logged out of your session|O sistema recebeu um comando para desconectá-lo, você foi desconectado da sessão| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Notas: ao fazer uma busca de um contato, termos de pesquisa curinga ou parcial não são permitidos| +Contact search requests are all logged in the system|Pedidos de busca de contato são todos registrados no sistema| +SEARCH FOR A CONTACT|Procurar um Contato| +CONTACTS SEARCH RESULTS|CONTACTOS PESQUISA| +LEAD SEARCH|LEAD PESQUISA| +Customer Time|Hora do cliente| +TERRITORY SELECTION|SELEÇÃO DE TERRITÓRIO| +TERRITORIES NOT SELECTED|TERRITÓRIOS NÃO SELECIONADA| +SELECTED TERRITORIES|territórios selecionados| +Dialable Leads|Leads discáveis| +You have now logged-in|Você tem agora registrados em| +You logged in at|Você logou em| +Refresh Campaign List|Atualizar lista de Campanha| +PLEASE SELECT A CAMPAIGN|Selecione uma campanha| +Agents View|Agentes Ver| +-READY|-PRONTO| +-INCALL|-Chamadas| +-PAUSED|-PAUSA| +CALL DISPOSITION|CONVITE DISPOSIÇÃO| diff --git a/agc_2-X/trunk/translations/de_language.txt b/agc_2-X/trunk/translations/de_language.txt index dab848d3..c985177e 100644 --- a/agc_2-X/trunk/translations/de_language.txt +++ b/agc_2-X/trunk/translations/de_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"JAN"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DEZ"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -75,6 +77,10 @@ vdc_LB_transferconf_OFF.gif|vdc_LB_transferconf_OFF_de.gif| vdc_tab_script.gif|vdc_tab_script_de.gif| vdc_volume_MUTE.gif|vdc_volume_MUTE_de.gif| vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE_de.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| You have now logged out. Thank you|Sie haben sich abgemeldet. Danke| astGUIclient web-client VERSION|astGUIclient Web-Client VERSION| astGUIclient web client|astGUIclient web client| @@ -495,3 +501,73 @@ CONSULTATIVE|BERATENDE| Close Message|Close Message| TIMER NOTIFICATION|Timer-Benachrichtigung| >AGENTS<|>Agenten<| +### START translations for 2.4 release ### +VIEW CALL LOG|VIEW CALL LOG| +click to dial|Click to Dial| +Close Call Log|Close Call Log| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|SIE MÜSSEN hielt inne, um Ihre Anrufliste ansehen zu können| +Close Info Box|Close Info Box| +No calls on this day|Keine Anrufe an diesem Tag| +You are in ALT dial mode, you must finish the lead before logging out|Sie sind in ALT Wählmodus, müssen Sie die Führung vor dem Abmelden beenden| +Presets Button|Presets-Taste| +SELECT A PRESET|Wählen Sie ein Preset| +Customer Hung-up, 3-way Call Ended Automatically|Kunden-Hung-up, Ended 3-Wege-Anruf automatisch| +Manual Dial Queue Calls Waiting|Manuelle Wahl Queue wartenden Anrufe| +Manual Queue|Manuelle Queue| +This phone number is outside of the local call time|Diese Rufnummer ist außerhalb des lokalen Zeit während des Bereitschaftsdienstes| +Manual Queue is Off|Manuelle Queue ist Aus| +Manual Queue is On|Manuelle Warteschlange auf| +Call Notes:|Rufen Hinweise:| +Call Notes List|Call Notes-Liste| +view notes|Notizen anzeigen| +CALL NOTES LOG|Call Notes LOG| +Close Call Notes|Close Call Notes| +CALL LOG FOR THIS LEAD|CALL-Protokoll für diesen LEAD| +SEARCH FOR A LEAD|SUCHE NACH EINEM KABEL| +SEARCH RESULTS|SUCHERGEBNISSE| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|SIE MÜSSEN FÜR EINEN hielt inne, um zu suchen LEAD| +Notes: when doing a search for a lead, the phone number, lead ID or|Hinweise: Bei einer Suche nach einem Blei, die Telefonnummer, ID oder führen| +are the best fields to use|sind die besten Felder zu verwenden| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Mit den anderen Bereichen kann langsamer sein. Lead-Durchsuchung nicht für Wildcard oder teilweise Suchbegriffe erlauben| +Lead search requests are all logged in the system|Lead-Suchanfragen sind alle im System angemeldet| +Main Phone Number|Haupt-Telefonnummer| +Alternate Phone Number|Alternative Telefonnummer| +Address3 Phone Number|Address3 Telefonnummer| +No results found|Keine Ergebnisse gefunden| +Results Found:|Ergebnisse gefunden:| +No calls found|Keine Anrufe gefunden| +reset form|Reset Form| +Callback Status|Callback-Status| +Callback Lead Status|Rückruf Blei-Status| +Callback Entry Time|Callback Eintrag Zeit| +Callback Trigger Time|Rückruf auszulösen Zeit| +Callback Comments|Rückruf Kommentare| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Um Informationen über eine der Rückrufe siehe unten, auf der INFO-Link klicken. Um den Kunden einen Rückruf jetzt, auf der DIAL-Link klicken. Wenn Sie unten auf einen Datensatz klicken, um ihn zu wählen, wird es aus der Liste entfernt werden| +rings all available agents until one picks up the phone|Ringe alle zur Verfügung stehenden Mitteln, bis einer nimmt den Hörer ab| +No calls for this lead|Keine Anrufe für diese Führung| +Time Zone Warning|Time Zone Warnung| +Phone Area Code Outside Dialable Zone|Telefon Code Außerhalb wählbare Zone| +Postal Code Outside Dialable Zone|PLZ Außerhalb wählbare Zone| +Custom Transfer|Kundenspezifische Transfer-| +System Delay, Please try again|System-Delay, bitte versuchen Sie es erneut| +Disposition Status List Hidden|Disposition Status-Liste ausgeblendet| +The system has received a command to log you out, you have been logged out of your session|Das System hat einen Befehl, um Sie automatisch ausloggen erhalten, haben Sie sich von der Sitzung protokolliert| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Hinweise: Wenn Sie eine Suche nach einem Kontakt, sind Platzhalter oder teilweise Suchbegriffen nicht erlaubt| +Contact search requests are all logged in the system|Kontakt Suchanfragen werden alle im System angemeldet| +SEARCH FOR A CONTACT|Suchen nach Namen| +CONTACTS SEARCH RESULTS|KONTAKTE SUCHERGEBNISSE| +LEAD SEARCH|LEAD SUCHE| +Customer Time|Kunden Zeit| +TERRITORY SELECTION|GEBIET AUSWAHL| +TERRITORIES NOT SELECTED|Gebiete, die nicht SELECTED| +SELECTED TERRITORIES|ausgewählten Gebieten| +Dialable Leads|dialable Leads| +You have now logged-in|Sie haben jetzt Angemeldete| +You logged in at|Sie sind angemeldet an| +Refresh Campaign List|Aktualisieren Kampagne Liste| +PLEASE SELECT A CAMPAIGN|Wählen Sie eine Kampagne| +Agents View|Agents anzeigen| +-READY|-BEREIT| +-INCALL|-INCALL| +-PAUSED|-PAUSED| +CALL DISPOSITION|Anruf-Dispositions| diff --git a/agc_2-X/trunk/translations/dk_language.txt b/agc_2-X/trunk/translations/dk_language.txt new file mode 100644 index 00000000..600ad1e2 --- /dev/null +++ b/agc_2-X/trunk/translations/dk_language.txt @@ -0,0 +1,516 @@ +# dk_language.txt - this file is for the internationalization of the astGUIclient +# client web pages. The associated install.pl file will take the language as an +# argument and alter the php scripts to the language typed in the command line: +# example: ./config.pl --language=dk +# current languages in the file: +# - English - (en) no alterations +# - Danish - (dk) first column +***LANGUAGES*** +en-English|dk-Dansk| +***FILES*** +agc|astguiclient.php|0 +agc|vicidial.php|0 +agc|vdc_db_query.php|0 +agc|manager_send.php|0 +agc|conf_exten_check.php|0 +agc|inbound_popup.php|0 +agc|active_list_refresh.php|0 +agc|park_calls_display.php|0 +agc|live_exten_check.php|0 +agc|call_log_display.php|0 +agc|voicemail_check.php|0 +agc|dbconnect.php|1 +agc|timeclock.php|0 +agc|vdc_script_display.php|1 +agc|vdc_script_notes.php|0 +agc|functions.php|1 +agc|vdc_form_display.php|1 +agc|calendar.css|1 +agc|calendar_db.js|0 +agc|phone_only.php|0 +***TRANSLATIONS*** +### special translations that should stay at the top of the file ### +"JAN"|"JAN"| +"FEB"|"FEB"| +"MAR"|"MAR"| +"APR"|"APR"| +"MAY"|"MAJ"| +"JUN"|"JUN"| +"JLY"|"JUL"| +"AUG"|"AUG"| +"SEP"|"SEP"| +"OCT"|"OKT"| +"NOV"|"NOV"| +"DEC"|"DEC"| +\./images/|../agc/images/| +css/|../agc/css/| +BORDER|Border| +VALUE=SUBMIT|VALUE=SUBMIT| +TYPE=SUBMIT|TYPE=Submit| +MAXLENGTH|maxlength| +### BEGIN translation phrases through 1.1.11 release ### +English|Engelsk| +Spanish|Spansk| +French|Fransk| +German|Tysk| +Italian|Italiensk| +You have now logged out. Thank you|Du er nu logget ud. Tak| +astGUIclient web-client VERSION|astGUIclient web-klient VERSION| +astGUIclient web client|web client astGUIclient| +VICIDIAL web client|web klient VICIDIAL| +VICIDIAL web-client version|VICIDIAL web-klient version| +You can only monitor Zap channels|Du kan kun medlytte zap kanaler| +Stop Record|Stop indspillning| +you are logged into this phone|Du er pålogget denne telefon| +Back to Main Window|Tilbage til hovedvinduet| +LIVE CALLS ON THIS PHONE|Denne telefons aktive samtaler| +LIVE CALLS IN THIS CONFERENCE|PÅGÅENDE SAMTALER I DENNA konference| +LIVE CALL TRANSFER|VIDERESTILLING AF PÅGÅENDE SAMTALE| +CLIENT CHANNEL|KUNDE KANAL| +REMOTE CHANNEL|REMOTE KANAL| +CLICK HERE TO LOG IN AGAIN|KLIK HER FOR AT LOGGE PÅ IGEN| +ACTIVE DISPLAY PAUSED|AKTIV SKÆRM I PAUSE| +Main Panel|Hoved Panel| +Active Lines Panel|Aktive linjer| +Conferences Panel|konference panel| +Check Voicemail|Check voicemail| +Live Call|Aktive samtaler| +Hangup Trunk|Læg på trunk| +Hijack Trunk|Overtage trunk| +Listen Trunk|Lytte trunk| +Active Local Menu|Aktive lokal menu| +Hangup Local|Læg på lokal| +Hijack Local|Overtage lokal| +Listen Local|lytte lokal| +Channel to be transferred|Kanal at viderestille| +Extensions Menu|Lokalnummer menu| +Send to selected extension|Send til valgt lokalnummer| +Send to selected vmail box|Send til valgt voicemail| +Send to this number|Send til dette nummer| +click on a number below to send to a conference|klik på et nummer forneden for at sende til en konference| +Send my channel too|Send min kanal også| +Conferences Menu|konference Menu| +LOCAL Extensions Dial|Lokal numre opkald| +Phone calling from|Telefon ringer fra| +Call selected extension|Ring valgt forbindelse| +Call selected vmail box|Ring valgt voicemail| +LOCAL DIAL EXTENSIONS|LOKALNUMRE| +OUTBOUND CALLS|UDGÅENDE OPKALD| +INBOUND CALLS|INDKOMMENDE OPKALD| +Refresh rate|Genopfrisk hyppighed| +MANUAL DIAL|MANUELT OPKALD| +CALL DATE\/TIME|OPKALD DATO\/TID| +LOCAL HANGUP|LÆG PÅ LOKALT| +PARKED CALLS|SAMTALE SAT PÅ VENT| +PARKED BY|SAT PÅ VENT AF| +PARKED TIME|VENTETID| +Registered to|Registrered til| +Enter Conference|Medvirk i konference| +Dial From Conf|Ring fra Konf| +Active Extensions|Aktive forbindelser| +Outside Lines|Externe linjer| +Local Extensions|Lokalforbindelser| +Data Goes Here|Data placeres her| +Trunk Action|Trunk handling| +Local Action|Lokal handling| +Conferences List|konference liste| +Click on a conference room number on the left for info on that conference|Klik på et konference nummer til venstre for info vdr den konference| +List Display|Display liste| +Live Extensions|Aktive forbindelser| +Busy Extensions|Forbindelser der er optagat| +Outside Lines|Externe linjer| +script runtime|skriptets tidsforbrug| +Call Log Display|Visning af opkaldslog| +is not valid|er ikke valid| +or protocol|eller protokol| +Conf Extension Check|check conf forbindelser| +has been registered to|er registrerat til| +LIVE INBOUND CALL|PÅGÅENDE INKOMMEDE OPKALD| +Number Dialed|Opkaldt nummer| +SEND TO MY VOICEMAIL|SEND TIL MIN VOICEMAIL| +Live Extension Check|Check aktive forbindelser| +Manager Send|Leder send| +command not inserted|ordre ikke givet| +command sent for|ordre sent for| +One of these variables|En af disse variabler| +must be greater than 2 characters|skal være større end 2 tegn| +must be greater than 14 characters|skal være større end 14 tegn| +must be set|skal stilles ind| +not sent|no enviado| +Cannot find empty conference|Kan ikke finde en tom konference| +is not live|er ikke aktiv| +RECORDING WILL LAST UP TO 60 MINUTES|INDSPILNING VARER OPTIL 60 MINUTER| +Parked Calls Display|OPKALD SAT PÅ VENT| +Database Query Script|Database Query Script| +Group Choice|Gruppe valg| +has been registered to user|er registreret til bruger| +HOPPER EMPTY|HOPPER TOM| +LOG NOT ENTERED|INTET I LOGGEN| +has been changed to|er ændret til| +information has been updated|informationen er opdateret| +is now in status|er nu i status| +Voicemail Check|Voicemail check| +voicemail box|voicemail box| +Re-Login|Logpå igen| +User Password|Bruger password| +User Login|Bruger login| +Phone Login|Telefon login| +Phone Password|Telefon password| +Campaign not active, please try again|Kampanje ikke aktiv, prøv igen| +Login incorrect, please try again|login er inkorrekt, prøv igen| +Campaign Login|Kampanje login| +Sorry, your phone login and password are not active in this system, please try again|Beklager din telefonlogin/password er ikke aktive på dette system, prøv igen| +leads left to call in hopper|leads der er tilbage at ringe i hopper| +CAMPAIGN CUSTOM PARKING|KAMPANJENS SPECIAL VENT| +CAMPAIGN DEFAULT PARKING|KAMPANJENS STANDARD VENT| +CAMPAIGN CUSTOM WEB FORM|KAMPANJENS SPECIAL WEBFORMULAR| +CAMPAIGN DEFAULT WEB FORM|KAMPANJENS STANDARD WEBFORMULAR| +CAMPAIGN ALLOWS CLOSERS|KAMPANJEN TILLADER LUKKERE| +CAMPAIGN ALLOWS NO CLOSERS|KAMPANJEN TILLADER IKKE LUKKERE| +USING PREVIOUS MEETME ROOM|BRUGER GAMMELT MEETME RUM| +USING NEW MEETME ROOM|BRUGER NYT MEETME RUM| +old QUEUE and INCALL reverted list|gammel QUEUE og INCALL vendt tilbage list| +old QUEUE and INCALL reverted hopper|gammel QUEUE og INCALL vendt tilbage hopper| +old vicidial_live_agents records cleared|gamle vicidial_live_agents log renset| +campaign is set to auto_dial_level|kampanjens auto_dial_level er sat til| +new vicidial_live_agents record inserted|Insertadas las grabaciones nueva de los vicidial_live_agents| +campaign is set to manual dial|kampanjen er sat manuelt opkald| +Sorry, there are no leads in the hopper for this campaign|Beklager der er ingen leads i hoppern til denne kampanje| +Dial Next Number|Ring næste nummer| +LIVE CALLS IN YOUR SESSION|AKTIVE SAMTALER I DIN SESSION| +Stop Recording|Stop indspilning| +Start Recording|Start indspilning| +Transfer number must have more than 1 digit|viderestillingsnummer ska have mere end 1 tal| +Grab Parked Call|Tag opkald på vent| +Park Call|Set opkald på vent| +Waiting for Ring|Venter på at det ringer| +Called 3rd party|ringer 3dje part| +LEAVE 3-WAY CALL|FORLAD 3 PARTS SAMTALE| +Dial With Customer|Ring med kunde| +Park Customer Dial|Set brugers opkald på vent| +Hangup Xfer Line|Læg på Xfer linje | +Hangup Both Lines|Læg på begge linjer| +Hangup Customer|læg på kunde| +Transfer - Conference|Forflyttning - konference| +LOCAL CLOSER|LUKKER LOKALT| +INTERNAL CLOSER|INTERN LUKKER| +Dial Blind Transfer|Ring blind forflytning| +Dial timed out, contact your system administrator|Ringetiden er udløbet,kontakt administrator| +No more leads in the hopper for campaign|Der er ikke flere leads i hopper for kampanje| +Web Form|Webformular| +You Must Select a Disposition|Du skal vælge et udfald| +GROUPS NOT SELECTED|GRUPPE IKKE VALGT| +SELECTED GROUPS|VALGTE GRUPPER| +You cannot log out during a Dial attempt|Du kan ikke logge ud under et opkaldsforsøg| +Wait 50 seconds for the dial to fail out if it is not answered|Vent i 50 sekunder om opkaldet ikke bliver besvaret| +STILL A LIVE CALL! Hang it up then you can log out|STADIG ET AKTIVT OPKALD! læg på og derefter kan du logge ud| +Hide conference call channel information|Gem conferance opkalds kanal information| +Show conference call channel information|Gem conferance opkalds kanal information| +Logged in as User|Inlogget som Bruger| +No one is in your session|Ingen er i din session| +Customer has hung up|Kunden har lagt røret på| +End-of-call Disposition Selection|Valg af samtalets afsluttende udfald| +CLOSER INBOUND GROUP SELECTION|LUKKERE INKOMMENDE GRUPPE VALG| +Closer Inbound Group Selection|Lukkere inkommende gruppe valg| +BLENDED CALLING|BLENDED OPKALD| +outbound activated|outbound aktiveret| +Preview the Lead then|forhåndsvis leadet derefter| +Lead was not reverted, there was an error|Lead ikke reverteret, der opstod en fejl| +call was not placed, there was an error|opkaldet fandt ikke sted, der opstod en fejl| +Number to call|Nummer at ringe| +Customer Information|Kunde information| +Lead Dispositioned As|Leadets udfald er| +Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call|Alle ændringer i kundeinfo der er lavet nu bliver ikke gemt du skal ændre information inden du lægger røret på| +When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically|Når aktivt tast den relevante genvejstast så bliver røret lagt på og udfald på opkaldet sat automatiskt| +Disposition Hot Keys|Udfalds genvejstaster| +Cust Time|Kunde tid| +RECORD ID|INDSPILNINGS ID| +RECORDING FILE|INDSPILNINGS FIL| +HOT KEYS ACTIVE|GENVEJSTASTER AKTIVE| +HOT KEYS INACTIVE|GENVEJSTASTER IKKE AKTIVE| +DIAL OVERRIDE|DIAL OVERRIDE| +SKIP LEAD|FORKAST LEAD| +DIAL LEAD|RING LEAD| +LEAD PREVIEW|FORHÅNDSVISNING AF LEAD| +PAUSE AGENT DIALING|PAUSE AF AGENT OPKALD| +DISPOSITION CALL|SÆT UDFALD PÅ OPKALD| + session ID| session ID| + to campaign| på kampanje| +Select a CallBack Date|Vælg en ring tilbage dato| + maximize | maximere | + minimize | minimer | +You must choose a date|Du ska vælge en dato| +Select a Date Below|Vælg en dato forneden| +Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list|Klik på genkald forneden kunde bliver ringet op forsvinder fra genkaldslisten| +If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there|If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there| +YOU CANNOT SKIP A CALLBACK OR MANUAL DIAL, YOU MUST DIAL THE LEAD|DU KAN IKKE FORKASTE ET GENKALD ELLER MANUELT OPKALD, DU SKAL RINGE LEADET| +YOU MUST BE PAUSED TO MANUAL DIAL A NEW LEAD IN AUTO-DIAL MODE|DU SKAL VÆRE I PAUSE FOR AT LAVE ET MANUELT OPKALD AF ET NYT LEAD I AUTODIAL-MODE| +Enter information below for the new lead you wish to call|Angiv information forneden vdr det nye lead du ønsker at ringe| +YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE|DU SKAL VÆRE I PAUSE FOR AT CHECKE GENKALD I AUTODIAL MODE| +Note: all new manual dial leads will go into list 999|OBS: alle nye manuelle opkalds leads kommer i liste 999| +YOU DO NOT HAVE PERMISSIONS TO TRANSFER CALLS|DU HAR IKKE TILLADELSE TIL AT VIDERESTILLE OPKALD| +will be added to the beginning of this number|tillagt i starten af numret| +This is usually a 1 in the USA-Canada|Dette plejer at være 45 i Danmark| +NEW MANUAL DIAL LEAD FOR|NYT LEAD FOR MANUELT OPKALD| +Finish and Disposition Call|Afslut og sæt udfald på opkald| +10 digits max - digits only|10 tal maks - kun tal| +Note: a dial prefix of|obs: et prefix:| +Hangup Again|Læg på igen| +Go Back|Gå tilbage| +Call Agent Again|Ring agent igen| +MY CALLBACK ONLY|KUN MINE GENKALD| +NO ACTIVE CALLBACKS|INGEN AKTIVE GENKALD| +ACTIVE CALLBACKS|AKTIVE GENKALD| +CALLBACKS FOR AGENT|GENKALD FOR AGENT| +Dial Code:|Dial Code:| +Dial Override|Dial Override| +digits only please|kun tal tak| +Dial Now|Ring Nu| +CB Comments|Kommentar vdr genkald| +Title|Títel| +Your Status|Din status| + STATUS| STATUS| + RESET| RESET| +CLEAR FORM|RENS FORMULAR| +SUBMIT|INDSEND| +Incoming|Inkommende| +Calling|Ringer| +Called|Opringt| +Campaign|Kampanje| +Status|Status| +Inserted|Indsat| + seconds| sekunder| +HELP|HJÆLP| + Login | Login | +Login:| Login:| +User |Bruger | +Password|Password| +VERSION|VERSION| +BUILD|BUILD| +Server|Server| +RECORD |INDSPILLNING | +>HANGUP|>LÆGPÅ| +>XFER|>XFER| +PARK|HOLD| +IN-NUMBER|IN-NUMMER| +NUMBER|NUMMER| +CALLERID|CALLERID| + CALL| OPKALD| +PICKUP|LØFT| +CONFERENCE|konference| +Refresh|Genopfrisk| +Send DTMF|Send DTMF| +ORDER|ORDER| + on | på | +>LOGOUT|>LOGUD| + Channel| Kanal| +Extensions|Linjer| +Conferences|konferencer| +Conference|konference| +Recording|Indspildning| +Record|indspild| +Welcome|Velkommen| +VOICEMAIL|VOICEMAIL| + NEW| NY| + OLD| GAMMEL| + Pause | Pause | +Resume|genoptag| +Faster|hurtigt| +Slower|langsomt| +Initializing|opstart| +Invalid|Ikke gyldigt| +Username|Brugernavn| +Notes|Notat| +First|Første| +MI: |IM: | +Last|Sidste| +Address|Adresse| +City|By| +State|Stat| +PostCode|Postnummer| +Province|Provins| +Vendor ID|Vendor ID| +DialCode|Landsnummer| +Alt. Phone|Alt. telefon| +Show|Vis| +Email|Email| +Comments|kommentar| +REFRESH|GENOPFRISK| +ALT PHONE DIAL|RING ALT NUMMER| +MAIN PHONE|HOVED TELEFON| +ALT PHONE|ALT TELEFONNUMMER| +ADDRESS3|ADRESSE3| +FINISH LEAD|AFSLUT LEAD| +Dial Alt Phone Number|Ring alt telefonnummer| +Phone|Telefon| + DIAL| RING| +SUBMIT FAVORITES CHANGES - requires logout|ANGIV VALG AF FAVORITER - udlogning er påkrævet| +BACK TO MAIN WINDOW - ignore changes made|TILBAGE TIL HOVEDVINDUE - gem ikke ændringer| +AVAILABLE EXTENSIONS|TILGÆNGLIGE LINJER| + edit| edit| + FAVORITES| FAVORITER| +### END translation phrases through 1.1.11 release ### +Search Existing Leads|Søg existerende Leads| +This option if checked will attempt to find the phone number in the system before inserting it as a new lead|Er dette valg gjort bliver der søgt i existerende leads efter nummeret inden et nyt lead bliver skabt| +Finish Wrapup and Move On|Afslut samtale afslut og kom videre| +seconds remaining in wrapup|sekunder tilbage i afslut| +Call Wrapup:|Samtale afslut:| +### months of the year for CallBack date select screen ### +January|Januar| +Frebruary|Feburar| +March|Marts| +April|April| +May|Maj| +June|Juni| +July|Juli| +August|August| +September|September| +October|Oktober| +November|November| +December|December| +### BEGIN translation phrases for 2.0.1 release ### +Previous Callback Information|Information vdr side genkald| +Last Call: |sidste opkald:| +CallBack: |Genkald:| +Agent: |Agent:| +Comments: |Kommentar:| +### BEGIN translation phrases for 2.0.2 release ### +VOLUME|VOLUMEN| +### BEGIN translation phrases for 2.0.3 release ### +FAST DIAL|HURTIG KALD| +YOU MUST ENTER A PHONE NUMBER AND DIAL CODE TO USE FAST DIAL|DU SKAL ANGIVE ET TELEFONNUMMER FOR AT BRUGE HURTIGKALD| + SELECT A PAUSE CODE :| VÆLG EN PAUSEKODE :| +ENTER A PAUSE CODE|TAST EN PAUSEKODE| +YOU MUST BE PAUSED TO ENTER A PAUSE CODE IN AUTO-DIAL MODE|DU SKAL VÆRE I PAUSE FOR VÆLGE EN PAUSE KODE NÅR SYSTEMET ER SAT TIL AUTODIAL| +Your session has been disabled|Din session er aflyst| +### BEGIN translation phrases for 2.0.5 release ### +Gender: |Køn:| +Date of Birth: |Fødselsdato:| +YOU MUST BE PAUSED TO CHANGE GROUPS|DU SKAL VÆRE I PAUSE FOR AT ÆNDRE GRUPPE| +Calls in Queue:|Samtaler i kø:| + Timeclock|Stempelklokke| +The user and password you entered are not active in the system|Brugernavnet og passwordet er ikke aktivt på dette system| +Please try again|Prøv venligst igen| +You cannot log in or out within 30 seconds of your last login or logout|Du kan ikke logge ind eller ud inden 30 sekunder efter dit sidste indlog/udlog| +You have now logged-out|Du har nu logget ud| +You logged out at |Du loggede ud:| +Amount of time you were logged-in: |Tid som du har været indlogget:| +ERROR: timeclock log entry already made: |Fejl: stempelklokken er allerede aktiv :| +BACK to Agent Login Screen|TILBAGE til Agent påloggning| +BACK to Administration|TILBAGE til administration| +BACK to Welcome Screen|TILBAGE til Velkomst skærm| +Time since you were last logged-in: |Tid siden sidste login:| +You last logged-out at: |Sist loggede du ud:| +Click LOGIN below to log-in|Klik LOGIN forneden for at logge på| +Amount of time you have been logged-in: |Tid du har været indlogget:| +You logged-in at:|Du loggede ind:| +Click LOGOUT below to log-out|Klik LOGOUT forneden for at logge ud| +Undefined|udefinert| +This phone number is not in the campaign lists|Dette telefonnummer er ikke i kampanjens liste| +Unspecified error|uspecificet fejl| +Extended Alt Phone Information: |Udvidet information vdr alt nummer:| +ALT DIAL NUMBER:|ALT NUMMER:| +Phone Code and Number:|landsnummer og telefonnummer:| +Notes: |Notat:| +Active: |Aktive:| +Alt Count: |Alt Count:| +Change this phone number to INACTIVE|Ændre dette telefonnummer til INAKTIVT| +Change this phone number to ACTIVE|Ændre dette telefonnummer til AKTIVT| +YOU MUST LOG IN TO THE TIMECLOCK FIRST|DU SKAL FØST LOGGE PÅ STEMPELKLOKKEN| +There is a time synchronization problem with your system, please tell your system administrator|der er problemer med synkroniseringen af klokke kontakt adminstrator| +Preview Call|Forhåndsvis opkald| +SELECT A GROUP ALIAS|VÆLG ET GRUPPE ALIAS| +Group Alias Selection|Gruppe alias valg| +Click Here to Choose a Group Alias|Klik her for at vælge et gruppe alias| +Group Alias|Gruppe alias| +ERROR: There are no Shifts enabled for your user group|FEJL: Ingen vagter er aktiveret for din bruger gruppe| +ERROR: You are not allowed to log in outside of your shift|FEJL: Du må ikke logge ind udenfor din vagttid| +MANAGER OVERRIDE|MANAGER OVERRIDE| +Your Shift is over or has changed, you have been logged out of your session|Din vagt er slut eller ændret du er logget ud fra din session| +### START translations for 2.2.0 release ### +You are not allowed to dial into other agent sessions|Du har ikke tilladelse at ring til andre agenters sessioner| +QUICK TRANSFER|QUIK FORFLYTTNING| +Other Agents Status|Andre agenters status| +Available Agents Transfer|Viderestilling tilrådighid for agenter| +Show Calls In Queue|Vis opkald der er i kø| +Calls In Queue|Opkald der er i kø| +Hide Calls In Queue|Gem opkald der i kø| +Calls in Queue View Disabled for this campaign|Muligheden for at se opkald i kø er ikke aktivt i denne kampanje| +YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE|DU SKAL VÆRE I PAUSE FOR AT TAGE OPKALD DER ER I KØ| +Manager |Din leder| +has selected your in-group choices|har valgt din in-gruppe| +CONSULTATIVE|FORESPØRGSEL| +Close Message|Lukke besked| +TIMER NOTIFICATION|Klokke Besked| +login_language=en_us|login_language=dk_dk| +>AGENTS<|>AGENTER<| +### START translations for 2.4 release ### +VIEW CALL LOG|SE Opkaldslog| +click to dial|klik for at ringe| +Close Call Log|Luk Opkaldslog| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|DU SKAL sættes på pause AT SE DIN CALL LOG| +Close Info Box|Luk Info Boks| +No calls on this day|Ingen opfordrer denne dag| +You are in ALT dial mode, you must finish the lead before logging out|Du befinder dig i ALT opkaldstilstanden, skal du afslutte føringen inden du logger ud| +Presets Button|Forudindstillinger Button| +SELECT A PRESET|Vælg en forudindstillet| +Customer Hung-up, 3-way Call Ended Automatically|Kunde Hung-up, 3-vejs Call afsluttes automatisk| +Manual Dial Queue Calls Waiting|Manuelt opkald kø ventende opkald| +Manual Queue|Manuel kø| +This phone number is outside of the local call time|Dette telefonnummer er uden for lokale opkald tid| +Manual Queue is Off|Manuel Queue er Off| +Manual Queue is On|Manuel Queue er On| +Call Notes:|Ring Noter:| +Call Notes List|Ring Notes List| +view notes|se noter| +CALL NOTES LOG|CALL NOTER LOG| +Close Call Notes|Close Call Notes| +CALL LOG FOR THIS LEAD|CALL log for denne LEAD| +SEARCH FOR A LEAD|Søg efter en LEAD| +SEARCH RESULTS|SØGERESULTATER| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|DU SKAL sættes på pause at søge efter et LEAD| +Notes: when doing a search for a lead, the phone number, lead ID or|Bemærkninger: når du laver en søgning efter en bly, telefonnummer, fører ID eller| +are the best fields to use|er de bedste felter til at anvende| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Brug de andre felter kan være langsommere. Bly søgning tillader ikke jokertegn eller delvis søgetermer| +Lead search requests are all logged in the system|Bly søgeanmodninger er alle logget ind i systemet| +Main Phone Number|Main Telefonnummer| +Alternate Phone Number|Alternativ Telefonnummer| +Address3 Phone Number|Address3 Telefonnummer| +No results found|Ingen resultater fundet| +Results Found:|Resultater fundet:| +No calls found|Ingen opkald fundet| +reset form|nulstille formular| +Callback Status|Tilbagekald status| +Callback Lead Status|Tilbagekald Lead status| +Callback Entry Time|Tilbagekald Nedstigning| +Callback Trigger Time|Tilbagekald Trigger Time| +Callback Comments|Tilbagekald Kommentarer| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Hvis du vil se oplysninger om en af ​​de tilbagekald nedenstående, klik på INFO linket. At ringe til kunden tilbage nu, klik på DIAL linket. Hvis du klikker på en post nedenfor for at ringe til det, vil det blive fjernet fra listen| +rings all available agents until one picks up the phone|ringe alle tilgængelige midler, indtil man tager telefonen| +No calls for this lead|Ingen opfordrer til, at dette bly| +Time Zone Warning|Time Zone Advarsel| +Phone Area Code Outside Dialable Zone|Telefon Area Code Udenfor Dialable Zone| +Postal Code Outside Dialable Zone|Postnummer Udenfor Dialable Zone| +Custom Transfer|Brugerdefineret Transfer| +System Delay, Please try again|System Delay, Prøv igen| +Disposition Status List Hidden|Disposition status skjult liste| +The system has received a command to log you out, you have been logged out of your session|Systemet har modtaget en kommando for at logge dig ud, er du blevet logget ud af din session| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Bemærkninger: når du laver en søgning efter en kontakt, der er wildcard eller delvis søgetermer ikke tilladt| +Contact search requests are all logged in the system|Kontakt søgeanmodninger er alle logget ind i systemet| +SEARCH FOR A CONTACT|Søg efter en kontaktperson| +CONTACTS SEARCH RESULTS|KONTAKT SØGERESULTATER| +LEAD SEARCH|LEAD SØG| +Customer Time|Kunde Time| +TERRITORY SELECTION|Valg af landområde| +TERRITORIES NOT SELECTED|TERRITORIER IKKE VALGT| +SELECTED TERRITORIES|UDVALGTE OMRÅDER| +Dialable Leads|Dialable Leads| +You have now logged-in|Du har nu logget ind| +You logged in at|Du er logget ind på| +Refresh Campaign List|Opdater Kampagne List| +PLEASE SELECT A CAMPAIGN|Vælg en kampagne| +Agents View|Agenter Vis| +-READY|-READY| +-INCALL|-Indgående| +-PAUSED|-PAUSE| +CALL DISPOSITION|CALL Disposition| diff --git a/agc_2-X/trunk/translations/el_language.txt b/agc_2-X/trunk/translations/el_language.txt index b889961d..84719957 100644 --- a/agc_2-X/trunk/translations/el_language.txt +++ b/agc_2-X/trunk/translations/el_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"ΙΑΝ"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"ΝΟΕ"| "DEC"|"ΔΕΚ"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number_el.gif| vdc_XB_channel.gif|vdc_XB_channel_el.gif| vdc_XB_seconds.gif|vdc_XB_seconds_el.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Έχετε αποσυνδεθεί. Σας ευχαριστούμε| astGUIclient web-client VERSION|ΈΚΔΟΣΗ astGUIclient| astGUIclient web client|χειριστής astGUIclient| @@ -485,3 +493,73 @@ CONSULTATIVE|ΣΥΜΒΟΥΛΕΥΤΙΚΗ| Close Message|Κλείσιμο Μηνύματος| TIMER NOTIFICATION|ΚΟΙΝΟΠΟΙΗΣΗ ΧΡΟΝΟΥ| >AGENTS<|>ΧΕΙΡΙΣΤΕΣ<| +### START translations for 2.4 release ### +VIEW CALL LOG|ΔΕΙΤΕ ΠΡΟΣΚΛΗΣΗ LOG| +click to dial|κάντε κλικ για να καλέσετε| +Close Call Log|Κλείστε Πρόσκληση Σύνδεση| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|ΘΑ ΠΡΕΠΕΙ ΝΑ ΠΑΥΣΗ ΓΙΑ ΝΑ ΔΕΙΤΕ Κλήσεων ΣΑΣ| +Close Info Box|Κλείσιμο Πληροφορίες| +No calls on this day|Δεν υπάρχουν κλήσεις για αυτή την ημέρα| +You are in ALT dial mode, you must finish the lead before logging out|Είστε σε λειτουργία κλήσης ALT, θα πρέπει να τελειώσει το προβάδισμα πριν από την αποσύνδεση| +Presets Button|Προεπιλογές Κουμπί| +SELECT A PRESET|Επιλέξτε ένα προκαθορισμένο| +Customer Hung-up, 3-way Call Ended Automatically|Πελάτης Hung-up, 3-Way Κλήση τερματίζεται αυτόματα| +Manual Dial Queue Calls Waiting|Εγχειρίδιο Ουρά σύνδεση κλήσεων Αναμονή| +Manual Queue|Εγχειρίδιο Ουρά| +This phone number is outside of the local call time|Αυτός ο αριθμός τηλεφώνου είναι έξω από την τοπική ώρα κλήσης| +Manual Queue is Off|Εγχειρίδιο ουρά είναι εκτός λειτουργίας| +Manual Queue is On|Εγχειρίδιο Ουρά είναι σε| +Call Notes:|Καλέστε Σημειώσεις:| +Call Notes List|Καλέστε Σημειώσεις Λίστα| +view notes|δείτε τις σημειώσεις| +CALL NOTES LOG|Σημειώσεων μητρώου κλήσεων| +Close Call Notes|Κλείστε σημειώσεις κλήσεων| +CALL LOG FOR THIS LEAD|Κλήσεων ΓΙΑ ΑΥΤΟ ΤΟ ΜΟΛΥΒΔΟ| +SEARCH FOR A LEAD|Αναζήτηση ΜΟΛΥΒΔΟΥ| +SEARCH RESULTS|ΑΠΟΤΕΛΕΣΜΑΤΑ ΑΝΑΖΗΤΗΣΗΣ| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|ΘΑ ΠΡΕΠΕΙ ΝΑ ΠΑΥΣΗ Για να αναζητήσετε ένα ΜΟΛΥΒΔΟΥ| +Notes: when doing a search for a lead, the phone number, lead ID or|Σημειώσεις: όταν κάνετε μια αναζήτηση για το μόλυβδο, τον αριθμό τηλεφώνου, να οδηγήσει ταυτότητας ή| +are the best fields to use|είναι τα καλύτερα πεδία για να χρησιμοποιήσετε| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Χρησιμοποιώντας τα άλλα πεδία μπορεί να είναι βραδύτερη. Ο μόλυβδος έρευνα δεν επιτρέπει μπαλαντέρ ή μερική όρους αναζήτησης| +Lead search requests are all logged in the system|Οι επικεφαλής όλων των αιτημάτων αναζήτησης συνδεδεμένοι στο σύστημα| +Main Phone Number|Κύρια Τηλέφωνο| +Alternate Phone Number|Αναπληρωτής Τηλέφωνο| +Address3 Phone Number|Address3 Τηλέφωνο| +No results found|Δεν βρέθηκαν αποτελέσματα| +Results Found:|Αποτελέσματα:| +No calls found|Δεν υπάρχουν Προκηρύξεις| +reset form|επαναφέρετε μορφή| +Callback Status|Κατάσταση επανάκλησης| +Callback Lead Status|Επανάκληση Κατάσταση μόλυβδο| +Callback Entry Time|Χρόνος εισόδου επανάκλησης| +Callback Trigger Time|Επανάκληση χρόνο ενεργοποίησης| +Callback Comments|Σχόλια επανάκλησης| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Για να δείτε πληροφορίες για ένα από τα παρακάτω callbacks, κάντε κλικ στο link. Για να καλέσετε τον πελάτη πίσω τώρα, κάντε κλικ στο σύνδεσμο DIAL. Αν κάνετε κλικ σε ένα αρχείο για να το καλέσετε, θα πρέπει να αφαιρεθεί από τον κατάλογο| +rings all available agents until one picks up the phone|δαχτυλίδια όλα τα διαθέσιμα μέσα έως ότου ένας να σηκώσει το τηλέφωνο| +No calls for this lead|Δεν υπάρχουν προσκλήσεις για το μόλυβδο| +Time Zone Warning|Χρόνος προειδοποίησης ζώνης| +Phone Area Code Outside Dialable Zone|Κώδικας Τηλέφωνο περιοχή εκτός της ζώνης Dialable| +Postal Code Outside Dialable Zone|Τ.Κ. Έξω Dialable Ζώνη| +Custom Transfer|Προσαρμοσμένη Μεταφορά| +System Delay, Please try again|Καθυστέρηση Σύστημα, παρακαλώ προσπαθήστε ξανά| +Disposition Status List Hidden|Διάθεση Λίστα Κρυφό Κατάσταση| +The system has received a command to log you out, you have been logged out of your session|Το σύστημα έχει λάβει εντολή για να κάνετε log out, σας έχει αποσυνδεθεί από τη συνεδρία σας| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Σημειώσεις: όταν κάνετε μια αναζήτηση για μια επαφή, δεν επιτρέπεται μπαλαντέρ ή μερική όρους αναζήτησης| +Contact search requests are all logged in the system|Τα αιτήματα αναζήτησης Επικοινωνία όλοι συνδεδεμένοι στο σύστημα| +SEARCH FOR A CONTACT|Αναζήτηση επαφής| +CONTACTS SEARCH RESULTS|ΕΠΙΚΟΙΝΩΝΙΑ ΑΠΟΤΕΛΕΣΜΑΤΑ ΑΝΑΖΗΤΗΣΗΣ| +LEAD SEARCH|ΜΟΛΥΒΔΟΣ ΑΝΑΖΗΤΗΣΗ| +Customer Time|Χρόνος πελατών| +TERRITORY SELECTION|ΕΠΙΛΟΓΗ ΕΔΑΦΟΣ| +TERRITORIES NOT SELECTED|Εδάφη που δεν ΕΠΙΛΕΓΜΕΝΕΣ| +SELECTED TERRITORIES|επιλεγμένα εδάφη| +Dialable Leads|Dialable Εκκινήσεις| +You have now logged-in|Τώρα έχετε συνδεδεμένων| +You logged in at|Μπορείτε συνδεδεμένος στο| +Refresh Campaign List|Ανανέωση Λίστα Εκστρατεία| +PLEASE SELECT A CAMPAIGN|Επιλέξτε μια καμπάνια| +Agents View|Δείτε πράκτορες| +-READY|-ΕΤΟΙΜΟ| +-INCALL|-Incall| +-PAUSED|-ΠΑΥΣΗ| +CALL DISPOSITION|ΠΡΟΣΚΛΗΣΗ διάθεση| diff --git a/agc_2-X/trunk/translations/es_language.txt b/agc_2-X/trunk/translations/es_language.txt index 3c60b997..c9be42c0 100644 --- a/agc_2-X/trunk/translations/es_language.txt +++ b/agc_2-X/trunk/translations/es_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"ENE"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DIC"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,225 +104,231 @@ vdc_XB_number.gif|vdc_XB_number_es.gif| vdc_XB_channel.gif|vdc_XB_channel_es.gif| vdc_XB_seconds.gif|vdc_XB_seconds_es.gif| vdc_tab_script.gif|vdc_tab_script_es.gif| -You have now logged out. Thank you|Usted ahora ha registrado hacia fuera. Gracias| -astGUIclient web-client VERSION|versión astGUIclient del tela-cliente| -astGUIclient web client|web client astGUIclient| -VICIDIAL web client|web client VICIDIAL| -VICIDIAL web-client version|versión web client VICIDIAL| -You can only monitor Zap channels|Usted puede supervisa solamente Zap los canales| -Stop Record|Pare la grabación| -you are logged into this phone|su teléfono| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| +You have now logged out. Thank you|Usted ha cerrado sesión. Gracias| +astGUIclient web-client VERSION|versión del cliente Web de astGUIclient| +astGUIclient web client|cliente Web de astGUIclient| +VICIDIAL web client|cliente Web de VICIDIAL| +VICIDIAL web-client version|versión del cliente Web de VICIDIAL| +You can only monitor Zap channels|Usted sólo puede monitorear los canales Zap| +Stop Record|Detener la grabación| +you are logged into this phone|Usted ha ingresado a este teléfono| Back to Main Window|Volver a la pantalla principal| LIVE CALLS ON THIS PHONE|LLAMADAS ACTIVAS EN ESTE TELÉFONO| LIVE CALLS IN THIS CONFERENCE|LLAMADAS ACTIVAS EN ESTA CONFERENCIA| LIVE CALL TRANSFER|TRANSFERIR LLAMADA ACTIVA| -CLIENT CHANNEL|CANAL CLIENTE| +CLIENT CHANNEL|CANAL DEL CLIENTE| REMOTE CHANNEL|CANAL REMOTO| -CLICK HERE TO LOG IN AGAIN|PINCHA AQUÍ PARA ENTRAR OTRA VEZ| -ACTIVE DISPLAY PAUSED|DISPLAY ACTIVO PAUSADO| -Main Panel|Pantalla Principal| -Active Lines Panel|Pantalla Lineas Activas| -Conferences Panel|Pantalla de Conferencias| -Check Voicemail|Comprobar buzón de voz| -Live Call|Llamada Activa| -Hangup Trunk|Colgar Trunk| -Hijack Trunk|Capturar Trunk| -Listen Trunk|Escuchar Trunk| -Active Local Menu|Menú Local Activa| -Hangup Local|Colgar Local| -Hijack Local|Capturar Local| -Listen Local|Escuchar Local| +CLICK HERE TO LOG IN AGAIN|HAGA CLICK AQUÍ PARA INICIAR SESIÓN OTRA VEZ| +ACTIVE DISPLAY PAUSED|DESPLIEGUE ACTIVO PAUSADO| +Main Panel|Panel principal| +Active Lines Panel|Panel de líneas activas| +Conferences Panel|Panel de conferencias| +Check Voicemail|Revisar el buzón de voz| +Live Call|Llamada activa| +Hangup Trunk|Colgar la troncal| +Hijack Trunk|Apoderarse de la troncal| +Listen Trunk|Escuchar la troncal| +Active Local Menu|Menú local activo| +Hangup Local|Colgar la local| +Hijack Local|Apoderarse de la local| +Listen Local|Escuchar la local| Channel to be transferred|Canal que va a ser transferido| -Extensions Menu|Menú Extensiones| -Send to selected extension|Envíe a la extensión seleccionada| -Send to selected vmail box|Enviar al buzón de voz seleccionada| -Send to this number|Envíe a este número| -click on a number below to send to a conference|Pinchar en un número de abajo para enviar a una conferencia| -Send my channel too|Enviar mi canal también| -Conferences Menu|Menú de Conferencias| -LOCAL Extensions Dial|Marcar a Extensiones LOCALES| -Phone calling from|Teléfono llamando desde| -Call selected extension|Llamar extensión seleccionada| -Call selected vmail box|Llamar buzón de voz seleccionado| -LOCAL DIAL EXTENSIONS|MARCAR EXTENSIONES LOCALES| +Extensions Menu|Menú de las extensiones| +Send to selected extension|Enviar a la extensión seleccionada| +Send to selected vmail box|Enviar al buzón de voz seleccionado| +Send to this number|Enviar a este número| +click on a number below to send to a conference|Haga click en el número siguiente para enviar a una conferencia| +Send my channel too|Enviar también a mi canal| +Conferences Menu|Menú de conferencias| +LOCAL Extensions Dial|Marcar a extensiones LOCALES| +Phone calling from|Llamada telefónica de| +Call selected extension|Llamar a la extensión seleccionada| +Call selected vmail box|Llamar al buzón de voz seleccionado| +LOCAL DIAL EXTENSIONS|EXTENSIONES DE MARCACIÓN LOCALES| OUTBOUND CALLS|LLAMADAS SALIENTES| INBOUND CALLS|LLAMADAS ENTRANTES| Refresh rate|Actualizar la tarifa| -MANUAL DIAL|MARCADO MANUAL| +MANUAL DIAL|MARCACIÓN MANUAL| CALL DATE\/TIME|FECHA/HORA DE LA LLAMADA| -LOCAL HANGUP|Colgar Local| -PARKED CALLS|LLAMADAS APARCADAS| -PARKED BY|APARCAR POR| -PARKED TIME|TIEMPO EN PARKING| +LOCAL HANGUP|Colgar la local| +PARKED CALLS|LLAMADAS RETENIDAS| +PARKED BY|RETENIDA POR| +PARKED TIME|TIEMPO DE HABER SIDO RETENIDA| Registered to|Registrado a| -Enter Conference|Entrar en la conferencia| -Dial From Conf|Marcar desde la Conf| -Active Extensions|Extensiones Activas| +Enter Conference|Entrar a la conferencia| +Dial From Conf|Marcar desde la conferencia| +Active Extensions|Extensiones activas| Outside Lines|Líneas de salida| Local Extensions|Extensiones Locales| -Data Goes Here|Los Datos Van Aquí| -Trunk Action|Acciones en Trunk| -Local Action|Acción Local| -Conferences List|Lista De las Conferencias| -Click on a conference room number on the left for info on that conference|Pinchar a la izquierda del número de una sala de conferencias para obtener información| -List Display|Mostrar Listas| -Live Extensions|Extensiones Activas| -Busy Extensions|Extensiones Ocupadas| -Outside Lines|Extensiones Salientes| -script runtime|tiempo de ejecución del Script| -Call Log Display|Motrar el registro de llamadas| +Data Goes Here|Los datos van aquí| +Trunk Action|Acción de la troncal| +Local Action|Acción de la local| +Conferences List|Lista de las conferencias| +Click on a conference room number on the left for info on that conference|Hacer click en el número de la sala de conferencias de la izquierda para obtener más información de la misma| +List Display|Despliegue de listas| +Live Extensions|Extensiones activas| +Busy Extensions|Extensiones ocupadas| +Outside Lines|Líneas salientes| +script runtime|tiempo de ejecución del guión| +Call Log Display|Desplegar el registro de llamadas| is not valid|No es válido| or protocol|o protocolo| -Conf Extension Check|Comprobar la Extensión de Conf| +Conf Extension Check|Revisar la extensión de configuración| has been registered to|Ha sido registrado para| -LIVE INBOUND CALL|LLAMADA DE ENTRADA ACTIVA| -Number Dialed|Número Marcado| -SEND TO MY VOICEMAIL|ENVIAR A MI BUZÓN DE VOZ| -Live Extension Check|Comprobar Extensión Activa| -Manager Send|Enviar al Manager| -command not inserted|comando no insertado| -command sent for|comando enviado a| +LIVE INBOUND CALL|LLAMADA ENTRANTE ACTIVA| +Number Dialed|Número marcado| +SEND TO MY VOICEMAIL|ENVIAR A MI BUZÓN DE VOZ| +Live Extension Check|Revisar la extensión activa| +Manager Send|Enviar al gerente| +command not inserted|No se ingresó el comando| +command sent for|comando enviado para| One of these variables|Una de estas variables| -must be greater than 2 characters|debe ser mayor de 2 caracteres| -must be greater than 14 characters|debe ser mayor de 14 caracteres| -must be set|debe ser fijado| -not sent|no enviado| -Cannot find empty conference|No puede encontrar conferencia vacía| +must be greater than 2 characters|debe ser mayor a 2 caracteres| +must be greater than 14 characters|debe ser mayor a 14 caracteres| +must be set|debe ser fijo| +not sent|no se envió| +Cannot find empty conference|No puede encontrar una conferencia vacía| is not live|no está activo| RECORDING WILL LAST UP TO 60 MINUTES|LA GRABACIÓN DURARÁ HASTA 60 MINUTOS| -Parked Calls Display|Mostrar Llamadas Aparcadas| -Database Query Script|Database Query Script| -Group Choice|Opción Del Grupo| +Parked Calls Display|Despliegue de las llamadas retenidas| +Database Query Script|Guión de las consultas de la base de datos| +Group Choice|Opción de Grupo| has been registered to user|se ha registrado al usuario| -HOPPER EMPTY|TOLVA VACÍA| -LOG NOT ENTERED|REGISTRO NO ENTRADO| +HOPPER EMPTY|FILA DE MARCACIÓN VACÍO| +LOG NOT ENTERED|NO SE INGRESÓ EL REGISTRO| has been changed to|se ha cambiado a| information has been updated|La información ha sido actualizada| is now in status|ahora está en estado| -Voicemail Check|Comprobar el buzón de voz| -voicemail box|caja del buzón de voz| -Re-Login|Conexión Otra Vez| -User Password|Contraseña Del Usuario| -User Login|Conexión Del Usuario| -Phone Login|Conexión Del Teléfono| -Phone Password|Contraseña Del Teléfono| -Campaign not active, please try again|La campaña no está activa, intentelo otra vez, por favor| -Login incorrect, please try again|La conexión incorrecta, intentelo otra vez, por favor| -Campaign Login|Conexión en la Campaña| -Sorry, your phone login and password are not active in this system, please try again|Disculpe, la conexión del teléfono y contraseña no están activos en este sistema, intentelo otra vez por favor| -leads left to call in hopper|Leads a la izquierda para llamar en Hopper| -CAMPAIGN CUSTOM PARKING|PARKING PERSONALIZADO DE LA CAMPAÑA| -CAMPAIGN DEFAULT PARKING|PARKING POR DEFECTO DE LA CAMPAñA| +Voicemail Check|Revisar el buzón de voz| +voicemail box|buzón de voz| +Re-Login|Volver a iniciar sesión| +User Password|Contraseña del usuario| +User Login|Inicio de sesión del usuario| +Phone Login|Inicio de sesión del teléfono| +Phone Password|Contraseña del teléfono| +Campaign not active, please try again|La campaña no está activa, por favor, inténtelo de nuevo| +Login incorrect, please try again|No se inició sesión correctamente, por favor, inténtelo de nuevo| +Campaign Login|Inicio de sesión de la campaña| +Sorry, your phone login and password are not active in this system, please try again|Lo sentimos, el inicio de sesión y la contraseña del teléfono no están activos en este sistema, por favor, inténtelo de nuevo| +leads left to call in hopper|Los contactos del lado izquierdo son para llamar en la fila de marcación| +CAMPAIGN CUSTOM PARKING|RETENCIÓN PERSONALIZADA DE LA CAMPAÑA| +CAMPAIGN DEFAULT PARKING|RETENCIÓN PREDETERMINADA DE LA CAMPAÑA| CAMPAIGN CUSTOM WEB FORM|FORMULARIO WEB PERSONALIZADO DE LA CAMPAÑA| -CAMPAIGN DEFAULT WEB FORM|FORMULARIO WEB POR DEFECTO DE LA CAMPAÑA| -CAMPAIGN ALLOWS CLOSERS|LA CAMPAÑA PERMITE CLOSERS| -CAMPAIGN ALLOWS NO CLOSERS|LA CAMPAÑA NO PERMITE CLOSERS| -USING PREVIOUS MEETME ROOM|USAR EL SITIO ANTERIOR DE MEETME| -USING NEW MEETME ROOM|USAR EL NUEVO SITIO DE MEETME| -old QUEUE and INCALL reverted list|vieja COLA y lista invertida INCALL| -old QUEUE and INCALL reverted hopper|vieja COLA y tolva invertida INCALL| -old vicidial_live_agents records cleared|viejos expedientes de los vicidial_live_agents despejados| -campaign is set to auto_dial_level|la campaña se fija al auto_dial_level| -new vicidial_live_agents record inserted|Insertadas las grabaciones nueva de los vicidial_live_agents| -campaign is set to manual dial|la campaña está configurada con marcaje manual| -Sorry, there are no leads in the hopper for this campaign|Lo siento, no hay leads en el hopper de esta campaña| -Dial Next Number|Marcar el Siguiente Número| +CAMPAIGN DEFAULT WEB FORM|FORMULARIO WEB PREDETERMINADO DE LA CAMPAÑA| +CAMPAIGN ALLOWS CLOSERS|LA CAMPAÑA PERMITE TENER VERIFICADORES| +CAMPAIGN ALLOWS NO CLOSERS|LA CAMPAÑA NO PERMITE TENER VERIFICADORES| +USING PREVIOUS MEETME ROOM|UTILIZAR EL CUARTO DE CONFERENCIAS ANTERIOR| +USING NEW MEETME ROOM|UTILIZAR UN NUEVO CUARTO DE CONFERENCIAS| +old QUEUE and INCALL reverted list|lista invertida de QUEUE e INCALL anterior| +old QUEUE and INCALL reverted hopper|fila de marcación invertida de QUEUE e INCALL anterior| +old vicidial_live_agents records cleared|expedientes vicidial_live_agents anteriores eliminados| +campaign is set to auto_dial_level|la campaña se establece en auto_dial_level| +new vicidial_live_agents record inserted| se insertó la nueva grabación de vicidial_live_agents| +campaign is set to manual dial|la campaña está configurada con marcación manual| +Sorry, there are no leads in the hopper for this campaign|Lo sentimos, no hay contactos en la fila de marcación de esta campaña| +Dial Next Number|Marcar al siguiente número| LIVE CALLS IN YOUR SESSION|LLAMADAS ACTIVAS EN SU SESIÓN| -Stop Recording|Parar La Grabación| -Start Recording|Comenzar La Grabación| +Stop Recording|Detener la Grabación| +Start Recording|Comenzar la Grabación| Transfer number must have more than 1 digit|El número de la transferencia debe tener más de 1 dígito| -Grab Parked Call|Capturar llamada en Parking| -Park Call|Aparcar llamada| -Waiting for Ring|Espeerar al Ring| -Called 3rd party|Terceros llamados| -LEAVE 3-WAY CALL|ABANDONAR LLAMADA 3-WAY| -Dial With Customer|Marcar Con El Cliente| -Park Customer Dial|Dial Del Cliente Del Parque| -Hangup Xfer Line|Colgar Línea Xfer | -Hangup Both Lines|Colgar Ambas Líneas| -Hangup Customer|Colgar al Cliente| -Transfer - Conference|Transferencia - Conferencia| -LOCAL CLOSER|CLOSER LOCAL| -INTERNAL CLOSER|CLOSER INTERNO| -Dial Blind Transfer|Marcar Blind Transfer| -Dial timed out, contact your system administrator|Tiempo de espera superado, pongase en contacto con su administrador de sistema| -No more leads in the hopper for campaign|No más Leads en el hopper de la campaña| +Grab Parked Call|Capturar la llamada retenida| +Park Call|Retener la llamada| +Waiting for Ring|Esperando el timbrado| +Called 3rd party|Terceros que recibieron la llamada| +LEAVE 3-WAY CALL|ABANDONAR LA LLAMADA TRIPARTITA| +Dial With Customer|Marcar con el cliente| +Park Customer Dial|Marcar al cliente retenido| +Hangup Xfer Line|Colgar la línea en transferencia| +Hangup Both Lines|Colgar ambas líneas| +Hangup Customer|Colgar al cliente| +Transfer - Conference|Transferir - Conferencia| +LOCAL CLOSER|VERIFICADOR LOCAL| +INTERNAL CLOSER|VERIFICADOR INTERNO| +Dial Blind Transfer|Enviar una transferencia desatendida| +Dial timed out, contact your system administrator|Tiempo de espera superado, contacte al administrador del sistema| +No more leads in the hopper for campaign|No hay más contactos en la fila de marcación de la campaña| Web Form|Formulario Web| You Must Select a Disposition|Usted debe seleccionar una disposición| GROUPS NOT SELECTED|GRUPOS NO SELECCIONADOS| SELECTED GROUPS|GRUPOS SELECCIONADOS| -You cannot log out during a Dial attempt|Usted no puede salir durante un intento de marcado| -Wait 50 seconds for the dial to fail out if it is not answered|Esperar 50 segundos para que el marcado falle si no es respondido| -STILL A LIVE CALL! Hang it up then you can log out|TODAVÍA UNA LLAMADA ACTIVA! Colgar y luego salir| -Hide conference call channel information|Ocultar la información del canal Conferencia| -Show conference call channel information|Mostrar la información del canal Conferencia| -Logged in as User|Usuario| +You cannot log out during a Dial attempt|Usted no puede cerrar sesión durante un intento de marcación| +Wait 50 seconds for the dial to fail out if it is not answered|Esperar 50 segundos a que la marcación falle, si no se contesta| +STILL A LIVE CALL! Hang it up then you can log out|¡TODAVÍA TIENE UNA LLAMADA ACTIVA! Cuelgue y luego podrá cerrar sesión| +Hide conference call channel information|Ocultar la información del canal de conferencia| +Show conference call channel information|Mostrar la información del canal de conferencia| +Logged in as User|Inició sesión como usuario| No one is in your session|Nadie está en su sesión| Customer has hung up|El cliente ha colgado| -End-of-call Disposition Selection|selección de la disposición del End-of-call| -CLOSER INBOUND GROUP SELECTION|SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER| -Closer Inbound Group Selection|SELECCIÓN DEL GRUPO DE ENTRANTES CLOSER| -BLENDED CALLING|BLENDED CALLING| +End-of-call Disposition Selection|Selección de la disposición de fin de llamada| +CLOSER INBOUND GROUP SELECTION|SELECCIÓN DEL GRUPO DE VERIFICADORES ENTRANTES| +Closer Inbound Group Selection|Selección del grupo de verificadores entrantes| +BLENDED CALLING|MEZCLA DE LLAMADAS ENTRANTES Y SALIENTES| outbound activated|Salientes activdas| -Preview the Lead then|Mostrar el Lead entonces| -Lead was not reverted, there was an error|El Lead no fue invertido, hubo un error| +Preview the Lead then|Visualizar el contacto, después| +Lead was not reverted, there was an error|El contacto no se invirtió, hubo un error| call was not placed, there was an error|la llamada no fue atendida, hubo un error| Number to call|Número a llamar| -Customer Information|Información Del Cliente| -Lead Dispositioned As|Lead Dispositioned Como| -Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call|Cualquier cambio realizado al cliente que no será la información abajo en este tiempo comitted, usted debe cambiar la información del cliente antes de usted retraso la llamada| -When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically|Cuando esté activo, presione simplemente la tecla para la disposición deseada para esta llamada. La llamada después será colgada y dispositioned automáticamente| -Disposition Hot Keys|Teclas de acceso rápido a la Disposición| -Cust Time|Tiempo| -RECORD ID|GRABACIÓN ID| -RECORDING FILE|GRABANDO ARCHIVO| +Customer Information|Información del cliente| +Lead Dispositioned As|El contacto se dispuso como| +Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call|Cualquier cambio que se realice a la siguiente información del cliente no se aplicará, debe cambiar la información del cliente antes de colgar la llamada| +When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically|Cuando esté activa, tan sólo presione una tecla del teclado para la disposición deseada para esta llamada. Entonces, se colgará y se dispondrá la llamada de manera automática| +Disposition Hot Keys|Teclas de acceso rápido para la disposición| +Cust Time|Tiempo del cliente| +RECORD ID|GRABAR ID| +RECORDING FILE|ARCHIVO DE GRABACIÓN| HOT KEYS ACTIVE|TECLAS ACCESO RÁPIDO ACTIVAS| HOT KEYS INACTIVE|TECLAS ACCESO RÁPIDO INACTIVAS| -DIAL OVERRIDE|INVALIDACIÓN DEL MARCADO| -SKIP LEAD|SALTAR LEAD| -DIAL LEAD|MARCAR LEAD| -LEAD PREVIEW|MOSTRAR LEAD| -PAUSE AGENT DIALING|PARAR LA LLAMADA| -DISPOSITION CALL|DISPOSITION CALL| - session ID| sesión ID| +DIAL OVERRIDE|INVALIDAR Y SOBREESCRIBIR LA MARCACIÓN| +SKIP LEAD|SALTARSE EL CONTACTO| +DIAL LEAD|MARCAR AL CONTACTO| +LEAD PREVIEW|VISUALIZAR EL CONTACTO| +PAUSE AGENT DIALING|PAUSAR LA MARCACIÓN DEL AGENTE| +DISPOSITION CALL|DISPOSICIÓN DEL ESTADO DE LA LLAMADA| + session ID| ID de sesión| to campaign| a la campaña| -Select a CallBack Date|Seleccione una fecha del servicio repetido| - maximize | maximice | - minimize | reduzca al mínimo | +Select a CallBack Date|Seleccione una fecha para devolver la llamada| + maximize | maximizar | + minimize | minimizar | You must choose a date|Usted debe elegir una fecha| -Select a Date Below|Seleccione una fecha abajo| -Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list|Chasque encendido un servicio repetido abajo ahora para llamar la parte posteriora del cliente. Si usted chasca encendido un expediente abajo para llamarlo, será quitado de la lista| -If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there|Si usted desea marcar un número y hacerlo no agregar como nuevo plomo, entre en dialstring exacto ese usted desean llamar en el campo de la invalidación del dial abajo. Al retraso esta llamada usted tendrá que abrir las LLAMADAS EN ESTE acoplamiento de la SESIÓN en el fondo de la pantalla y colgarlas para arriba chascando en su acoplamiento del canal allí| -YOU CANNOT SKIP A CALLBACK OR MANUAL DIAL, YOU MUST DIAL THE LEAD|USTED NO PUEDE SALTAR Un SERVICIO REPETIDO O DIAL MANUAL, USTED DEBE MARCAR EL PLOMO| -YOU MUST BE PAUSED TO MANUAL DIAL A NEW LEAD IN AUTO-DIAL MODE|USTED DEBE SER DETENIDO BREVEMENTE Al DIAL MANUAL Un NUEVO PLOMO EN MODO De AUTO-DIAL| -Enter information below for the new lead you wish to call|Incorpore la información abajo para el nuevo plomo que usted desea llamar| -YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE|USTED DEBE SER DETENIDO BREVEMENTE PARA COMPROBAR SERVICIOS REPETIDOS EN MODO DE AUTO-DIAL| -Note: all new manual dial leads will go into list 999|Nota: todos los nuevos plomos manuales del dial entrarán la lista 999| -YOU DO NOT HAVE PERMISSIONS TO TRANSFER CALLS|USTED NO TIENE PERMISOS DE TRANSFERIR LLAMADAS| -will be added to the beginning of this number|será agregado al principio de este número| -This is usually a 1 in the USA-Canada|Éste es generalmente un 1 en los U.S.A. y el Canadá| -NEW MANUAL DIAL LEAD FOR|NUEVO PLOMO MANUAL DEL DIAL PARA| -Finish and Disposition Call|Final y llamada de la disposición| -10 digits max - digits only|máximo de 10 dígitos - dígitos solamente| -Note: a dial prefix of|Nota: un prefijo del dial de| -Hangup Again|Retraso Otra vez| -Go Back|Vaya Detrás| -Call Agent Again|Agente De la Llamada Otra vez| -MY CALLBACK ONLY|MI SERVICIO REPETIDO SOLAMENTE| -NO ACTIVE CALLBACKS|NO SERVICIOS REPETIDOS ACTIVOS| -ACTIVE CALLBACKS|SERVICIOS REPETIDOS ACTIVOS| -CALLBACKS FOR AGENT|SERVICIOS REPETIDOS PARA EL AGENTE| -Dial Code:|Dial Código:| -Dial Override|Invalidación Del Dial| -digits only please|los dígitos satisfacen solamente| -Dial Now|Dial Ahora| -CB Comments|Comentarios de los CBES| +Select a Date Below|Seleccione una fecha a continuación| +Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list|Haga click en regresar la llamada a continuación para volver a llamar al cliente. Si usted hace click en uno de los expedientes siguientes para llamarlo, se retirará de la lista| +If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there|Si usted desea marcar un número y NO desea agregarlo como nuevo contacto, captúrelo en la cadena de marcación a la que desea llamar del campo de invalidación de marcación siguiente. Para colgar esta llamada, tendrá que abrir el enlace de LLAMADAS EN ESTA SESIÓN en la parte inferior de la pantalla y colgarla al hacer click en el enlace del canal que se encuentra ahí| +YOU CANNOT SKIP A CALLBACK OR MANUAL DIAL, YOU MUST DIAL THE LEAD|USTED NO PUEDE SALTARSE EL DEVOLVER UNA LLAMADA O UNA MARCACIÓN MANUAL, DEBE MARCAR AL CONTACTO| +YOU MUST BE PAUSED TO MANUAL DIAL A NEW LEAD IN AUTO-DIAL MODE|USTED DEBE PAUSAR EL SISTEMA PARA MARCAR DE FORMA MANUAL UN NUEVO CONTACTO EN EL MODO DE MARCACIÓN AUTOMÁTICA| +Enter information below for the new lead you wish to call|Ingrese la información del nuevo contacto al que desea llamar a continuación| +YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE|USTED DEBE PAUSAR EL SISTEMA PARA REVISAR LA DEVOLUCIÓN DE LLAMADAS EN EL MODO DE MARCACIÓN AUTOMÁTICA| +Note: all new manual dial leads will go into list 999|Nota: todos los contactos de marcación manual nuevos se agregarán a la lista 999| +YOU DO NOT HAVE PERMISSIONS TO TRANSFER CALLS|USTED NO CUENTA CON EL PERMISO DE TRANSFERIR LLAMADAS| +will be added to the beginning of this number|será agregado al inicio de este número| +This is usually a 1 in the USA-Canada|Éste, por lo general, es un 1 en EE.UU. y Canadá| +NEW MANUAL DIAL LEAD FOR|NUEVO CONTACTO DE MARCACIÓN MANUAL PARA| +Finish and Disposition Call|Terminar y disponer de la llamada| +10 digits max - digits only|máximo 10 dígitos - sólo dígitos| +Note: a dial prefix of|Nota: un prefijo de marcación de| +Hangup Again|Colgar de nuevo| +Go Back|Regresar| +Call Agent Again|Llamar de nuevo al agente| +MY CALLBACK ONLY|SÓLO MI SERVICIO DE DEVOLVER LLAMADAS| +NO ACTIVE CALLBACKS|NO HAY SERVICIOS DE DEVOLVER LLAMADAS ACTIVOS| +ACTIVE CALLBACKS|SERVICIOS DE DEVOLVER LLAMADAS ACTIVOS| +CALLBACKS FOR AGENT|SERVICIOS DE DEVOLVER LLAMADAS PARA AGENTES| +Dial Code:|Código de marcación:| +Dial Override|Invalidar y sobreescribir la marcación| +digits only please|sólo dígitos por favor| +Dial Now|Marcar ahora| +CB Comments|Comentarios de los CB| Title|Título| Your Status|Su Estado| STATUS| ESTADO| RESET| REINICIAR| -CLEAR FORM|REINICIAR| -SUBMIT|ENVIAR| +CLEAR FORM|ELIMINAR EL FORMULARIO| +SUBMIT|INGRESAR| Incoming|Entrante| Calling|Llamando| Called|Llamado| @@ -329,43 +337,43 @@ Status|Estado| Inserted|Insertado| seconds| segundos| HELP|AYUDA| - Login | Conexión | -Login:|Conexión:| + Login | Inicio de sesión | +Login:|Inicio de sesión:| User |Usuario | Password|Contraseña| VERSION|VERSIÓN| -BUILD|CONSTRUCCION| +BUILD|CONSTRUCCIÓN| Server|Servidor| RECORD |GRABACIÓN | >HANGUP|>COLGAR| >XFER|>TRANSFERENCIA| -PARK|PARKING| -IN-NUMBER|NÚMERO-ENTRANTE| +PARK|RETENER| +IN-NUMBER|NÚMERO ENTRANTE| NUMBER|NÚMERO| -CALLERID|LLAMADORID| +CALLERID|LLAMADASID| CALL| LLAMADA| -PICKUP|CAPTURAR| +PICKUP|TOMAR| CONFERENCE|CONFERENCIA| -Refresh|Recarga| +Refresh|Recargar| Send DTMF|Enviar DTMF| ORDER|ORDEN| on | en | ->LOGOUT|>SALIR| +>LOGOUT|>CERRAR SESIÓN| Channel| Canal| Extensions|Extensiones| Conferences|Conferencias| Conference|Conferencia| -Recording|GRABANDO| +Recording|Grabando| Record|Grabar| Welcome|Bienvenido| VOICEMAIL|BUZÓN DE VOZ| NEW| NUEVO| - OLD| VIEJO| + OLD| ANTERIOR| Pause | Pausa | -Resume|Comienzo| +Resume|Retomar| Faster|Más rápido| Slower|Más lento| -Initializing|Inizializando| +Initializing|Inicializando| Invalid|Inválido| Username|Nombre del usuario| Notes|Notas| @@ -377,38 +385,38 @@ City|Ciudad| State|Estado| PostCode|CódigoPostal| Province|Provincia| -Vendor ID|VendedorID| -DialCode|Código Del Dial| -Alt. Phone|Teléfono Alt| -Show|Demostración| -Email|Email| +Vendor ID|ID del vendedor| +DialCode|Código de marcación| +Alt. Phone|Teléfono alternativo| +Email|Correo electrónico| +Show|Mostrar| Comments|Comentarios| REFRESH|ACTUALIZAR| -ALT PHONE DIAL|TELÉFONO DEL ALT| +ALT PHONE DIAL|MARCAR AL TELÉFONO ALTERNATIVO| MAIN PHONE|TELÉFONO PRINCIPAL| -ALT PHONE|TELÉFONO ALT| +ALT PHONE|TELÉFONO ALTERNATIVO| ADDRESS3|DIRECCIÓN3| -FINISH LEAD|ACABAR LEAD| -Dial Alt Phone Number|Marcar Número de teléfono Alt| +FINISH LEAD|TERMINAR EL CONTACTO| +Dial Alt Phone Number|Marcar al número telefónico alternativo| Phone|Teléfono| - DIAL| DIAL| -SUBMIT FAVORITES CHANGES - requires logout|SOMETA LOS CAMBIOS de los FAVORITOS - requiere registro de estado de la máquina| -BACK TO MAIN WINDOW - ignore changes made|DE NUEVO A VENTANA PRINCIPAL - no haga caso de los cambios realizados| + DIAL| MARCAR| +SUBMIT FAVORITES CHANGES - requires logout|ACEPTAR LOS CAMBIOS A FAVORITOS - es necesario cerrar sesión para hacerlo| +BACK TO MAIN WINDOW - ignore changes made|REGRESAR A LA VENTANA PRINCIPAL - ignorar los cambios realizados| AVAILABLE EXTENSIONS|EXTENSIONES DISPONIBLES| - edit| corrija| + edit| editar| FAVORITES| FAVORITOS| ### END translation phrases through 1.1.11 release ### -Search Existing Leads|Plomos Existentes De la Búsqueda| -This option if checked will attempt to find the phone number in the system before inserting it as a new lead|Esta opción si está comprobada procurará encontrar el número de teléfono en el sistema antes de insertarlo como nuevo plomo| -Finish Wrapup and Move On|Final Wrapup y movimiento encendido| -seconds remaining in wrapup|segundos restantes en wrapup| -Call Wrapup:|Llamada Wrapup:| +Search Existing Leads|Buscar en los contactos existentes| +This option if checked will attempt to find the phone number in the system before inserting it as a new lead|Si se selecciona esta opción, ésta intentará encontrar el número telefónico en el sistema antes de ingresarlo como un nuevo contacto| +Finish Wrapup and Move On|Terminar con la conclusión y proseguir| +seconds remaining in wrapup|segundos restantes de la conclusión| +Call Wrapup:|Conclusión de la llamada:| ### months of the year for CallBack date select screen ### January|Enero| Frebruary|Febrero| -March|Marcha| +March|Marzo| April|Abril| -May|Puede| +May|Mayo| June|Junio| July|Julio| August|Agosto| @@ -417,78 +425,148 @@ October|Octubre| November|Noviembre| December|Diciembre| ### BEGIN translation phrases for 2.0.1 release ### -Previous Callback Information|Información Anterior Del Servicio repetido| -Last Call: |Llamada Pasada:| -CallBack: |Servicio repetido:| +Previous Callback Information|Información del servicio de devolución de llamada anterior| +Last Call: |Última llamada:| +CallBack: |Servicio de devolución de llamada:| Agent: |Agente:| Comments: |Comentarios:| ### BEGIN translation phrases for 2.0.2 release ### VOLUME|VOLUMEN| ### BEGIN translation phrases for 2.0.3 release ### -FAST DIAL|DIAL RÁPIDO| -YOU MUST ENTER A PHONE NUMBER AND DIAL CODE TO USE FAST DIAL|USTED DEBE INTRODUCIR Un NÚMERO De TELÉFONO Y Un CÓDIGO Del DIALPARA UTILIZAR El DIAL RÁPIDO| - SELECT A PAUSE CODE :| SELECCIONE Un CÓDIGO De la PAUSA :| -ENTER A PAUSE CODE|INTRODUZCA Un CÓDIGO De la PAUSA| -YOU MUST BE PAUSED TO ENTER A PAUSE CODE IN AUTO-DIAL MODE|USTED DEBE SER DETENIDO BREVEMENTE PARA INTRODUCIR Un CÓDIGO De la PAUSA EN AUTO-DIAL MODE| +FAST DIAL|MARCACIÓN RÁPIDA| +YOU MUST ENTER A PHONE NUMBER AND DIAL CODE TO USE FAST DIAL|USTED DEBE INGRESAR UN NÚMERO TELEFÓNICO Y UN CÓDIGO DE MARCACIÓN PARA UTILIZAR LA MARCACIÓN RÁPIDA| + SELECT A PAUSE CODE :| SELECCIONE UN CÓDIGO DE PAUSA :| +ENTER A PAUSE CODE|INTRODUZCA UN CÓDIGO DE PAUSA| +YOU MUST BE PAUSED TO ENTER A PAUSE CODE IN AUTO-DIAL MODE|USTED DEBE PAUSAR EL SISTEMA PARA INGRESAR UN CÓDIGO DE PAUSA EN EL MODO DE MARCACIÓN AUTOMÁTICA| Your session has been disabled|Se ha inhabilitado su sesión| ### BEGIN translation phrases for 2.0.5 release ### Gender: |Género:| Date of Birth: |Fecha de nacimiento:| -YOU MUST BE PAUSED TO CHANGE GROUPS|USTED DEBE CAMBIAR pausa GRUPOS| -Calls in Queue:|Pide, en la cola:| - Timeclock|Timeclock| -The user and password you entered are not active in the system|El usuario y la contraseña que ha introducido no son activos en el sistema| +YOU MUST BE PAUSED TO CHANGE GROUPS|USTED DEBE PAUSAR EL SISTEMA PARA CAMBIAR LOS GRUPOS| +Calls in Queue:|Llamadas en cola:| + Timeclock| Reloj checador| +The user and password you entered are not active in the system|El usuario y la contraseña que ha introducido no están activos en el sistema| Please try again|Por favor, inténtelo de nuevo| -You cannot log in or out within 30 seconds of your last login or logout|No puede iniciar sesión o en un plazo de 30 segundos de su última conexión o desconexión| -You have now logged-out|Ya ha iniciado la sesión en| -You logged out at |Que en la sesión| -Amount of time you were logged-in: |Cantidad de tiempo que se han registrado en:| -ERROR: timeclock log entry already made: |ERROR: timeclock entrada de registro ya realizados:| -BACK to Agent Login Screen|VOLVER a la pantalla de Inicio| -BACK to Administration|VOLVER a la Administración| -BACK to Welcome Screen|VOLVER a la pantalla de bienvenida| -Time since you were last logged-in: |Vez desde que se conectó por última vez en:| -You last logged-out at: |-Usted se conectó por última vez en:| -Click LOGIN below to log-in|Haga clic en Conectarse a continuación para acceder al sistema| -Amount of time you have been logged-in: |Cantidad de tiempo que se han registrado en:| -You logged-in at:|Iniciado la sesión en que usted en:| -Click LOGOUT below to log-out|Haga clic a continuación para acceder LOGOUT-out| +You cannot log in or out within 30 seconds of your last login or logout|No puede iniciar o cerrar sesión en un plazo de 30 segundos después su último inicio o cierre de sesión| +You have now logged-out|Usted ha cerrado su sesión| +You logged out at |Usted cerró su sesión en| +Amount of time you were logged-in: |El tiempo durante el cual tuvo su sesión abierta:| +ERROR: timeclock log entry already made: |ERROR: ya se había ingresado el registro en el reloj checador:| +BACK to Agent Login Screen|REGRESAR a la pantalla de inicio de sesión del agente| +BACK to Administration|REGRESAR a Administración| +BACK to Welcome Screen|REGRESAR a la pantalla de bienvenida| +Time since you were last logged-in: |Tiempo transcurrido desde la última vez que inició sesión:| +You last logged-out at: |Usted cerró sesión por última vez el:| +Click LOGIN below to log-in|Haga click en INICIAR SESIÓN a continuación para acceder al sistema| +Amount of time you have been logged-in: |Tiempo transcurrido desde que inició sesión:| +You logged-in at:|Inició sesión en:| +Click LOGOUT below to log-out|Haga click en CERRAR SESIÓN a continuación para salir del sistema| Undefined|Indefinido| -This phone number is not in the campaign lists|Este número de teléfono no está en la campaña de las listas| +This phone number is not in the campaign lists|Este número telefónico no está en las listas de la campaña| Unspecified error|Error no especificado| -Extended Alt Phone Information: |Teléfono de Información ampliado Alt:| -ALT DIAL NUMBER:|ALT DIAL NÚMERO:| -Phone Code and Number:|Código y número de teléfono:| +Extended Alt Phone Information: |Información extendida del teléfono alternativo:| +ALT DIAL NUMBER:|NÚMERO DE MARCACIÓN ALTERNATIVA:| +Phone Code and Number:|Código y número telefónicos:| Notes: |Notas:| Active: |Activo:| -Alt Count: |Alt Cuenta:| -Change this phone number to INACTIVE|Cambiar este número de teléfono a INACTIVAS| -Change this phone number to ACTIVE|Cambiar este número de teléfono a ACTIVO| -YOU MUST LOG IN TO THE TIMECLOCK FIRST|USTED DEBE ENTRAR A LA PRIMERA TIMECLOCK| -There is a time synchronization problem with your system, please tell your system administrator|Hay un problema de sincronización de tiempo con su sistema, por favor, dígale a su administrador del sistema| -Preview Call|Vista previa de llamada| -SELECT A GROUP ALIAS|SELECCIONAR UN GRUPO DE ALIAS| -Group Alias Selection|Grupo de Selección de Alias| -Click Here to Choose a Group Alias|Haga clic aquí para escoger un grupo de alias| -Group Alias|Grupo de Alias| -ERROR: There are no Shifts enabled for your user group|ERROR: No hay cambios habilitado para su grupo de usuarios| +Alt Count: |Cuenta alternativa: | +Change this phone number to INACTIVE|Cambiar este número telefónico a INACTIVOS| +Change this phone number to ACTIVE|Cambiar este número telefónico a ACTIVOS| +YOU MUST LOG IN TO THE TIMECLOCK FIRST|USTED DEBE INGRESAR PRIMERO AL RELOJ CHECADOR| +There is a time synchronization problem with your system, please tell your system administrator|Hay un problema de sincronización de horario en su sistema, por favor, infórmeselo al administrador de su sistema| +Preview Call|Vista previa de la llamada| +SELECT A GROUP ALIAS|SELECCIONAR UN ALIAS DE GRUPO| +Group Alias Selection|Selección del alias de grupo| +Click Here to Choose a Group Alias|Haga click aquí para escoger un alias de grupo| +Group Alias|Alias de grupo| +ERROR: There are no Shifts enabled for your user group|ERROR: No hay cambios habilitados para su grupo de usuarios| ERROR: You are not allowed to log in outside of your shift|ERROR: No se le permite acceder fuera de su turno| -MANAGER OVERRIDE|GERENTE DE TRANSFERENCIA| -Your Shift is over or has changed, you have been logged out of your session|Su cambio es de más o ha cambiado, se le ha cerrado la sesión de su período de sesiones| +MANAGER OVERRIDE|TRANSFERENCIA DEL GERENTE| +Your Shift is over or has changed, you have been logged out of your session|Su turno se terminó o cambió, se ha cerrado su sesión| ### START translations for 2.2.0 release ### You are not allowed to dial into other agent sessions|No está autorizado para marcar en sesiones de otro agente| QUICK TRANSFER|TRANSFERENCIA RÁPIDA| -Other Agents Status|Otros agentes de Estado| -Available Agents Transfer|Agentes disponibles de transferencia| -Show Calls In Queue|Pide Mostrar la cola| +Other Agents Status|Estado de otros agentes| +Available Agents Transfer|Transferencia a los agentes disponibles| +Show Calls In Queue|Mostrar las llamadas en la cola| Calls In Queue|Llamadas en cola| Hide Calls In Queue|Ocultar las llamadas en cola| -Calls in Queue View Disabled for this campaign|Ver las llamadas en cola de personas de movilidad reducida para esta campaña| -YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE|USTED DEBE SER DETENIDO GRAB a las llamadas en cola| +Calls in Queue View Disabled for this campaign|La vista de llamadas en cola se desactivó para esta campaña| +YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE|USTED DEBE PAUSAR EL SISTEMA PARA CAPTURAR LAS LLAMADAS EN LA COLA| Manager |Director| -has selected your in-group choices|ha seleccionado en las opciones de su grupo| +has selected your in-group choices|ha seleccionado las opciones de su grupo| CONSULTATIVE|CONSULTIVO| -Close Message|Cerrar Mensaje| -TIMER NOTIFICATION|NOTIFICACIÓN TIMER| +Close Message|Cerrar el mensaje| +TIMER NOTIFICATION|NOTIFICACIÓN DEL TEMPORIZADOR| login_language=en_us|login_language=es_es| >AGENTS<|>AGENTES<| +### START translations for 2.4 release ### +VIEW CALL LOG|VER REGISTRO DE LLAMADAS| +click to dial|haga clic para marcar| +Close Call Log|Cerca de registro de llamadas| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|USTED DEBE SER se detuvo para ver el registro de llamadas| +Close Info Box|Cerrar cuadro de información| +No calls on this day|No hay llamadas en este día| +You are in ALT dial mode, you must finish the lead before logging out|Usted está en el modo de marcación ALT, debe terminar el cable antes de salir| +Presets Button|Presets Button| +SELECT A PRESET|Elija un preset| +Customer Hung-up, 3-way Call Ended Automatically|Cliente Hung-up, de 3 vías llamadas terminaron automáticamente| +Manual Dial Queue Calls Waiting|Cola de llamadas en espera Marcación manual| +Manual Queue|Manual de la cola| +This phone number is outside of the local call time|Este número de teléfono se encuentra fuera del tiempo de las llamadas locales| +Manual Queue is Off|Manual de la cola está Desactivado| +Manual Queue is On|El manual de la cola es| +Call Notes:|Notas de la llamada:| +Call Notes List|Lista de llamadas Notas| +view notes|ver las notas| +CALL NOTES LOG|Notas de la llamada LOG| +Close Call Notes|Cerca de las notas de llamadas| +CALL LOG FOR THIS LEAD|REGISTRO DE LLAMADAS PARA ESTE CABLE| +SEARCH FOR A LEAD|BUSCAR UN PLOMO| +SEARCH RESULTS|RESULTADOS DE LA BÚSQUEDA| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|USTED DEBE SER DETENIDO PARA BUSCAR A PLOMO| +Notes: when doing a search for a lead, the phone number, lead ID or|Notas: cuando se hace una búsqueda de una ventaja, el número de teléfono, llevar DNI o| +are the best fields to use|son los mejores campos de usar| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Utilizando los otros campos puede ser más lenta. La búsqueda de plomo no permite términos de búsqueda comodín o parcial| +Lead search requests are all logged in the system|Las solicitudes de búsqueda de plomo están registra en el sistema de| +Main Phone Number|Número de teléfono Principal| +Alternate Phone Number|Número de teléfono alternativo| +Address3 Phone Number|Dirección3 Teléfono| +No results found|No se encontraron resultados| +Results Found:|Los resultados encontrados:| +No calls found|No hay llamadas encontrado| +reset form|Nueva búsqueda| +Callback Status|Devolución de llamada de estado| +Callback Lead Status|Devolución de llamada Estado de plomo| +Callback Entry Time|Devolución de llamada Hora de entrada| +Callback Trigger Time|Devolución de llamada Trigger Time| +Callback Comments|Comentarios de devolución de llamada| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Para ver la información en una de las devoluciones de llamada a continuación, haga clic en el enlace INFORMACIÓN. Para llamar al cliente hacia atrás ahora, haga clic en el vínculo de acceso telefónico. Si hace clic en un registro de abajo para marcar, éste será removido de la lista| +rings all available agents until one picks up the phone|anillos de todos los agentes disponibles hasta que uno coge el teléfono| +No calls for this lead|No hay convocatorias de este cable| +Time Zone Warning|El tiempo de alerta Zona| +Phone Area Code Outside Dialable Zone|Teléfono código de área fuera de la zona pueda marcar| +Postal Code Outside Dialable Zone|Código Postal Fuera de la Zona pueda marcar| +Custom Transfer|Custom Transferencia| +System Delay, Please try again|Retraso en el sistema, por favor intente de nuevo| +Disposition Status List Hidden|Lista de Disposición estado oculto| +The system has received a command to log you out, you have been logged out of your session|El sistema ha recibido una orden para cerrar la sesión, se le ha cerrado la sesión de su período de sesiones| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Notas: al hacer una búsqueda de un contacto, los términos de búsqueda comodín o parcial no se les permite| +Contact search requests are all logged in the system|Solicitudes de contacto de búsqueda están registra en el sistema de| +SEARCH FOR A CONTACT|Buscar un contacto| +CONTACTS SEARCH RESULTS|CONTACTOS RESULTADOS DE LA BÚSQUEDA| +LEAD SEARCH|PERSPECTIVA BUSCAR| +Customer Time|Tiempo al Cliente| +TERRITORY SELECTION|TERRITORIO DE SELECCIÓN| +TERRITORIES NOT SELECTED|TERRITORIOS NO SELECCIONADO| +SELECTED TERRITORIES|TERRITORIOS SELECCIONADOS| +Dialable Leads|Pueda Marcar Perspectiva| +You have now logged-in|Usted ahora tiene registrados| +You logged in at|Está conectado a una| +Refresh Campaign List|Actualizar lista de la campaña| +PLEASE SELECT A CAMPAIGN|POR FAVOR SELECCIONE UNA CAMPAÑA| +Agents View|Ver Agentes| +-READY|-LISTO| +-INCALL|-INCALL| +-PAUSED|-PAUSA| +CALL DISPOSITION|LLAME AL DESTINO| diff --git a/agc_2-X/trunk/translations/fr_language.txt b/agc_2-X/trunk/translations/fr_language.txt index 66cb9844..a407c96f 100644 --- a/agc_2-X/trunk/translations/fr_language.txt +++ b/agc_2-X/trunk/translations/fr_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"JAN"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DEC"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number.gif| vdc_XB_channel.gif|vdc_XB_channel.gif| vdc_XB_seconds.gif|vdc_XB_seconds.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Vous êtes maintenant déconnecté.| astGUIclient web-client VERSION|astGUIclient Client Web| astGUIclient web client|astGUIclient Client Web| @@ -491,3 +499,73 @@ CONSULTATIVE|CONSULTATIF| Close Message|Fermer Message| TIMER NOTIFICATION|TIMER NOTIFICATION| >AGENTS<|>AGENTS<| +### START translations for 2.4 release ### +VIEW CALL LOG|VOIR JOURNAL DES APPELS| +click to dial|cliquez pour composer| +Close Call Log|Fermer journal des appels| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|VOUS DEVEZ ÊTRE EN PAUSE POUR VOIR VOTRE JOURNAL DES APPELS| +Close Info Box|Info Box Fermer| +No calls on this day|Pas d'appels pour ce jour| +You are in ALT dial mode, you must finish the lead before logging out|Vous êtes dans le mode de numérotation ALT, vous devez terminer le plomb avant de vous déconnecter| +Presets Button|Boutons prédéfinis| +SELECT A PRESET|Sélectionnez un Preset| +Customer Hung-up, 3-way Call Ended Automatically|Client Hung-up, 3-way appel sest terminé automatiquement| +Manual Dial Queue Calls Waiting|Queue numérotation manuelle Appels en attente| +Manual Queue|Manuel de la file| +This phone number is outside of the local call time|Ce numéro de téléphone est en dehors du temps d'un appel local| +Manual Queue is Off|Manuel de la file est désactivé| +Manual Queue is On|Manuel de la file est activée| +Call Notes:|Notes d'appel:| +Call Notes List|Appelez liste de notes| +view notes|visualiser les notes| +CALL NOTES LOG|NOTES D'APPEL LOG| +Close Call Notes|Fermer Notes d'appel| +CALL LOG FOR THIS LEAD|APPELS POUR CE FIL| +SEARCH FOR A LEAD|RECHERCHE D'UN PLOMB| +SEARCH RESULTS|RÉSULTATS DE RECHERCHE| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|VOUS DEVEZ ÊTRE EN PAUSE POUR RECHERCHER UN PLOMB| +Notes: when doing a search for a lead, the phone number, lead ID or|Notes: lorsque vous faites une recherche d'un chef de file, le numéro de téléphone, conduire ou ID| +are the best fields to use|sont les meilleurs champs à utiliser| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|En utilisant les champs d'autres peut être plus lente. Recherche de plomb ne permet pas de termes de recherche génériques ou partielle| +Lead search requests are all logged in the system|Demandes de recherche de plomb sont tous enregistrés dans le système de| +Main Phone Number|Numéro de téléphone principal| +Alternate Phone Number|Autre numéro de téléphone| +Address3 Phone Number|Address3 numéro de téléphone| +No results found|Aucun résultat trouvé| +Results Found:|Résultats trouvés:| +No calls found|Pas d'appels trouvé| +reset form|réinitialiser la forme| +Callback Status|Statut de rappel| +Callback Lead Status|Callback d'état plomb| +Callback Entry Time|Heure d'entrée de rappel| +Callback Trigger Time|Temps de déclenchement de rappel| +Callback Comments|Commentaires de rappel| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Pour voir les informations sur l'un des rappels ci-dessous, cliquez sur le lien INFO. Pour appeler le client en arrière maintenant, cliquez sur le lien DIAL. Si vous cliquez sur un enregistrement ci-dessous pour composer le numéro, il sera retiré de la liste| +rings all available agents until one picks up the phone|bagues à tous les agents disponibles jusqu'à ce que l'on prend le téléphone| +No calls for this lead|Pas d'appels pour ce plomb| +Time Zone Warning|Attention fuseau horaire| +Phone Area Code Outside Dialable Zone|Indicatif régional Téléphone dehors de la zone composable| +Postal Code Outside Dialable Zone|Code postal dehors de la zone composable| +Custom Transfer|Transfert sur mesure| +System Delay, Please try again|Retard du système, S'il vous plaît essayez de nouveau| +Disposition Status List Hidden|Liste d'état Disposition Caché| +The system has received a command to log you out, you have been logged out of your session|Le système a reçu une commande pour que vous vous déconnectez, vous avez été déconnecté de votre session| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Notes: lorsque vous faites une recherche pour un contact, des termes de recherche génériques ou partielle ne sont pas autorisés| +Contact search requests are all logged in the system|Demandes de recherche de contact sont tous enregistrés dans le système de| +SEARCH FOR A CONTACT|Rechercher un contact| +CONTACTS SEARCH RESULTS|RÉSULTATS DE RECHERCHE CONTACTS| +LEAD SEARCH|LEAD RECHERCHE| +Customer Time|temps à la clientèle| +TERRITORY SELECTION|SÉLECTION DU TERRITOIRE| +TERRITORIES NOT SELECTED|TERRITOIRES NON CHOISI| +SELECTED TERRITORIES|TERRITOIRES CHOISIS| +Dialable Leads|Leads composable| +You have now logged-in|Vous avez maintenant connecté| +You logged in at|Vous connecté à| +Refresh Campaign List|Liste campagne Actualiser| +PLEASE SELECT A CAMPAIGN|S'IL VOUS PLAÎT Sélectionnez une campagne| +Agents View|Agents Voir| +-READY|-PRÊT| +-INCALL|-INCALL| +-PAUSED|-PAUSE| +CALL DISPOSITION|APPEL DISPOSITION| diff --git a/agc_2-X/trunk/translations/it_language.txt b/agc_2-X/trunk/translations/it_language.txt index e3c8a0a1..06c74fdd 100644 --- a/agc_2-X/trunk/translations/it_language.txt +++ b/agc_2-X/trunk/translations/it_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"GEN"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DIC"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number.gif| vdc_XB_channel.gif|vdc_XB_channel.gif| vdc_XB_seconds.gif|vdc_XB_seconds.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Ora non sei collegato. Grazie| astGUIclient web-client VERSION|Versione di astGUIclient web-client| astGUIclient web client|web client astGUIclient| @@ -508,3 +516,73 @@ Close Message|Chiudi Messaggio| TIMER NOTIFICATION|NOTIFICA TIMER| >AGENTS<|>OPERATORI<| Call ID | ID chiamata | +### START translations for 2.4 release ### +VIEW CALL LOG|Visualizza registro CALL| +click to dial|fai clic per comporre| +Close Call Log|Chiudere registro chiamate| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|DEVI ESSERE IN PAUSA PER VEDERE IL VOSTRO CALL LOG| +Close Info Box|Info Box Chiudi| +No calls on this day|Nessuna chiamata in questo giorno| +You are in ALT dial mode, you must finish the lead before logging out|Sei in modalità dial ALT, è necessario terminare il cavo prima di uscire| +Presets Button|Presets Button| +SELECT A PRESET|SELEZIONA UN PRESET| +Customer Hung-up, 3-way Call Ended Automatically|Clienti Hung-up, 3-way chiamata è terminata automaticamente| +Manual Dial Queue Calls Waiting|Coda Selezione manuale chiamate in attesa| +Manual Queue|Queue Manual| +This phone number is outside of the local call time|Questo numero di telefono è al di fuori del tempo di chiamata locale| +Manual Queue is Off|Queue manuale è Off| +Manual Queue is On|Queue manuale è On| +Call Notes:|Chiamate Note:| +Call Notes List|Lista chiamate Note| +view notes|visualizzare le note| +CALL NOTES LOG|Note dal registro chiamate| +Close Call Notes|Chiudere note di chiamata| +CALL LOG FOR THIS LEAD|Registro Chiamate QUESTO FILO| +SEARCH FOR A LEAD|RICERCA DI PIOMBO A| +SEARCH RESULTS|RISULTATI DELLA RICERCA| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|DEVI ESSERE IN PAUSA PER CERCARE DI PIOMBO| +Notes: when doing a search for a lead, the phone number, lead ID or|Note: quando si esegue una ricerca di un lead, il numero di telefono, portare ID o| +are the best fields to use|sono i migliori campi da utilizzare| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Utilizzando gli altri campi potrebbe essere più lento. Ricerca piombo non consente termini di ricerca con caratteri jolly o parziale| +Lead search requests are all logged in the system|Richieste di ricerca di piombo sono tutti registrati nel sistema di| +Main Phone Number|Numero di telefono principale| +Alternate Phone Number|Numero di telefono alternativo| +Address3 Phone Number|Indirizzo3 Numero di telefono| +No results found|Nessun risultato trovato| +Results Found:|Risultati Trovati:| +No calls found|Nessuna chiamata trovate| +reset form|ripristinare forma| +Callback Status|RICHIAMI Stato| +Callback Lead Status|Richiamata Lead| +Callback Entry Time|Richiamata Entry Tempo| +Callback Trigger Time|Richiamata trigger Tempo| +Callback Comments|Richiamata commenti| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Per informazioni su uno dei callback in seguito, clicca sul link INFO. Per chiamare il cliente indietro, clicca sul link DIAL. Se si fa clic su un record qui sotto per comporlo, verrà rimosso dalla lista| +rings all available agents until one picks up the phone|anelli di tutti gli agenti disponibili fino a quando uno alza il telefono| +No calls for this lead|Nessuna chiamata per questo cavo| +Time Zone Warning|Fuso orario Warning| +Phone Area Code Outside Dialable Zone|Phone Area Code Fuori Zona componibili| +Postal Code Outside Dialable Zone|CAP Fuori Zona componibili| +Custom Transfer|Personalizzato Transfer| +System Delay, Please try again|Delay System, Riprova| +Disposition Status List Hidden|Condizione nella Lista Disposizione Nascosto| +The system has received a command to log you out, you have been logged out of your session|Il sistema ha ricevuto un comando di log out, si è stati disconnessi dalla sessione| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Note: quando si fa una ricerca di un contatto, termini di ricerca jolly o parziale non sono consentite| +Contact search requests are all logged in the system|Richieste di ricerca di contatto sono tutti registrati nel sistema di| +SEARCH FOR A CONTACT|Cerca un contatto| +CONTACTS SEARCH RESULTS|CONTATTI RISULTATI DELLA RICERCA| +LEAD SEARCH|PIOMBO RICERCA| +Customer Time|Time Customer| +TERRITORY SELECTION|TERRITORIO DI SELEZIONE| +TERRITORIES NOT SELECTED|TERRITORI NON SELEZIONATO| +SELECTED TERRITORIES|territori selezionati| +Dialable Leads|Leads componibili| +You have now logged-in|Ora avete registrati| +You logged in at|Si è connessi a| +Refresh Campaign List|Refresh Campagna Lista| +PLEASE SELECT A CAMPAIGN|Seleziona una campagna| +Agents View|Agenti Visualizza| +-READY|-READY| +-INCALL|-Incall| +-PAUSED|-PAUSA| +CALL DISPOSITION|CALL DISPOSIZIONE| diff --git a/agc_2-X/trunk/translations/nl_language.txt b/agc_2-X/trunk/translations/nl_language.txt index a23482a2..796d0008 100644 --- a/agc_2-X/trunk/translations/nl_language.txt +++ b/agc_2-X/trunk/translations/nl_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"JAN"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DEC"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number.gif| vdc_XB_channel.gif|vdc_XB_channel.gif| vdc_XB_seconds.gif|vdc_XB_seconds.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Je ben nu uitgelogd. Bedankt| astGUIclient web-client VERSION|astGUIclient web-client VERSIE| astGUIclient web client|astGUIclient web client| @@ -523,3 +531,73 @@ CONSULTATIVE|ADVIESGROEP| Close Message|Close Message| TIMER NOTIFICATION|TIMER AANMELDING| >AGENTS<|>agenten<| +### START translations for 2.4 release ### +VIEW CALL LOG|VIEW CALL LOG| +click to dial|klik om te bellen| +Close Call Log|Sluit Call Log| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|JE MOET worden onderbroken om gesprekslog bekijken| +Close Info Box|Sluiten Info Box| +No calls on this day|Geen oproepen op deze dag| +You are in ALT dial mode, you must finish the lead before logging out|Je bent in de ALT knop mode, moet je de leiding af eerst uit te loggen| +Presets Button|Presets Button| +SELECT A PRESET|SELECT A PRESET| +Customer Hung-up, 3-way Call Ended Automatically|Klant Hung-up, 3-weg gesprek beëindigd automatisch| +Manual Dial Queue Calls Waiting|Handmatig kiezen Wachtrij Oproepen Wachten| +Manual Queue|Handleiding Queue| +This phone number is outside of the local call time|Dit telefoonnummer is buiten het lokale oproep tijd| +Manual Queue is Off|Handmatig wachtrij is uitgeschakeld| +Manual Queue is On|Handmatig wachtrij staat Aan| +Call Notes:|Call Opmerkingen:| +Call Notes List|Call Notes Lijst| +view notes|Notities bekijken| +CALL NOTES LOG|Opmerkingen bij oproep LOG| +Close Call Notes|Sluit Call Notes| +CALL LOG FOR THIS LEAD|OPROEP VOOR DEZE LOG LOOD| +SEARCH FOR A LEAD|ZOEK NAAR EEN LOOD| +SEARCH RESULTS|ZOEKRESULTATEN| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|JE MOET worden gepauzeerd wilt zoeken naar een LOOD| +Notes: when doing a search for a lead, the phone number, lead ID or|Opmerkingen: bij het doen van een zoektocht naar een voorsprong, het telefoonnummer, leiden ID of| +are the best fields to use|worden de beste velden| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|De andere velden kunnen vertragen. Lead zoeken houdt geen rekening met wildcard of gedeeltelijke zoektermen| +Lead search requests are all logged in the system|Lead zoekopdrachten zijn allemaal geregistreerd in het systeem| +Main Phone Number|Belangrijkste Telefoonnummer| +Alternate Phone Number|Andere telefoonnummer| +Address3 Phone Number|Address3 Telefoonnummer| +No results found|Er zijn geen resultaten gevonden| +Results Found:|Gevonden resultaten:| +No calls found|Geen gesprekken gevonden| +reset form|opnieuw in te stellen formulier| +Callback Status|Terugbellen Status| +Callback Lead Status|Terugbellen Lead Status| +Callback Entry Time|Terugbellen Entry Time| +Callback Trigger Time|Terugbellen Trigger Time| +Callback Comments|Terugbellen Reacties| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Als u informatie over een van de callbacks zie hieronder, klik op de INFO link. Om de klant nu terug te bellen, klik op de DIAL link. Als u hieronder klikt op een record om te bellen, wordt deze verwijderd uit de lijst| +rings all available agents until one picks up the phone|ringen van alle beschikbare middelen tot een neemt de telefoon op| +No calls for this lead|Geen roept op tot deze draad| +Time Zone Warning|Time Zone Waarschuwing| +Phone Area Code Outside Dialable Zone|Telefoon netnummer Buiten kiesbaar Zone| +Postal Code Outside Dialable Zone|Postcode Buiten kiesbaar Zone| +Custom Transfer|Custom Transfer| +System Delay, Please try again|System Delay, Probeer het opnieuw| +Disposition Status List Hidden|Disposition Status Lijst Verborgen| +The system has received a command to log you out, you have been logged out of your session|Het systeem heeft een opdracht om je uitlogt ontvangen, heb je uitgelogd van uw sessie| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Opmerkingen: bij het doen van een zoektocht naar een contactpersoon, worden wildcard of gedeeltelijke zoektermen niet toegestaan| +Contact search requests are all logged in the system|Contact zoekopdrachten zijn allen geregistreerd in het systeem| +SEARCH FOR A CONTACT|Zoeken naar een contactpersoon| +CONTACTS SEARCH RESULTS|CONTACTEN ZOEKRESULTATEN| +LEAD SEARCH|LEIDEN ZOEKEN| +Customer Time|Klant Tijd| +TERRITORY SELECTION|GRONDGEBIED SELECTIE| +TERRITORIES NOT SELECTED|Gebieden die geen GESELECTEERD| +SELECTED TERRITORIES|GESELECTEERDE GEBIEDEN| +Dialable Leads|kiesbaar Leads| +You have now logged-in|U heeft nu aangemelde| +You logged in at|U ingelogd op| +Refresh Campaign List|Vernieuwen campagne Lijst| +PLEASE SELECT A CAMPAIGN|Selecteer een campagne| +Agents View|agenten bekijken| +-READY|-KLAAR| +-INCALL|-INCALL| +-PAUSED|-PAUSED| +CALL DISPOSITION|CALL GEAARDHEID| diff --git a/agc_2-X/trunk/translations/pl_language.txt b/agc_2-X/trunk/translations/pl_language.txt index f9ff70ed..25f51a04 100644 --- a/agc_2-X/trunk/translations/pl_language.txt +++ b/agc_2-X/trunk/translations/pl_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"STY"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"LIS"| "DEC"|"GRU"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number.gif| vdc_XB_channel.gif|vdc_XB_channel.gif| vdc_XB_seconds.gif|vdc_XB_seconds.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Wylogowałeś się. Do zobaczenia| astGUIclient web-client VERSION|astGUIclient VERSION| astGUIclient web client|klient astGUIclient| @@ -491,3 +499,73 @@ CONSULTATIVE|KONSULTACYJNA| Close Message|Zamknij komunikat| TIMER NOTIFICATION|ZAWIADOMIENIE TIMER| >AGENTS<|>agentów<| +### START translations for 2.4 release ### +VIEW CALL LOG|ZOBACZ ZAPROSZENIE ZALOGUJ| +click to dial|kliknij, aby wybrać| +Close Call Log|Zamknij Zadzwoń Zaloguj| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|Musisz być WSTRZYMANE Aby wyświetlić rejestru połączeń| +Close Info Box|Close Box Info| +No calls on this day|Nie wzywa dziś| +You are in ALT dial mode, you must finish the lead before logging out|Jesteś w trybie ALT wybierania, należy zakończyć prowadzenie przy wylogowaniu| +Presets Button|Przycisk Presets| +SELECT A PRESET|SELECT PRESET| +Customer Hung-up, 3-way Call Ended Automatically|Klient Hung-up, 3-stronne połączenia zakończy się automatycznie| +Manual Dial Queue Calls Waiting|Podręcznik kolejki Dial połączeń oczekujących| +Manual Queue|Podręcznik kolejki| +This phone number is outside of the local call time|Ten numer telefonu jest poza czasu lokalnego połączenia| +Manual Queue is Off|Podręcznik Kolejka jest Wyłączony| +Manual Queue is On|Podręcznik Kolejka jest Włączony| +Call Notes:|Zadzwoń Uwagi:| +Call Notes List|Lista połączeń Uwagi| +view notes|przeglądać notatki| +CALL NOTES LOG|ZAPROSZENIE ZALOGUJ NOTES| +Close Call Notes|Zamknij Notatki połączeń| +CALL LOG FOR THIS LEAD|ZAPROSZENIE dziennika dla tego OŁOWIU| +SEARCH FOR A LEAD|SZUKAJ OŁOWIU| +SEARCH RESULTS|WYNIKI WYSZUKIWANIA| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|Musisz być WSTRZYMANE Aby wyszukać OŁOWIU| +Notes: when doing a search for a lead, the phone number, lead ID or|Uwagi: podczas wyszukiwania dla ołowiu, numer telefonu, identyfikator lub prowadzić| +are the best fields to use|są najlepsze pola w użyciu| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Korzystanie z innych pól może być wolniejsze. Wiodący wyszukiwania nie pozwala na wieloznacznych lub częściowe warunków wyszukiwania| +Lead search requests are all logged in the system|Ołów żądania wyszukiwania są rejestrowane w systemie| +Main Phone Number|Główny numer telefonu| +Alternate Phone Number|Alternatywny numer telefonu| +Address3 Phone Number|Address3 numer telefonu| +No results found|Nie znaleziono żadnych wyników| +Results Found:|Wyniki znaleziono:| +No calls found|Brak połączenia znaleźć| +reset form|zresetować formularz| +Callback Status|Stan oddzwaniania| +Callback Lead Status|Callback status wiodącego| +Callback Entry Time|Czas Wejście oddzwaniania| +Callback Trigger Time|Callback czas wyzwalania| +Callback Comments|Komentarze oddzwonienia| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Aby zobaczyć informacje na temat jednego z wywołań zwrotnych poniżej, kliknij na link INFO. Aby zadzwonić do klienta z powrotem teraz, kliknij na link DIAL. Jeśli klikniesz na płycie poniżej, aby go wybrać, zostanie on usunięty z listy| +rings all available agents until one picks up the phone|pierścienie wszystkie dostępne środki aż jeden odbierze telefon| +No calls for this lead|Nie wzywa do tego ołowiu| +Time Zone Warning|Ostrzeżenie Time Zone| +Phone Area Code Outside Dialable Zone|Telefon: Kierunek Poza Dialable Strefie| +Postal Code Outside Dialable Zone|Kod pocztowy Poza Dialable Strefie| +Custom Transfer|Niestandardowe Transferu| +System Delay, Please try again|Opóźnienie systemu, spróbuj ponownie| +Disposition Status List Hidden|Zdarzenia Ukryty Disposition| +The system has received a command to log you out, you have been logged out of your session|System otrzymał polecenie, aby wylogowanie, zostałeś wylogowany z sesji| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Uwagi: podczas wyszukiwania kontaktu, wieloznaczne lub częściowe kryteria wyszukiwania nie są dozwolone| +Contact search requests are all logged in the system|Wywołań wyszukiwania kontaktowe są rejestrowane w systemie| +SEARCH FOR A CONTACT|Wyszukiwanie kontaktów| +CONTACTS SEARCH RESULTS|KONTAKT WYNIKI WYSZUKIWANIA| +LEAD SEARCH|OŁÓW WYSZUKIWANIE| +Customer Time|Czas klienta| +TERRITORY SELECTION|WYBÓR TERYTORIUM| +TERRITORIES NOT SELECTED|Nie wybrano TERYTORIA| +SELECTED TERRITORIES|WYBRANE TERYTORIA| +Dialable Leads|Dialable Przewody| +You have now logged-in|Masz teraz zalogowanych| +You logged in at|Jesteś zalogowany na| +Refresh Campaign List|Lista Kampania Odśwież| +PLEASE SELECT A CAMPAIGN|WYBIERZ kampanii| +Agents View|agenci Zobacz| +-READY|-GOTOWE| +-INCALL|-Incall| +-PAUSED|-WSTRZYMANE| +CALL DISPOSITION|ZAPROSZENIE Disposition| diff --git a/agc_2-X/trunk/translations/pt_language.txt b/agc_2-X/trunk/translations/pt_language.txt index 236226e3..30463b49 100644 --- a/agc_2-X/trunk/translations/pt_language.txt +++ b/agc_2-X/trunk/translations/pt_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"JAN"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DEZ"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number.gif| vdc_XB_channel.gif|vdc_XB_channel.gif| vdc_XB_seconds.gif|vdc_XB_seconds.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Você tem registrado agora para fora. Obrigado| astGUIclient web-client VERSION|VERSÃO astGUIclient do correia-cliente| astGUIclient web client|web client astGUIclient| @@ -491,3 +499,73 @@ CONSULTATIVE|CONSULTIVO| Close Message|Fechar Mensagem| TIMER NOTIFICATION|NOTIFICAÇÃO TIMER| >AGENTS<|>AGENTES<| +### START translations for 2.4 release ### +VIEW CALL LOG|VEJA Registro de chamadas| +click to dial|clique para marcar| +Close Call Log|Feche Registro de chamadas| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|VOCÊ DEVE ESTAR EM PAUSA PARA VER seu registro de chamadas| +Close Info Box|Info Box Fechar| +No calls on this day|Nenhuma chamada neste dia| +You are in ALT dial mode, you must finish the lead before logging out|Você está em ALT modo de discagem, você deve terminar a liderança antes de sair| +Presets Button|Botão Presets| +SELECT A PRESET|Selecione um Preset| +Customer Hung-up, 3-way Call Ended Automatically|Cliente Hung-up, 3-way chamada foi terminada automaticamente| +Manual Dial Queue Calls Waiting|Fila de Marcação Manual Chamadas em espera| +Manual Queue|Manual de fila| +This phone number is outside of the local call time|Este número de telefone se encontra fora do tempo chamada local| +Manual Queue is Off|Manual de fila é Off| +Manual Queue is On|Manual de fila está Ligado| +Call Notes:|Chame Notas:| +Call Notes List|Call List Notes| +view notes|ver as notas| +CALL NOTES LOG|Registro de chamadas NOTAS| +Close Call Notes|Feche as notas de chamada| +CALL LOG FOR THIS LEAD|CONVITE PARA ESTE LOG LEAD| +SEARCH FOR A LEAD|BUSCA POR UMA LEAD| +SEARCH RESULTS|RESULTADOS DA PROCURA| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|VOCÊ DEVE ser pausado Para procurar um LEAD| +Notes: when doing a search for a lead, the phone number, lead ID or|Notas: ao fazer uma busca por um chumbo, o número de telefone, levar identidade ou| +are the best fields to use|são as melhores campos para usar| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Usando os outros campos pode ser mais lento. Busca de chumbo não permite termos de pesquisa curinga ou parcial| +Lead search requests are all logged in the system|Solicitações de pesquisa de chumbo são todos registrados no sistema| +Main Phone Number|Número de telefone principal| +Alternate Phone Number|Número de telefone alternativo| +Address3 Phone Number|Endereço3 número de telefone| +No results found|Não foram encontrados resultados| +Results Found:|Resultados Encontrado:| +No calls found|Nenhuma chamada encontrado| +reset form|repor forma| +Callback Status|Estado de retorno de chamada| +Callback Lead Status|Callback Estado de chumbo| +Callback Entry Time|Tempo de entrada de retorno de chamada| +Callback Trigger Time|Callback tempo de disparo| +Callback Comments|Comentários de retorno de chamada| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Para ver informações sobre um dos callbacks abaixo, clique no link INFO. Para chamar o cliente de volta agora, clique no link DIAL. Se você clicar em um registro abaixo para marcá-lo, ele será removido da lista| +rings all available agents until one picks up the phone|anéis de todos os agentes disponíveis até que um pega o telefone| +No calls for this lead|Nenhuma chamada para essa liderança| +Time Zone Warning|Aviso de fuso horário| +Phone Area Code Outside Dialable Zone|Telefone Código de Área fora da zona discável| +Postal Code Outside Dialable Zone|Código Postal fora da zona discável| +Custom Transfer|Transferência personalizado| +System Delay, Please try again|Atraso do Sistema, por favor, tente novamente| +Disposition Status List Hidden|Lista disposição Estado Escondido| +The system has received a command to log you out, you have been logged out of your session|O sistema recebeu um comando para desconectá-lo, você foi desconectado da sessão| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Notas: ao fazer uma busca de um contato, termos de pesquisa curinga ou parcial não são permitidos| +Contact search requests are all logged in the system|Pedidos de busca de contato são todos registrados no sistema| +SEARCH FOR A CONTACT|Procurar um Contato| +CONTACTS SEARCH RESULTS|CONTACTOS PESQUISA| +LEAD SEARCH|LEAD PESQUISA| +Customer Time|Hora do cliente| +TERRITORY SELECTION|SELEÇÃO DE TERRITÓRIO| +TERRITORIES NOT SELECTED|TERRITÓRIOS NÃO SELECIONADA| +SELECTED TERRITORIES|territórios selecionados| +Dialable Leads|Leads discáveis| +You have now logged-in|Você tem agora registrados em| +You logged in at|Você logou em| +Refresh Campaign List|Atualizar lista de Campanha| +PLEASE SELECT A CAMPAIGN|Selecione uma campanha| +Agents View|Agentes Ver| +-READY|-PRONTO| +-INCALL|-Chamadas| +-PAUSED|-PAUSA| +CALL DISPOSITION|CONVITE DISPOSIÇÃO| diff --git a/agc_2-X/trunk/translations/ru_language.txt b/agc_2-X/trunk/translations/ru_language.txt index 2b5015ab..c007b5c6 100644 --- a/agc_2-X/trunk/translations/ru_language.txt +++ b/agc_2-X/trunk/translations/ru_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"ЯНВ"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"НОЯ"| "DEC"|"ДЕК"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -52,357 +54,365 @@ Spanish|Испанский| French|Французский| German|Немецкий| Italian|Итальянский| -agc_check_voicemail_BLINK.gif|agc_check_voicemail_BLINK.gif| -agc_check_voicemail_OFF.gif|agc_check_voicemail_OFF.gif| -agc_check_voicemail_ON.gif|agc_check_voicemail_ON.gif| -agc_live_call_OFF.gif|agc_live_call_OFF.gif| -agc_live_call_ON.gif|agc_live_call_ON.gif| -agc_tab_active_lines.gif|agc_tab_active_lines.gif| -agc_tab_conferences.gif|agc_tab_conferences.gif| -agc_tab_main.gif|agc_tab_main.gif| -vdc_LB_dialnextnumber.gif|vdc_LB_dialnextnumber.gif| -vdc_LB_dialnextnumber_OFF.gif|vdc_LB_dialnextnumber_OFF.gif| -vdc_LB_grabparkedcall.gif|vdc_LB_grabparkedcall.gif| -vdc_LB_hangupcustomer.gif|vdc_LB_hangupcustomer.gif| -vdc_LB_hangupcustomer_OFF.gif|vdc_LB_hangupcustomer_OFF.gif| -vdc_LB_parkcall.gif|vdc_LB_parkcall.gif| -vdc_LB_parkcall_OFF.gif|vdc_LB_parkcall_OFF.gif| -vdc_LB_pause.gif|vdc_LB_pause.gif| -vdc_LB_pause_OFF.gif|vdc_LB_pause_OFF.gif| -vdc_LB_resume.gif|vdc_LB_resume.gif| -vdc_LB_resume_OFF.gif|vdc_LB_resume_OFF.gif| -vdc_LB_startrecording.gif|vdc_LB_startrecording.gif| -vdc_LB_stoprecording.gif|vdc_LB_stoprecording.gif| -vdc_LB_transferconf.gif|vdc_LB_transferconf.gif| -vdc_LB_transferconf_OFF.gif|vdc_LB_transferconf_OFF.gif| -vdc_LB_webform.gif|vdc_LB_webform.gif| -vdc_LB_webform_OFF.gif|vdc_LB_webform_OFF.gif| -vdc_XB_blindtransfer.gif|vdc_XB_blindtransfer.gif| -vdc_XB_blindtransfer_OFF.gif|vdc_XB_blindtransfer_OFF.gif| -vdc_XB_dialwithcustomer.gif|vdc_XB_dialwithcustomer.gif| -vdc_XB_dialwithcustomer_OFF.gif|vdc_XB_dialwithcustomer_OFF.gif| -vdc_XB_hangupbothlines.gif|vdc_XB_hangupbothlines.gif| -vdc_XB_hangupbothlines_OFF.gif|vdc_XB_hangupbothlines_OFF.gif| -vdc_XB_hangupxferline.gif|vdc_XB_hangupxferline.gif| -vdc_XB_hangupxferline_OFF.gif|vdc_XB_hangupxferline_OFF.gif| -vdc_XB_internalcloser.gif|vdc_XB_internalcloser.gif| -vdc_XB_internalcloser_OFF.gif|vdc_XB_internalcloser_OFF.gif| -vdc_XB_leave3waycall.gif|vdc_XB_leave3waycall.gif| -vdc_XB_leave3waycall_OFF.gif|vdc_XB_leave3waycall_OFF.gif| -vdc_XB_localcloser.gif|vdc_XB_localcloser.gif| -vdc_XB_localcloser_OFF.gif|vdc_XB_localcloser_OFF.gif| -vdc_XB_parkcustomerdial.gif|vdc_XB_parkcustomerdial.gif| -vdc_XB_parkcustomerdial_OFF.gif|vdc_XB_parkcustomerdial_OFF.gif| -vdc_XB_hotkeysactive.gif|vdc_XB_hotkeysactive.gif| -vdc_XB_hotkeysactive_OFF.gif|vdc_XB_hotkeysactive_OFF.gif| -vdc_LB_senddtmf.gif|vdc_LB_senddtmf.gif| -vdc_LB_senddtmf_OFF.gif|vdc_LB_senddtmf_OFF.gif| -vdc_XB_header.gif|vdc_XB_header.gif| -vdc_XB_number.gif|vdc_XB_number.gif| -vdc_XB_channel.gif|vdc_XB_channel.gif| -vdc_XB_seconds.gif|vdc_XB_seconds.gif| -vdc_tab_script.gif|vdc_tab_script.gif| +agc_check_voicemail_BLINK.gif|agc_check_voicemail_BLINK_ru.gif| +agc_check_voicemail_OFF.gif|agc_check_voicemail_OFF_ru.gif| +agc_check_voicemail_ON.gif|agc_check_voicemail_ON_ru.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD_ru.gif| +agc_live_call_OFF.gif|agc_live_call_OFF_ru.gif| +agc_live_call_ON.gif|agc_live_call_ON_ru.gif| +agc_tab_active_lines.gif|agc_tab_active_lines_ru.gif| +agc_tab_conferences.gif|agc_tab_conferences_ru.gif| +agc_tab_main.gif|agc_tab_main_ru.gif| +vdc_LB_dialnextnumber.gif|vdc_LB_dialnextnumber_ru.gif| +vdc_LB_dialnextnumber_OFF.gif|vdc_LB_dialnextnumber_OFF_ru.gif| +vdc_LB_grabparkedcall.gif|vdc_LB_grabparkedcall_ru.gif| +vdc_LB_hangupcustomer.gif|vdc_LB_hangupcustomer_ru.gif| +vdc_LB_hangupcustomer_OFF.gif|vdc_LB_hangupcustomer_OFF_ru.gif| +vdc_LB_parkcall.gif|vdc_LB_parkcall_ru.gif| +vdc_LB_parkcall_OFF.gif|vdc_LB_parkcall_OFF_ru.gif| +vdc_LB_pause.gif|vdc_LB_pause_ru.gif| +vdc_LB_pause_OFF.gif|vdc_LB_pause_OFF_ru.gif| +vdc_LB_resume.gif|vdc_LB_resume_ru.gif| +vdc_LB_resume_OFF.gif|vdc_LB_resume_OFF_ru.gif| +vdc_LB_startrecording.gif|vdc_LB_startrecording_ru.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF_ru.gif| +vdc_LB_stoprecording.gif|vdc_LB_stoprecording_ru.gif| +vdc_LB_transferconf.gif|vdc_LB_transferconf_ru.gif| +vdc_LB_transferconf_OFF.gif|vdc_LB_transferconf_OFF_ru.gif| +vdc_LB_webform.gif|vdc_LB_webform_ru.gif| +vdc_LB_webform_OFF.gif|vdc_LB_webform_OFF_ru.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two_ru.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF_ru.gif| +vdc_XB_blindtransfer.gif|vdc_XB_blindtransfer_ru.gif| +vdc_XB_blindtransfer_OFF.gif|vdc_XB_blindtransfer_OFF_ru.gif| +vdc_XB_dialwithcustomer.gif|vdc_XB_dialwithcustomer_ru.gif| +vdc_XB_dialwithcustomer_OFF.gif|vdc_XB_dialwithcustomer_OFF_ru.gif| +vdc_XB_hangupbothlines.gif|vdc_XB_hangupbothlines_ru.gif| +vdc_XB_hangupbothlines_OFF.gif|vdc_XB_hangupbothlines_OFF_ru.gif| +vdc_XB_hangupxferline.gif|vdc_XB_hangupxferline_ru.gif| +vdc_XB_hangupxferline_OFF.gif|vdc_XB_hangupxferline_OFF_ru.gif| +vdc_XB_internalcloser.gif|vdc_XB_internalcloser_ru.gif| +vdc_XB_internalcloser_OFF.gif|vdc_XB_internalcloser_OFF_ru.gif| +vdc_XB_leave3waycall.gif|vdc_XB_leave3waycall_ru.gif| +vdc_XB_leave3waycall_OFF.gif|vdc_XB_leave3waycall_OFF_ru.gif| +vdc_XB_localcloser.gif|vdc_XB_localcloser_ru.gif| +vdc_XB_localcloser_OFF.gif|vdc_XB_localcloser_OFF_ru.gif| +vdc_XB_parkcustomerdial.gif|vdc_XB_parkcustomerdial_ru.gif| +vdc_XB_parkcustomerdial_OFF.gif|vdc_XB_parkcustomerdial_OFF_ru.gif| +vdc_XB_hotkeysactive.gif|vdc_XB_hotkeysactive_ru.gif| +vdc_XB_hotkeysactive_OFF.gif|vdc_XB_hotkeysactive_OFF_ru.gif| +vdc_LB_senddtmf.gif|vdc_LB_senddtmf_ru.gif| +vdc_LB_senddtmf_OFF.gif|vdc_LB_senddtmf_OFF_ru.gif| +vdc_XB_header.gif|vdc_XB_header_ru.gif| +vdc_XB_number.gif|vdc_XB_number_ru.gif| +vdc_XB_channel.gif|vdc_XB_channel_ru.gif| +vdc_XB_seconds.gif|vdc_XB_seconds_ru.gif| +vdc_tab_script.gif|vdc_tab_script_ru.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Вы вышли из системы. Спасибо| -astGUIclient web-client VERSION|Версия web-клиента astGUIclient | -astGUIclient web client|web-клиент astGUIclient| -VICIDIAL web client|web-клиент VICIDIAL| -VICIDIAL web-client version|Версия web-клиента VICIDIAL| -You can only monitor Zap channels|Вы можете только контролировать Zap каналы| -Stop Record|Остановить Запись| -you are logged into this phone|вы зарегистрированы на телефон| -Back to Main Window|Вернуться к Главному Окну| -LIVE CALLS ON THIS PHONE|ЖИВЫЕ ВЫЗОВЫ НА ЭТОТ ТЕЛЕФОН| -LIVE CALLS IN THIS CONFERENCE|ЖИВЫЕ ВЫЗОВЫ В ЭТОЙ КОНФЕРЕНЦИИ| -LIVE CALL TRANSFER|ПЕРЕВОД ЖИВОГО ВЫЗОВА| -CLIENT CHANNEL|КАНАЛ КЛИЕНТА| -REMOTE CHANNEL|УДАЛЕННЫЙ КАНАЛ| -CLICK HERE TO LOG IN AGAIN|КЛИКНИТЕ ЗДЕСЬ, ЧТОБЫ СНОВА ВОЙТИ| -ACTIVE DISPLAY PAUSED|ACTIVE DISPLAY PAUSED| -Main Panel|Главная Панель| -Active Lines Panel|Панель Активных Линий| -Conferences Panel|Панель Конференций| -Check Voicemail|Проверьте Голосовую почту| -Live Call|Живой Вызов| +astGUIclient web-client VERSION|Версия веб-клиента astGUIclient| +astGUIclient web client|Веб-клиент astGUIclient| +VICIDIAL web client|Веб-клиент VICIDIAL| +VICIDIAL web-client version|Версия веб-клиента VICIDIAL| +Agent web-client version|Версия веб-клиента| +You can only monitor Zap channels|Отслеживать можно только линии ISDN (ZAP)| +Stop Record|Остановить запись| +you are logged into this phone|Ваш телефон| +Back to Main Window|Вернуться в главное окно| +LIVE CALLS ON THIS PHONE|АКТИВНЫЕ ЗВОНКИ ДЛЯ ЭТОГО ТЕЛЕФОНА| +LIVE CALLS IN THIS CONFERENCE|АКТИВНЫЕ ЗВОНКИ ДЛЯ ЭТОЙ КОНФЕРЕНЦИИ| +LIVE CALL TRANSFER|ПЕРЕВОД АКТИВНОГО ЗВОНКА| +CLIENT CHANNEL|ЛИНИЯ КЛИЕНТА| +REMOTE CHANNEL|УДАЛЕННАЯ ЛИНИЯ| +CLICK HERE TO LOG IN AGAIN|КЛИКНИТЕ ЗДЕСЬ ДЛЯ ПОВТОРНОГО ВХОДА В СИСТЕМУ| +ACTIVE DISPLAY PAUSED|АКТИВНОЕ ОТОБРАЖЕНИЕ ПРИОСТАНОВЛЕНО| +Main Panel|Главная панель| +Active Lines Panel|Панель активных линий| +Conferences Panel|Панель конференций| +Check Voicemail|Проверить голосовую почту| +Live Call|Активный звонок| Hangup Trunk|Hangup Trunk| Hijack Trunk|Hijack Trunk| Listen Trunk|Listen Trunk| -Active Local Menu|Активное Локальное Меню| +Active Local Menu|Активное местное меню| Hangup Local|Hangup Local| Hijack Local|Hijack Local| Listen Local|Listen Local| -Channel to be transferred|Канал в который будет переведен| -Extensions Menu|Меню Расширений| -Send to selected extension|Отправить в выбранное расширение| -Send to selected vmail box|Отправить в выбранный vmail box| -Send to this number|Отправить в этот номер| -click on a number below to send to a conference|кликните на номере ниже, чтобы отправить в конференцию| -Send my channel too|Отправить также мой канал| -Conferences Menu|Меню Конференций| -LOCAL Extensions Dial|ЛОКАЛЬНОЕ Расширение Набора номера| -Phone calling from|Телефонный вызов от| -Call selected extension|Вызов в выбранное расширение| -Call selected vmail box|Вызов в выбранный vmail box| -LOCAL DIAL EXTENSIONS|ЛОКАЛЬНЫЕ РАСШИРЕНИЯ НАБОРА НОМЕРА| -OUTBOUND CALLS|ИСХОДЯЩИЕ ВЫЗОВЫ| -INBOUND CALLS|ВХОДЯЩИЕ ВЫЗОВЫ| -Refresh rate|Норма обновлений| -MANUAL DIAL|РУЧНОЙ НАБОР НОМЕРА| -CALL DATE\/TIME|ЗВОНИТЬ ДАТА/ВРЕМЯ| -LOCAL HANGUP|ЛОКАЛЬНВЙ HANGUP| -PARKED CALLS|ПАРКОВАТЬ ВЫЗОВ| -PARKED BY|ПАРКОВАНЫЙ| +Channel to be transferred|Линия будет переключена| +Extensions Menu|Меню номеров| +Send to selected extension|Перевести на выбранный номер| +Send to selected vmail box|Перевести на выбранный номер голосовой почты| +Send to this number|Перевести на этот номер| +click on a number below to send to a conference|кликните на номере внизу для отправки в конференцию| +Send my channel too|Перевести также мою линию| +Conferences Menu|Меню конференций| +LOCAL Extensions Dial|Позвонить на МЕСТНЫЕ номера| +Phone calling from|Телефон звонит от| +Call selected extension|Позвонить на выбранный номер| +Call selected vmail box|Позвонить на выбранный номер голосовой почты| +LOCAL DIAL EXTENSIONS|МЕСТНЫЕ НОМЕРА ДЛЯ ВЫЗОВА| +OUTBOUND CALLS|ИСХОДЯЩИЕ ЗВОНКИ| +INBOUND CALLS|ВХОДЯЩИЕ ЗВОНКИ| +Refresh rate|Темп обновления| +MANUAL DIAL|РУЧНОЙ НАБОР| +CALL DATE\/TIME|ДАТА И ВРЕМЯ ЗВОНКА| +LOCAL HANGUP|МЕСТНЫЙ ОТБОЙ| +PARKED CALLS|ЗАПАРКОВАННЫЕ ВЫЗОВЫ| +PARKED BY|ЗАПАРКОВАНО| PARKED TIME|ВРЕМЯ ПАРКОВКИ| -Registered to|Registered to| -Enter Conference|Вход на Конференцию| -Dial From Conf|Набор номера Conf| -Active Extensions|Активные Расширения| -Outside Lines|Внешние Линии| -Local Extensions|Локальные Расширения| -Data Goes Here|Данные Идут Сюда| -Trunk Action|Trunk Action| -Local Action|Local Action| -Conferences List|Список Конференций| -Click on a conference room number on the left for info on that conference|Для информации о конференции кликните на номер конференции слева| -List Display|Показывать Списки| -Live Extensions|Активные расширения| -Busy Extensions|Занятые Расширения| -Outside Lines|Внешние Линии| -script runtime|время выполнения скрипта| -Call Log Display|Показать Логи Вызовов| -is not valid|это неправильно| +Registered to|Зарегистрировано на| +Enter Conference|Войти в конференцию| +Dial From Conf|Позвонить из конференции| +Active Extensions|Активные номера| +Outside Lines|Внешние линии| +Local Extensions|Местные номера| +Data Goes Here|Данные идут сюда| +Trunk Action|Операция над транком| +Local Action|Местная операция| +Conferences List|Список конференций| +Click on a conference room number on the left for info on that conference|Кликните на номере конференции слева для сведений о ней| +List Display|Отображение списка| +Live Extensions|Активные номера| +Busy Extensions|Занятые номера| +Outside Lines|Внешние линии| +script runtime|время исполнения скрипта| +Call Log Display|Отображение журнала вызовов| +is not valid|неверный| or protocol|или протокол| -Conf Extension Check|Conf Extension Check| -has been registered to|был зарегистрирован на| -LIVE INBOUND CALL|ЖИВОЙ ВХОДЯЩИЙ ВЫЗОВ| -Number Dialed|Набранный Номер| -SEND TO MY VOICEMAIL|ПОСЛАТЬ В МОЙ VOICEMAIL| -Live Extension Check|Live Extension Check| -Manager Send|Отослать Менеджеру| -command not inserted|команда не введена| -command sent for|посылать команду для| +Conf Extension Check|Проверка номера конференции| +has been registered to|Был зарегистрирован| +LIVE INBOUND CALL|АКТИВНЫЙ ВХОДЯЩИЙ ВЫЗОВ| +Number Dialed|Набранный номер| +SEND TO MY VOICEMAIL|ПЕРЕВЕСТИ НА МОЮ ГОЛОСОВУЮ ПОЧТУ| +Live Extension Check|Проверка активного номера| +Manager Send|Перевод менеджеру| +command not inserted|команда не включена| +command sent for|команда отправлена| One of these variables|Одна из этих переменных| -must be greater than 2 characters|должно быть больше чем 2 символа| -must be greater than 14 characters|должно быть больше чем 14 символов| -must be set|должен быть установлен| -not sent|не послано| -Cannot find empty conference|Не могу найти свободную конференцию| -is not live|это не активно| -RECORDING WILL LAST UP TO 60 MINUTES|ЗАПИСЬ МОЖЕТ ПРОДОЛЖАТЬСЯ ДО 60 МИН.| -Parked Calls Display|Показать Паркованные Вызовы| -Database Query Script|Скрипт Запроса Базы Данных| -Group Choice|Выбор Группы| -has been registered to user|был зарегистрован пользователем| -HOPPER EMPTY|ПУСТОЙ КОНТЕЙНЕР| -LOG NOT ENTERED|LOG НЕ ВВЕДЕН| +must be greater than 2 characters|должен быть длиннее 2 символов| +must be greater than 14 characters|должен быть длиннее 14 символов| +must be set|должен быть указан| +not sent|не отправлен| +Cannot find empty conference|Не найдена свободная конференция| +is not live|не активен| +RECORDING WILL LAST UP TO 60 MINUTES|ЗАПИСЬ БУДЕТ ПРОДОЛЖАТЬСЯ ДО 60 МИНУТ| +Parked Calls Display|Отображение запаркованных вызовов| +Database Query Script|Скрипт запроса базы данных| +Group Choice|Выбор группы| +has been registered to user|был зарегистрирован| +HOPPER EMPTY|БУФЕР ПУСТ| +LOG NOT ENTERED|ЖУРНАЛ НЕ УКАЗАН| has been changed to|был изменен на| -information has been updated|информация обновлена| -is now in status|новый статус| -Voicemail Check|Проверка Voicemail| -voicemail box|voicemail box| -Re-Login|Re-Login| -User Password|Пароль Пользователя| -User Login|Логин Пользователя| -Phone Login|Логин Телефона| -Phone Password|Пароль Телефона| -Campaign not active, please try again|Кампания не активна, пожалуйста, попробуйте еще раз| -Login incorrect, please try again|Логин неправильный, пожалуйста, попробуйте еще раз| -Campaign Login|Логин Кампании| -Sorry, your phone login and password are not active in this system, please try again|Извините, но ваш логин и пароль телефона не активен в этой системе. Пожалуйста, попробуйте еще раз| -leads left to call in hopper|Leads оставил вызовы в контейнере| -CAMPAIGN CUSTOM PARKING|ПОЛЬЗОВАТЕЛЬСКИЙ РЕЖИМ ПАРКОВКИ КАМПАНИИ| -CAMPAIGN DEFAULT PARKING|РЕЖИМ ПАРКОВКИ КАМПАНИИ ПО УМОЛЧАНИЮ| -CAMPAIGN CUSTOM WEB FORM|ПОЛЬЗОВАТЕЛЬСКАЯ WEB-ФОРМА КАМПАНИИ| -CAMPAIGN DEFAULT WEB FORM|WEB-ФОРМА КАМПАНИИ ПО УМОЛЧАНИЮ| -CAMPAIGN ALLOWS CLOSERS|КАМПАНИЯ ПОЗВОЛЯЕТ CLOSERS| -CAMPAIGN ALLOWS NO CLOSERS|КАМПАНИЯ НЕ ПОЗВОЛЯЕТ CLOSERS| -USING PREVIOUS MEETME ROOM|ИСПОЛЬЗОВАНИЕ ПРЕДЫДУЩЕЙ MEETME ROOM| -USING NEW MEETME ROOM|ИСПОЛЬЗОВАНИЕ НОВОЙ MEETME ROOM| -old QUEUE and INCALL reverted list|old QUEUE and INCALL reverted list| -old QUEUE and INCALL reverted hopper|old QUEUE and INCALL reverted hopper| -old vicidial_live_agents records cleared|старые отчеты vicidial_live_agents очищены| -campaign is set to auto_dial_level|кампания установлена в auto_dial_level| -new vicidial_live_agents record inserted|новая vicidial_live_agents запись вставлено| -campaign is set to manual dial|кампания установлена в ручной набор номера| -Sorry, there are no leads in the hopper for this campaign|Жаль, но leads нет в контейнере этой кампании| -Dial Next Number|Набрать следующий номер| -LIVE CALLS IN YOUR SESSION|ЖИВЫЕ ВЫЗОВЫ В ВАШЕЙ СЕССИИ| -Stop Recording|Остановить Запись| -Start Recording|Начать Запись| -Transfer number must have more than 1 digit|У номера перевода должно быть больше чем 1 цифра| -Grab Parked Call|Захват Ожидающего Вызова| -Park Call|Парковать Вызов| -Waiting for Ring|Ожидание Кольца вызова| -Called 3rd party|Вызов третьей стороны| -LEAVE 3-WAY CALL|ОСТАВИТЬ 3-WAY ЗАПРОС| -Dial With Customer|Набор номера С Клиентом| -Park Customer Dial|Парковать Набор номера Клиента| -Hangup Xfer Line|Разъединение Xfer Линии| -Hangup Both Lines|Разъединить Обе Линии| -Hangup Customer|Разъединить Клиента| -Transfer - Conference|Перевод - Конференция| -LOCAL CLOSER|ЛОКАЛЬНЫЙ CLOSER| -INTERNAL CLOSER|ВНУТРЕННИЙ CLOSER| -Dial Blind Transfer|Слепой Перевод Набора номера| -Dial timed out, contact your system administrator|Превышено время ожидания набора номера, свяжитесь с сисадмином| -No more leads in the hopper for campaign|Нет больше leads для кампании в контейнере| -Web Form|Web Форма| -You Must Select a Disposition|Вы Должны Выбрать Диспозицию| -GROUPS NOT SELECTED|ГРУППЫ НЕ ВЫБРАНЫ| +information has been updated|сведения были обновлены| +is now in status|теперь находится в состоянии| +Voicemail Check|Проверка голосовой почты| +voicemail box|ящик голосовой почты| +Re-Login|Повторный вход| +User Password|Ваш пароль| +User Login|Ваше имя| +Phone Login|Ваш телефон| +Phone Password|Пароль телефона| +Campaign not active, please try again|Кампания не активна, попробуйте снова, пожалуйста| +Login incorrect, please try again|Имя неверно, попробуйте еще раз, пожалуйста| +Campaign Login|Вход в кампанию| +Sorry, your phone login and password are not active in this system, please try again|Извините, Ваш телефон и его пароль не активировны в системе, попробуйте еще раз, пожалуйста| +leads left to call in hopper|номера для обзвона в буфере| +CAMPAIGN CUSTOM PARKING|ОСОБАЯ ПАРКОВКА ДЛЯ КАМПАНИИ| +CAMPAIGN DEFAULT PARKING|ОБЫЧНАЯ ПАРКОВКА ДЛЯ КАМПАНИИ| +CAMPAIGN CUSTOM WEB FORM|ОСОБАЯ ВЕБ-ФОРМА ДЛЯ КАМПАНИИ| +CAMPAIGN DEFAULT WEB FORM|ОБЫЧНАЯ ВЕБ-ФОРМА ДЛЯ КАМПАНИИ| +CAMPAIGN ALLOWS CLOSERS|КАМПАНИЯ РАЗРЕШАЕТ ЗАВЕРШЕНИЕ| +CAMPAIGN ALLOWS NO CLOSERS|КАМПАНИЯ НЕ РАЗРЕШАЕТ ЗАВЕРШЕНИЕ| +USING PREVIOUS MEETME ROOM|ИСПОЛЬЗУЕТСЯ ПРЕДЫДУЩАЯ КОНФЕРЕНЦИЯ| +USING NEW MEETME ROOM|ИСПОЛЬЗУЕТСЯ НОВАЯ КОНФЕРЕНЦИЯ| +old QUEUE and INCALL reverted list|старый обратный список для очереди и входящих| +old QUEUE and INCALL reverted hopper|старый обратный буфер для очереди и входящих| +old vicidial_live_agents records cleared|старые записи активных агентов очищены| +campaign is set to auto_dial_level|в кампании установлен уровень автодозвона| +new vicidial_live_agents record inserted|новая запись активного агента добавлена| +campaign is set to manual dial|в кампании задан ручной дозвон| +Sorry, there are no leads in the hopper for this campaign|Извините, в буфере нет номеров для кампании| +Dial Next Number|Позвонить по следующему номеру| +LIVE CALLS IN YOUR SESSION|АКТИВНЫЕ ЗВОНКИ В ВАШЕЙ СЕССИИ| +Stop Recording|Остановить запись| +Start Recording|Начать запись| +Transfer number must have more than 1 digit|В номере для перевода должно быть больше 1 цифры| +Grab Parked Call|Отпарковать вызов| +Park Call|Запарковать вызов| +Waiting for Ring|Ожидание звонка| +Called 3rd party|Третья сторона в вызове| +LEAVE 3-WAY CALL|Покинуть трехсторонний вызов| +Dial With Customer|Набрать с клиентом| +Park Customer Dial|Запарковать вызов клиента| +Hangup Xfer Line|Отключить линию перевода| +Hangup Both Lines|Отключить обе линии| +Hangup Customer|Завершить вызов| +Transfer - Conference|Перевод - конференция| +LOCAL CLOSER|МЕСТНОЕ ЗАВЕРШЕНИЕ| +INTERNAL CLOSER|ВНУТРЕННЕ ЗАВЕРШЕНИЕ| +Dial Blind Transfer|Перевести вслепую| +Dial timed out, contact your system administrator|Время дозвона истекло, свяжитесь со своим системным администратором| +No more leads in the hopper for campaign|В буфере больше нет номеров для кампании| +Web Form|Веб-форма| +You Must Select a Disposition|Вы должны выбрать код завершения| +GROUPS NOT SELECTED|НЕ ВЫБРАННЫЕ ГРУППЫ| SELECTED GROUPS|ВЫБРАННЫЕ ГРУППЫ| -You cannot log out during a Dial attempt|Вы не можете выйти из системы во время попытки Набора номера| -Wait 50 seconds for the dial to fail out if it is not answered|Ждите 50 секунд набора номера для явного 'нет ответа'| -STILL A LIVE CALL! Hang it up then you can log out|ВСЕ ЕЩЕ АКТИВНЫЙ ЗАПРОС! Разъедините и тогда выходите из системы| -Hide conference call channel information|Скрыть информацию о канале конференц-связи| -Show conference call channel information|Показать информацию о канале конференц-связи| -Logged in as User|Пользователь| -No one is in your session|Никого нет в вашей сессии| -Customer has hung up|Клиент разъединен| -End-of-call Disposition Selection|Выбор Диспозиции End-of-call| -CLOSER INBOUND GROUP SELECTION|ВЫБОР INBOUND ГРУППЫ CLOSER| -Closer Inbound Group Selection|Closer Inbound Group Selection| -BLENDED CALLING|BLENDED CALLING| +You cannot log out during a Dial attempt|Нельзя выйти из системы во время дозвона| +Wait 50 seconds for the dial to fail out if it is not answered|Если на звонок не отвечают, подождите 50 секунд до истечения времени дозвона| +STILL A LIVE CALL! Hang it up then you can log out|ВЫЗОВ ВСЕ ЕЩЕ АКТИВЕН! Завершите его, а потом выходите из системы| +Hide conference call channel information|Скрыть сведения о линии конференции| +Show conference call channel information|Показать сведения о линии конференции| +Logged in as User|Вход от имени| +Noone is in your session|В Вашей сессии никого нет| +Customer has hung up|Клиент повесил трубку| +End-of-call Disposition Selection|Выбор кода завершения по окончании вызова| +CALL DISPOSITION|КОД ЗАВЕРШЕНИЯ ВЫЗОВА| +CLOSER INBOUND GROUP SELECTION|ВЫБОР ВХОДЯЩЕЙ ГРУППЫ| +Closer Inbound Group Selection|Выбор входящей группы| +BLENDED CALLING|Смешанный дозвон| outbound activated|исходящие активированы| -Preview the Lead then|Просмотр Lead тогда| -Lead was not reverted, there was an error|Lead не вернулся, была ошибка| -call was not placed, there was an error|вызов не был обслужен, была ошибка| -Number to call|Номер для вызова| -Customer Information|Информация Клиента| -Lead Dispositioned As|Lead Диспозицию как| -Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call|Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call| -When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically|Когда активно, просто нажмите клавишу желаемой диспозиции для этого запроса. Тогда запрос будет автоматически разъединен и dispositioned| -Disposition Hot Keys|Горячие Клавиши Диспозиции| -Cust Time|Cust Время| -RECORD ID|ID ЗАПИСИ| +Preview the Lead then|Предпросмотр сведений о номере| +Lead was not reverted, there was an error|Номер не был возвращен из-за ошибки| +call was not placed, there was an error|вызов не был произведен из-за ошибки| +Number to call|Вызываемый номер| +Customer Information|Сведения о клиенте| +Lead Dispositioned As|Вызов завершен с кодом| +Any changes made to the customer information below at this time will not be comitted, You must change customer information before you Hangup the call|Любые изменения в сведениях о клиенте, произведенные в настоящий момент не будут сохранены. Это нужно делать до завершения вызова| +When active, simply press the keyboard key for the desired disposition for this call. The call will then be hungup and dispositioned automatically|Если включено, просто нажмите клавишу выбора кода завершения. Вызов будет завершен автоматически| +Disposition Hot Keys|Клавиши кодов завершения| +Cust Time|Время| +RECORD ID|КОД ЗАПИСИ| RECORDING FILE|ФАЙЛ ЗАПИСИ| -HOT KEYS ACTIVE|АКТИВНЫЕ ГОРЯЧИЕ КЛАВИШИ| -HOT KEYS INACTIVE|НЕАКТИВНЫЕ ГОРЯЧИЕ КЛАВИШИ| -DIAL OVERRIDE|НАБЕРИТЕ ОТМЕНУ| -SKIP LEAD|ПРОПУСТИТЬ LEAD| -DIAL LEAD|НАБОР LEAD| -LEAD PREVIEW|ПРЕДВАРИТЕЛЬНЫЙ ПРОСМОТР LEAD| -PAUSE AGENT DIALING|ПАУЗА ВЫЗОВА| -DISPOSITION CALL|DISPOSITION CALL| - session ID| ID сессии| - to campaign| в кампанию| -Select a CallBack Date|Выберите дату для CallBack| - maximize| максимизировать| - minimize| минимизировать| +HOT KEYS ACTIVE|КЛАВИШИ КОДОВ ВКЛЮЧЕНЫ| +HOT KEYS INACTIVE|КЛАВИШИ КОДОВ ВЫКЛЮЧЕНЫ| +DIAL OVERRIDE|НАБОР ДРУГОГО НОМЕРА| +SKIP LEAD|ПРОПУСТИТЬ НОМЕР| +DIAL LEAD|НАБРАТЬ НОМЕР| +LEAD PREVIEW|ПРЕДПРОСМОСТР СВЕДЕНИЙ О НОМЕРЕ| +PAUSE AGENT DIALING|ПРИОСТАНОВИТЬ ДОЗВОН АГЕНТА| +DISPOSITION CALL|ЗАВЕРШИТЬ ВЫЗОВ| + session ID| код сессии| + to campaign| в кампании| +Select a CallBack Date|Выбрать дату обратного звонка| + maximize | увеличить | + minimize | уменьшить | You must choose a date|Вы должны выбрать дату| -Select a Date Below|Выберите Дату Ниже| -Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list|Чтобы позвонить клиенту сейчас, кликните на callback ниже. Если Вы нажмете на record ниже, чтобы позвонить, то это будет удалено из списка| -If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there|Если вы хотите набрать номер, но не добовлять новый lead, введите точный dialstring который вы хотите вызвать в поле Отмены Номера ниже. Для разъединения этого запроса вы должны будете открыть ссылку ЗАПРОСЫ В ЭТОЙ СЕССИИ внизу экрана, at the bottom of the screen and hang it up by clicking on its channel link there| -YOU CANNOT SKIP A CALLBACK OR MANUAL DIAL, YOU MUST DIAL THE LEAD|ВЫ НЕ МОЖЕТЕ ПРОПУСТИТЬ ПОВТОРНЫЙ ЗВОНОК ИЛИ РУЧНОЙ НАБОР НОМЕРА, ВЫ ДОЛЖНЫ DIAL THE LEAD| -YOU MUST BE PAUSED TO MANUAL DIAL A NEW LEAD IN AUTO-DIAL MODE|ВЫ ДОЛЖНЫ СДЕЛАТЬ ПАУЗУ РУЧНОГО НАБОРА НОМЕРА НОВЫЙ LEAD В РЕЖИМЕ АВТО НАБОРА НОМЕРА| -Enter information below for the new lead you wish to call|Ведите информацию ниже для нового lead который вы хотите вызвать| -YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE|ВЫ ДОЛЖНЫ СДЕЛАТЬ ПАУЗУ, ЧТОБЫ ПРОВЕРИТЬ ВЫЗОВЫ В РЕЖИМЕ АВТОМАТИЧЕСКОГО НАБОРА НОМЕРА| -Note: all new manual dial leads will go into list 999|Примечание: все новые leads ручного набора номера войдут в список 999| -YOU DO NOT HAVE PERMISSIONS TO TRANSFER CALLS|У ВАС НЕТ РАЗРЕШЕНИЯ ДЛЯ ПЕРЕВОДА ВЫЗОВА| -will be added to the beginning of this number|будет добавлен в начале этого номера| -This is usually a 1 in the USA-Canada|Обычно 7 для России и некоторых стран СНГ| -NEW MANUAL DIAL LEAD FOR|НОВЫЙ LEAD РУЧНОЙ НАБОР НОМЕРА ДЛЯ| -Finish and Disposition Call|Конец и Вызов Диспозиции| -10 digits max - digits only|максимально 10 цифр - только цифры| -Note: a dial prefix of|Примечание: префикс набора номера | -Hangup Again|Разъединить Снова| +Select a Date Below|Выберите дату ниже| +Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list|Кликните на обратном вызове ниже, чтобы отзвониться клиенту. Если вы кликните на записи ниже для вызова, она будет удалена из списка| +If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there|Если Вы хотите набрать номер, но не добавлять его в буфер, введите полный номер, который хотите вызвать, в поле ВВОД ДРУГОГО НОМЕРА ниже. Чтобы завершить этот вызов, Вам придется открыть ссылку ВЫЗОВЫ В ЭТОЙ СЕССИИ снизу на экране и завершить его кликом по ссылке на соответствующую линию| +YOU CANNOT SKIP A CALLBACK OR MANUAL DIAL, YOU MUST DIAL THE LEAD|ОБРАТНЫЙ ВЫЗОВ ИЛИ РУЧНОЙ НАБОР ПРОПУСТИТЬ НЕЛЬЗЯ, ВЫ ДОЛЖНЫ ПРОИЗВЕСТИ ВЫЗОВ| +YOU MUST BE PAUSED TO MANUAL DIAL A NEW LEAD IN AUTO-DIAL MODE|ЧТОБЫ ПРОИЗВЕСТИ РУЧНОЙ НАБОР В РЕЖИМЕ АВТОДОЗВОНА ВАМ НУЖНО БЫТЬ В СОСТОЯНИИ ПАУЗЫ| +Enter information below for the new lead you wish to call|Введите сведения о номере, который Вы хотите вызвать| +YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE|ДЛЯ ПРОВЕРКИ ОБРАТНЫХ ВЫЗОВОВ В РЕЖИМЕ АВТОДОЗВОНА ВЫ ДОЛЖНЫ БЫТЬ В СОСТОЯНИИ ПАУЗЫ| +Note: all new manual dial leads will go into list 999|Примечание: вре новые номера для ручного набора сохраняются в списке 999| +YOU DO NOT HAVE PERMISSIONS TO TRANSFER CALLS|ВАМ НЕ РАЗРЕШЕНО ПЕРЕВОДИТЬ ВЫЗОВЫ| +will be added to the beginning of this number|будет добавлено в начало этого номера| +This is usually a 1 in the USA-Canada|В США и Канаде это обычно единица| +NEW MANUAL DIAL LEAD FOR|НОВЫЙ РУЧНОЙ НАБОР НОМЕРА ДЛЯ| +Finish and Disposition Call|Завершить вызов с кодом| +10 digits max - digits only|не более 10 цифр - только цифры| +Note: a dial prefix of|Примечание: префикс набора| +Hangup Again|Снова завершить вызов| Go Back|Вернуться| -Call Agent Again|Вызов Оператора Снова| -MY CALLBACK ONLY|ТОЛЬКО МОИ CALLBACK| -NO ACTIVE CALLBACKS|НЕТ АКТИВНЫХ CALLBACK| -ACTIVE CALLBACKS|АКТИВНЫЕ CALLBACK| -CALLBACKS FOR AGENT|CALLBACK ДЛЯ ОПЕРАТОРА| -Dial Code:|Код страны:| -Dial Override|Отмененный набор номера| +Call Agent Again|Снова вызвать агента| +MY CALLBACK ONLY|ТОЛЬКО МОИ ОБРАТНЫЕ ВЫЗОВЫ| +NO ACTIVE CALLBACKS|НЕТ АКТИВНЫХ ОБРАТНЫХ ВЫЗОВОВ| +ACTIVE CALLBACKS|АКТИВНЫЕ ОБРАТНЫЕ ВЫЗОВЫ| +CALLBACKS FOR AGENT|ОБРАТНЫЕ ВЫЗОВЫ АГЕНТА| +Dial Code:|Код набора:| +Dial Override|Ввод другого номера| digits only please|только цифры, пожалуйста| -Dial Now|Новый Набор номера| -CB Comments|CB Комментарии| -Title|Title| -Your Status|Ваш Статус| - STATUS| СТАТУС| - RESET| RESET| +Dial Now|Вызвать немедленно| +CB Comments|Примечания| +Title|Должность| +Your Status|Ваше состояние| + STATUS| СОСТОЯНИЕ| + RESET| СБРОС| CLEAR FORM|ОЧИСТИТЬ ФОРМУ| -SUBMIT|SUBMIT| -Incoming|Входящий| -Calling|Запрос| -Called|Вызванный| +SUBMIT|ВВОД| +Incoming|Входящие| +Calling|Вызываю| +Called|Вызван| Campaign|Кампания| -Status|Статус| -Inserted|Введенный| - seconds| секунды| +Status|Состояние| +Inserted|Добавлено| + seconds| секунд| HELP|ПОМОЩЬ| - Login | Логин | -Login:|Логин:| -User |Пользователь | + Login | Вход | +Login:|Имя:| +User |Агент | Password|Пароль| VERSION|ВЕРСИЯ| BUILD|СБОРКА| Server|Сервер| RECORD |ЗАПИСЬ | ->HANGUP|>РАЗЪЕДИНЕНИЕ| +>HANGUP|>ЗАВЕРШЕНИЕ| >XFER|>ПЕРЕВОД| PARK|ПАРКОВКА| -IN-NUMBER|В-НОМЕР| +IN-NUMBER|ВХОДЯЩИЙ-НОМЕР| NUMBER|НОМЕР| -CALLERID|ВЫЗЫВАЮЩИЙID| +CALLERID|CALLERID| CALL| ВЫЗОВ| -PICKUP|PICKUP| +PICKUP|ПЕРЕХВАТИТЬ| CONFERENCE|КОНФЕРЕНЦИЯ| -Refresh|Обновление| -Send DTMF|Послать DTMF| -ORDER|ПОРЯДОК| +Refresh|Обновить| +Send DTMF|Набор DTMF| +ORDER|ОРДЕР| on | на | >LOGOUT|>ВЫХОД| - Channel| Канал| -Extensions|Расширения| + Channel| Линия| +Extensions|Номера| Conferences|Конференции| Conference|Конференция| -Recording|Recording| -Record|Record| -Welcome|Добро пожаловать| -VOICEMAIL|VOICEMAIL| +Recording|Запись| +Record|Запись| +Welcome|Здравствуйте| +VOICEMAIL|ГОЛОСОВАЯПОЧТА| NEW| НОВЫЙ| OLD| СТАРЫЙ| Pause | Пауза | -Resume|Резюме| +Resume|Работа| Faster|Быстрее| -Slower|Медленее| +Slower|Медленнее| Initializing|Инициализация| -Invalid|Недопустимо| -Username|Username| +Invalid|Неверный| +Username|Имя агента| Notes|Примечания| First|Имя| -MI: |MI: | +MI: |Отч: | Last|Фамилия| Address|Адрес| City|Город| -State|Округ| -PostCode|Индекс| -Province|Область/Край| -Vendor ID|ID Вендора| -DialCode|Код| -Alt. Phone|Альт. Телефон| +State|Штат| +PostCode|Почт.индекс| +Province|Область| +Vendor ID|Код п.| +DialCode|Префикс| +Alt. Phone|Доп. телефон| Show|Показать| -Email|Email| -Comments|Комментарии| +Email|Эл.почта| +Comments|Заметки| REFRESH|ОБНОВИТЬ| -ALT PHONE DIAL|НАБРАТЬ АЛЬТ. НОМЕР| +ALT PHONE DIAL|НАБОР ДОП.НОМЕРА| MAIN PHONE|ОСНОВНОЙ ТЕЛЕФОН| -ALT PHONE|АЛЬТ. ТЕЛЕФОН| -ADDRESS3|АДРЕСС 3| -FINISH LEAD|ФИНИШ LEAD| -Dial Alt Phone Number|Набор Альт.Номера| -Phone|Телефон| - DIAL| НАБОР НОМЕРА| -SUBMIT FAVORITES CHANGES - requires logout|ПОДТВЕРДИТЕ ИЗМЕНЕНИЕ ИЗБРАННОГО - требование для выхода из системы| -BACK TO MAIN WINDOW - ignore changes made|ВЕРНУТЬСЯ К ГЛАВНОМУ ОКНУ - игнорирует сделанные изменения| -AVAILABLE EXTENSIONS|ДОСТУПНЫЕ РАСШИРЕНИЯ| - edit|редактировать| - FAVORITES|ИЗБРАННОЕ| +ALT PHONE|ДОП.ТЕЛЕФОН| +ADDRESS3|АДРЕС3| +FINISH LEAD|ЗАВЕРШИТЬ| +Dial Alt Phone Number|Вызвать доп.номер| +Phone|телефон| + DIAL| ВЫЗОВ| +SUBMIT FAVORITES CHANGES - requires logout|СОХРАНИТЬ ИЗМЕНЕНИЯ ПРЕДПОЧТЕНИЙ - нужно выйти| +BACK TO MAIN WINDOW - ignore changes made|ВОЗВРАТ В ГЛАВНОЕ ОКНО - отмена произведенных изменений| +AVAILABLE EXTENSIONS|ДОСТУПНЫЕ НОМЕРА| + edit| изменить| + FAVORITES| ПРЕДПОЧТЕНИЯ| ### END translation phrases through 1.1.11 release ### -Search Existing Leads|Поиск Существующих Leads| -This option if checked will attempt to find the phone number in the system before inserting it as a new lead|Если эта опция выбрана, то будет предпринята попытка найти телефонный номер в системе, прежде чем вставить его как новый lead| -Finish Wrapup and Move On|Финиш Wrapup и Переход| -seconds remaining in wrapup|секунд осталось в wrapup| -Call Wrapup:|Call Wrapup:| +Search Existing Leads|Искать в имеющихся номерах| +This option if checked will attempt to find the phone number in the system before inserting it as a new lead|При включении этой функции перед добавлением номера в качестве нового, его наличие в системе перепроверяется| +Finish Wrapup and Move On|Окончить передышку и продолжить| +seconds remaining in wrapup|секунд до окончание передышки| +Call Wrapup:|Передышка:| ### months of the year for CallBack date select screen ### January|Январь| Frebruary|Февраль| @@ -417,77 +427,150 @@ October|Октябрь| November|Ноябрь| December|Декабрь| ### BEGIN translation phrases for 2.0.1 release ### -Previous Callback Information|Предыдущая Информация о Callback| -Last Call: |Последний Вызов:| -CallBack: |CallBack:| -Agent: |Оператор:| -Comments: |Комментарии:| +Previous Callback Information|Сведения о предыдущем обратном вызове| +Last Call: |Последний вызов:| +CallBack: |Обратный вызов:| +Agent: |Агент:| +Comments: |Заметки:| ### BEGIN translation phrases for 2.0.2 release ### VOLUME|ГРОМКОСТЬ| ### BEGIN translation phrases for 2.0.3 release ### -FAST DIAL|БЫСТРЫЙ НАБОР НОМЕРА| -YOU MUST ENTER A PHONE NUMBER AND DIAL CODE TO USE FAST DIAL|ЧТОБЫ ИСПОЛЬЗОВАТЬ БЫСТРЫЙ НАБОР НОМЕРА, ВЫ ДОЛЖНЫ ВВЕСТИ НОМЕР ТЕЛЕФОНА И КОД СТРАНЫ| - SELECT A PAUSE CODE :| ВЫБЕРИТЕ КОД ПАУЗЫ :| -ENTER A PAUSE CODE|ВВЕДИТЕ КОД ПАУЗЫ| -YOU MUST BE PAUSED TO ENTER A PAUSE CODE IN AUTO-DIAL MODE|ВЫ ДОЛЖНЫ АКТИВИРОВАТЬ ПАУЗУ, ЧТОБЫ ВВЕСТИ КОД ПАУЗЫ В РЕЖИМЕ АВТО-НАБОРА| +FAST DIAL|БЫСТРЫЙ НАБОР| +YOU MUST ENTER A PHONE NUMBER AND DIAL CODE TO USE FAST DIAL|ДЛЯ БЫСТРОГО НАБОРА НУЖНО ВВЕСТИ НОМЕР И КОД НАБОРА| + SELECT A PAUSE CODE :| УКАЖИТЕ КОД ПАУЗЫ :| +ENTER A PAUSE CODE|ВВЕСТИ КОД ПАУЗЫ| +YOU MUST BE PAUSED TO ENTER A PAUSE CODE IN AUTO-DIAL MODE|В РЕЖИМЕ АВТОДОЗВОНА ДЛЯ ВВОДА КОДА ПАУЗЫ НУЖНО БЫТЬ В СОСТОЯНИИ ПАУЗЫ| Your session has been disabled|Ваша сессия отключена| ### BEGIN translation phrases for 2.0.5 release ### Gender: |Пол:| Date of Birth: |Дата рождения:| -YOU MUST BE PAUSED TO CHANGE GROUPS|ТЫ ДОЛЖЕН БЫТЬ PAUSED сменить группу| -Calls in Queue:|Звонки в очереди:| - Timeclock|Timeclock| -The user and password you entered are not active in the system|Пользователя и пароль, которые вы вступили, не действующих в системе| -Please try again|Пожалуйста, повторите попытку| -You cannot log in or out within 30 seconds of your last login or logout|Вы не можете войти или в течение 30 секунд после вашего последнего входа в систему или Logout| -You have now logged-out|Вы уже зарегистрированы отказа| -You logged out at |Вы вошли на| -Amount of time you were logged-in: |Количество раз, когда вы были зарегистрированы в:| -ERROR: timeclock log entry already made: |ОШИБКА: timeclock вход вход уже сделал:| -BACK to Agent Login Screen|BACK TO Агент Логин экрана| -BACK to Administration|BACK TO администрации| -BACK to Welcome Screen|BACK приветствовать экрана| -Time since you were last logged-in: |Время с момента вашего последнего входа в:| -You last logged-out at: |Вы последнего зарегистрированного по адресу:| -Click LOGIN below to log-in|Нажмите кнопку Вход для входа в| -Amount of time you have been logged-in: |Количество раз, когда вы вышли в:| -You logged-in at:|Вы вошли в по адресу:| -Click LOGOUT below to log-out|Нажмите LOGOUT для входа из| -Undefined|Undefined| -This phone number is not in the campaign lists|Этот телефон не находится в списках кампании| +YOU MUST BE PAUSED TO CHANGE GROUPS|ДЛЯ СМЕНЫ ГРУПП НУЖНО БЫТЬ В СОСТОЯНИИ ПАУЗЫ| +Calls in Queue:|Вызовов в очереди:| + Timeclock| Табельные часы| +The user and password you entered are not active in the system|Имя и пароль, введенные Вами, системе неизвестны| +Please try again|Пожалуйста, попробуйте еще раз| +You cannot log in or out within 30 seconds of your last login or logout|Нельзя войти или выйти из системы в течение 30 секунд после последнего входа или выхода| +You have now logged-in|Вы вошли в систему| +You have now logged-out|Вы вышли из системы| +You logged in at |Вы вошли в систему в | +You logged out at |Вы вышли из системы в | +Amount of time you were logged-in: |Время, проведенное Вами в системе: | +ERROR: timeclock log entry already made: |ОШИБКА: запись в журнале табельных часов уже сделана: | +BACK to Agent Login Screen|ВОЗВРАТ к странице агентского входа в систему| +BACK to Administration|ВОЗВРАТ к администрированию| +BACK to Welcome Screen|ВОЗВРАТ к странице приветствия| +Time since you were last logged-in: |Время после Вашего входа в систему:| +You last logged-out at: |Ваш последний выход из системы был произведен в: | +Click LOGIN below to log-in|Кликните ВОЙТИ ниже для входа в систему| +Amount of time you have been logged-in: |Время, проведенное Вами в системе: | +You logged-in at:|Вы вошли в систему в:| +Click LOGOUT below to log-out|Кликните ВЫЙТИ для выхода из системы| +Undefined|Не определено| +This phone number is not in the campaign lists|Этого телефонного номера нет в списках кампании| Unspecified error|Неизвестная ошибка| -Extended Alt Phone Information: |Расширенная информация Alt Телефон:| -ALT DIAL NUMBER:|ALT номер:| -Phone Code and Number:|Телефон кодекса и номер:| +Extended Alt Phone Information: |Расширенные сведения о дополнительном номере:| +ALT DIAL NUMBER:|ДОПОЛНИТЕЛЬНЫЙ НОМЕР:| +Phone Code and Number:|Код набора и номер:| Notes: |Примечания:| -Active: |Активно:| -Alt Count: |Alt Кол-во:| -Change this phone number to INACTIVE|Изменить этот телефонный номер НЕАКТИВНОЕ| -Change this phone number to ACTIVE|Изменить этот телефонный номер АКТИВНЫМ| -YOU MUST LOG IN TO THE TIMECLOCK FIRST|Вы должны войти в систему TIMECLOCK ПЕРВЫЙ| -There is a time synchronization problem with your system, please tell your system administrator|Существует проблема синхронизации времени с вашей системой, пожалуйста, сообщите об этом вашему системному администратору| -Preview Call|Предварительный Звоните| -SELECT A GROUP ALIAS|ВЫБОР ГРУППЫ ALIAS| -Group Alias Selection|Группа Alias выбора| -Click Here to Choose a Group Alias|Нажмите здесь, чтобы Выбери группу Alias| -Group Alias|Группа Alias| -ERROR: There are no Shifts enabled for your user group|ОШИБКА: Есть сдвиги не включена для пользователя группы| -ERROR: You are not allowed to log in outside of your shift|ОШИБКА: Вы не можете войти в вашу за переход| -MANAGER OVERRIDE|МЕНЕДЖЕР Переопределить| -Your Shift is over or has changed, you have been logged out of your session|Ваш Shift больше или изменилась, Вы вышли из Вашей сессии| +Active: |Активный:| +Alt Count: |Доп. счетчик:| +Change this phone number to INACTIVE|Сделать этот номер НЕ АКТИВНЫМ| +Change this phone number to ACTIVE|Сделать этот номер АКТИВНЫМ| +YOU MUST LOG IN TO THE TIMECLOCK FIRST|СНАЧАЛА НУЖНО ОТМЕТИТЬСЯ В ТАБЕЛЬНЫХ ЧАСАХ| +There is a time synchronization problem with your system, please tell your system administrator|В вашей системе есть ошибки синхронизации времени, сообщите, пожалуйста, своему системному администратору| +Preview Call|Предпросмотр сведений о вызове| +SELECT A GROUP ALIAS|ВЫБРАТЬ ПСЕВДОНИМ ГРУППЫ| +Group Alias Selection|Выбор превдонима группы| +Click Here to Choose a Group Alias|Кликните здесь для выбора псевдонима группы| +Group Alias|Псевдоним группы| +ERROR: There are no Shifts enabled for your user group|ОШИБКА: для Вашей группы нет разрешенных смен| +ERROR: You are not allowed to log in outside of your shift|ОШИБКА: Вам не разрешено входить в систему вне своей смены| +MANAGER OVERRIDE|УКАЗАТЬ ДРУГОГО НАЧАЛЬНИКА| +Your Shift is over or has changed, you have been logged out of your session|Ваша смена закончилась или изменена, Вы были выведены из своей сессии| ### START translations for 2.2.0 release ### -You are not allowed to dial into other agent sessions|Вы не можете набрать в других сессиях агент| -QUICK TRANSFER|Быстрой передачи| -Other Agents Status|Другие агенты Статус| -Available Agents Transfer|Доступные Агенты передачи| -Show Calls In Queue|Показать Звонки в очередь| -Calls In Queue|Звонки в очередь| -Hide Calls In Queue|Скрыть Звонки в очередь| -Calls in Queue View Disabled for this campaign|Звонки в Очередь Открыть инвалидов для этой кампании| -YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE|ВЫ ДОЛЖНЫ быть приостановлена схватить Звонки в ОЧЕРЕДЬ| -Manager |Менеджер| -has selected your in-group choices|выбрал в вашей группе выбора| -CONSULTATIVE|КОНСУЛЬТАТИВНЫЙ| +You are not allowed to dial into other agent sessions|Вам не разрешено звонить в сессии других агентов| +QUICK TRANSFER|БЫСТРЫЙ ПЕРЕВОД| +Other Agents Status|Состояние других агентов| +Available Agents Transfer|Перевод доступным агентам| +Show Calls In Queue|Показать вызовы в очереди| +Calls In Queue|Вызовы в очереди| +Hide Calls In Queue|Спрятать вызовы в очереди| +Calls in Queue View Disabled for this campaign|Для этой кампании просмотр вызовов в очереди запрещен| +YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE|ЧТОБЫ ВЗЯТЬ ВЫЗОВ ИЗ ОЧЕРЕДИ НУЖНО БЫТЬ В СОСТОЯНИИ ПАУЗЫ| +Manager |Начальник | +has selected groups for you|назначил Вам входящие группы| +CONSULTATIVE|СОВЕЩАТЕЛЬНЫЙ| Close Message|Закрыть сообщение| -TIMER NOTIFICATION|ТАЙМЕР УВЕДОМЛЕНИЯ| ->AGENTS<|>агенты<| +TIMER NOTIFICATION|УВЕДОМЛЕНИЕ ПО ТАЙМЕРУ| +login_language=en_us|login_language=ru_ru| +>AGENTS<|>АГЕНТЫ<| +### START translations for 2.4 release ### +VIEW CALL LOG|View Call LOG| +click to dial|нажмите, чтобы набрать| +Close Call Log|Закрыть журнал вызовов| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|ВЫ ДОЛЖНЫ быть приостановлена ​​ЧТОБЫ УВИДЕТЬ журнала вызовов| +Close Info Box|Закрыть Box информация| +No calls on this day|Нет звонков в этот день| +You are in ALT dial mode, you must finish the lead before logging out|Вы находитесь в режиме набора ALT, вы должны закончить свинца до выхода из| +Presets Button|Кнопка Presets| +SELECT A PRESET|Выбор занесенных в памяти| +Customer Hung-up, 3-way Call Ended Automatically|Клиент Хун-до, 3-полосная окончании разговора автоматически| +Manual Dial Queue Calls Waiting|Руководство очереди ожидания набора звонков| +Manual Queue|Руководство очереди| +This phone number is outside of the local call time|Этот телефон находится вне местному времени вызова| +Manual Queue is Off|Руководство Очередь Off| +Manual Queue is On|Руководство Очередь на| +Call Notes:|Вызовите Примечания:| +Call Notes List|Call Notes список| +view notes|просмотра заметок| +CALL NOTES LOG|Call Notes LOG| +Close Call Notes|Закрыть Call Notes| +CALL LOG FOR THIS LEAD|Журнал вызовов У объявления| +SEARCH FOR A LEAD|ПОИСК LEAD| +SEARCH RESULTS|РЕЗУЛЬТАТЫ ПОИСКА| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|ВЫ ДОЛЖНЫ быть приостановлена ​​Для поиска LEAD| +Notes: when doing a search for a lead, the phone number, lead ID or|Примечание: при выполнении поиска для свинца, номер телефона, или привести ID| +are the best fields to use|самые лучшие поля для использования| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Использование других областях может быть медленным. Ведущий поиски не позволяет шаблону или частичное условия поиска| +Lead search requests are all logged in the system|Ведущие поисковые запросы все вошли в систему| +Main Phone Number|Основной номер телефона| +Alternate Phone Number|Альтернативный номер телефона| +Address3 Phone Number|Адрес3 номер телефона| +No results found|Ничего не найдено| +Results Found:|Результаты Найдено:| +No calls found|Нет звонков найден| +reset form|восстановить форму| +Callback Status|Ответный статус| +Callback Lead Status|Обратный вызов ведущий статус| +Callback Entry Time|Время обратного вызова Вступление| +Callback Trigger Time|Обратный вызов Trigger время| +Callback Comments|Ответный Комментарии| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Чтобы посмотреть информацию об одном из обратного вызова ниже, нажмите на ссылку INFO. Чтобы позвонить клиенту обратно сейчас, нажмите на ссылку DIAL. Если вы нажмете на запись ниже, чтобы набрать его, то он будет удален из списка| +rings all available agents until one picks up the phone|Кольца все доступные средства, пока не поднимает телефонную трубку| +No calls for this lead|Не требует этого свинца| +Time Zone Warning|Предупреждение часовых поясов| +Phone Area Code Outside Dialable Zone|Телефон Код города Вне зоны Dialable| +Postal Code Outside Dialable Zone|Индекс Вне зоны Dialable| +Custom Transfer|Пользовательские передачи| +System Delay, Please try again|Система задержки, пожалуйста, попробуйте еще раз| +Disposition Status List Hidden|Расположение Статус Список Скрытые| +The system has received a command to log you out, you have been logged out of your session|Система получила команду войти вы, вы вышли из вашей сессии| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Примечание: при выполнении поиска контакта, шаблона или частичное условия поиска не допускается| +Contact search requests are all logged in the system|Просьбы связаться с поиска всех зарегистрированных в системе| +SEARCH FOR A CONTACT|Поиск контакта| +CONTACTS SEARCH RESULTS|Результаты КОНТАКТЫ ПОИСК| +LEAD SEARCH|ВЕСТИ ПОИСК| +Customer Time|Время клиентов| +TERRITORY SELECTION|ВЫБОР ТЕРРИТОРИИ| +TERRITORIES NOT SELECTED|Территории, не ИЗБРАННЫЕ| +SELECTED TERRITORIES|ОТДЕЛЬНЫХ ТЕРРИТОРИЙ| +Dialable Leads|Dialable снабжении| +You have now logged-in|Вы сейчас вошли в| +You logged in at|Вы вошли в| +Refresh Campaign List|Обновить список кампания| +PLEASE SELECT A CAMPAIGN|ПОЖАЛУЙСТА ВЫБЕРИТЕ КАМПАНИЮ| +>Agents View|>Список агентов| +-READY|-ОЖИДАНИЕ| +-INCALL|-ВЫЗОВ| +Refresh Campaign List|Обновить список кампаний| +-PAUSED|-ПАУЗА| diff --git a/agc_2-X/trunk/translations/se_language.txt b/agc_2-X/trunk/translations/se_language.txt index 622bd4ca..7eaa3a00 100644 --- a/agc_2-X/trunk/translations/se_language.txt +++ b/agc_2-X/trunk/translations/se_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"Jan"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DEC"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -52,6 +54,62 @@ Spanish|Spanska| French|Franska| German|Tyska| Italian|Italienska| +agc_check_voicemail_BLINK.gif|agc_check_voicemail_BLINK.gif| +agc_check_voicemail_OFF.gif|agc_check_voicemail_OFF.gif| +agc_check_voicemail_ON.gif|agc_check_voicemail_ON.gif| +agc_live_call_OFF.gif|agc_live_call_OFF.gif| +agc_live_call_ON.gif|agc_live_call_ON.gif| +agc_tab_active_lines.gif|agc_tab_active_lines.gif| +agc_tab_conferences.gif|agc_tab_conferences.gif| +agc_tab_main.gif|agc_tab_main.gif| +vdc_LB_dialnextnumber.gif|vdc_LB_dialnextnumber.gif| +vdc_LB_dialnextnumber_OFF.gif|vdc_LB_dialnextnumber_OFF.gif| +vdc_LB_grabparkedcall.gif|vdc_LB_grabparkedcall.gif| +vdc_LB_hangupcustomer.gif|vdc_LB_hangupcustomer.gif| +vdc_LB_hangupcustomer_OFF.gif|vdc_LB_hangupcustomer_OFF.gif| +vdc_LB_parkcall.gif|vdc_LB_parkcall.gif| +vdc_LB_parkcall_OFF.gif|vdc_LB_parkcall_OFF.gif| +vdc_LB_pause.gif|vdc_LB_pause.gif| +vdc_LB_pause_OFF.gif|vdc_LB_pause_OFF.gif| +vdc_LB_resume.gif|vdc_LB_resume.gif| +vdc_LB_resume_OFF.gif|vdc_LB_resume_OFF.gif| +vdc_LB_startrecording.gif|vdc_LB_startrecording.gif| +vdc_LB_stoprecording.gif|vdc_LB_stoprecording.gif| +vdc_LB_transferconf.gif|vdc_LB_transferconf.gif| +vdc_LB_transferconf_OFF.gif|vdc_LB_transferconf_OFF.gif| +vdc_LB_webform.gif|vdc_LB_webform.gif| +vdc_LB_webform_OFF.gif|vdc_LB_webform_OFF.gif| +vdc_XB_blindtransfer.gif|vdc_XB_blindtransfer.gif| +vdc_XB_blindtransfer_OFF.gif|vdc_XB_blindtransfer_OFF.gif| +vdc_XB_dialwithcustomer.gif|vdc_XB_dialwithcustomer.gif| +vdc_XB_dialwithcustomer_OFF.gif|vdc_XB_dialwithcustomer_OFF.gif| +vdc_XB_hangupbothlines.gif|vdc_XB_hangupbothlines.gif| +vdc_XB_hangupbothlines_OFF.gif|vdc_XB_hangupbothlines_OFF.gif| +vdc_XB_hangupxferline.gif|vdc_XB_hangupxferline.gif| +vdc_XB_hangupxferline_OFF.gif|vdc_XB_hangupxferline_OFF.gif| +vdc_XB_internalcloser.gif|vdc_XB_internalcloser.gif| +vdc_XB_internalcloser_OFF.gif|vdc_XB_internalcloser_OFF.gif| +vdc_XB_leave3waycall.gif|vdc_XB_leave3waycall.gif| +vdc_XB_leave3waycall_OFF.gif|vdc_XB_leave3waycall_OFF.gif| +vdc_XB_localcloser.gif|vdc_XB_localcloser.gif| +vdc_XB_localcloser_OFF.gif|vdc_XB_localcloser_OFF.gif| +vdc_XB_parkcustomerdial.gif|vdc_XB_parkcustomerdial.gif| +vdc_XB_parkcustomerdial_OFF.gif|vdc_XB_parkcustomerdial_OFF.gif| +vdc_XB_hotkeysactive.gif|vdc_XB_hotkeysactive.gif| +vdc_XB_hotkeysactive_OFF.gif|vdc_XB_hotkeysactive_OFF.gif| +vdc_LB_senddtmf.gif|vdc_LB_senddtmf.gif| +vdc_LB_senddtmf_OFF.gif|vdc_LB_senddtmf_OFF.gif| +vdc_XB_header.gif|vdc_XB_header.gif| +vdc_XB_number.gif|vdc_XB_number.gif| +vdc_XB_channel.gif|vdc_XB_channel.gif| +vdc_XB_seconds.gif|vdc_XB_seconds.gif| +vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Du är nu utloggad ur systemet, välkommen åter! astGUIclient web-client VERSION|astGUI webklientversion| astGUIclient web client| astGUI webklient| @@ -232,19 +290,19 @@ DIAL LEAD|RING LEAD| LEAD PREVIEW|FÖRHANDSGRANSKA LEAD| PAUSE AGENT DIALING|PAUSA AGENTUPPRINGNING| DISPOSITION CALL|SAMTALSUTFALL| - session ID| sesion ID| + session ID| session ID| to campaign| till kampanj| -Select a CallBack Date|Välj ett datum för återkomsten| +Select a CallBack Date|Välj ett datum för återuppringningen| maximize | maximera | minimize | minimera | You must choose a date|Du måste välja ett datum| Select a Date Below|Välj datum| -Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list|Klicka på en återkomst nedan för att ringa, numret försvinner då från listan och du får välja nytt utfall| +Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list|Klicka på en återuppringning nedan för att ringa, numret försvinner då från listan och du får välja nytt utfall| If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there|Om du vill ringa ett nummer och INTE lägga till det som en ny lead, skriv in det exakta numret i \"Dial override\" nedan.För att avsluta detta samtal måste du öppna SAMTAL I DENNA SESSION i botten av fönstret och klicka på kanallänken där.| YOU CANNOT SKIP A CALLBACK OR MANUAL DIAL, YOU MUST DIAL THE LEAD|DU KAN INTE SKIPPA EN CALLBACK ELLER MANUELL UPPRINGNING, DU MÅSTE RINGA LEADET| YOU MUST BE PAUSED TO MANUAL DIAL A NEW LEAD IN AUTO-DIAL MODE|DU MÅSTE VARA I PAUSLÄGE FÖR ATT RINGA ETT NUMMER MANUELLT NÄR DIALERN ÄR I AUTODIAL| Enter information below for the new lead you wish to call|Skriv in informationen för det nya leadet du vill ringa| -YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE|DU MÅSTE VARA I PAUSLÄGE FÖR ATT KOLLA ÅTERKOMSTER NÄR DIALERN ÄR I AUTODIAL| +YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE|DU MÅSTE VARA I PAUSLÄGE FÖR ATT KOLLA ÅTERUPPRINGNINGAR NÄR DIALERN ÄR I AUTODIAL| Note: all new manual dial leads will go into list 999|Notera: alla nya manuellt uppringda leads hamnar i lista 999| YOU DO NOT HAVE PERMISSIONS TO TRANSFER CALLS|DU HAR EJ BEHÖRIGHET ATT VIDAREKOPPLA SAMTAL| will be added to the beginning of this number|kommer att läggas till i början av numret| @@ -256,15 +314,15 @@ Note: a dial prefix of|Notera: ett prefix för| Hangup Again|Lägg på igen| Go Back|Tillbaka| Call Agent Again|Ring agent igen| -MY CALLBACK ONLY|PERSONLIG ÅTERKOMST| -NO ACTIVE CALLBACKS|INGA AKTIVA ÅTERKOMSTER| -ACTIVE CALLBACKS|AKTIVA ÅTERKOMSTER| -CALLBACKS FOR AGENT|PERSONLIGA ÅTERKOMSTER| +MY CALLBACK ONLY|PERSONLIG ÅTERUPPRINGNING| +NO ACTIVE CALLBACKS|INGA AKTIVA ÅTERUPPNINGNINGAR| +ACTIVE CALLBACKS|AKTIVA ÅTERUPPNINGNINGAR| +CALLBACKS FOR AGENT|PERSONLIGA ÅTERUPPNINGNINGAR| Dial Code:|Landskod| Dial Override|Dial Override| digits only please|enbart siffror| Dial Now|Ring nu| -CB Comments|Kommentar till ÅK| +CB Comments|Kommentar till Återuppringning| Title|Titel| Your Status|Din status| STATUS| STATUS| @@ -284,14 +342,14 @@ Login:|Logga in:| User |Användare | Password|Lösenord| VERSION|VERSION| -BUILD|SKAPA| +BUILD|BUILD| Server|Server| RECORD |Spela in | >HANGUP|>Lägg på| >XFER|>XFER| PARK|PARKERA| IN-NUMBER|IN-NUMMER| -NUMBER|NUNNER| +NUMBER|NUMMER| CALLERID|SAMTALSID| CALL| SAMTAL| PICKUP|SVARA| @@ -367,11 +425,11 @@ October|Oktober| November|November| December|December| ### BEGIN translation phrases for 2.0.1 release ### -Previous Callback Information|Informaci�n Anterior Del Servicio repetido| -Last Call: |Senaste samtal:| -CallBack: |Återkomst:| -Agent: |Agent:| -Comments: |Kommentarer:| +Previous Callback Information|Information från återuppringning| +Last Call: |Senaste samtal: | +CallBack: |Återuppringning: | +Agent: |Agent: | +Comments: |Kommentarer: | ### BEGIN translation phrases for 2.0.2 release ### VOLUME|VOLYM| ### BEGIN translation phrases for 2.0.3 release ### @@ -380,27 +438,27 @@ YOU MUST ENTER A PHONE NUMBER AND DIAL CODE TO USE FAST DIAL|DU MÅSTE KNAPPA IN SELECT A PAUSE CODE :| VÄLJ PAUSKOD :| ENTER A PAUSE CODE|SKRIV PAUSKOD| YOU MUST BE PAUSED TO ENTER A PAUSE CODE IN AUTO-DIAL MODE|DU MÅSTE VARA I PAUSLÄGE FÖR ATT SKRIVA IN EN PAUSKOD NÄR DIALERN STÅR I AUTODIAL| -Your session has been disabled|Din session har avbrytits| +Your session has been disabled|Din session har avbrutits| ### BEGIN translation phrases for 2.0.5 release ### -Gender: |Kön:| -Date of Birth: |Personnummer:| -YOU MUST BE PAUSED TO CHANGE GROUPS|DU MÅSTE VARA I PAUS FÖR ATT BYTA GRUPP| +Gender: |Kön: | +Date of Birth: |Personnummer: | +YOU MUST BE PAUSED TO CHANGE GROUPS|DU MÅSTE VARA PAUSAD FÖR ATT BYTA GRUPP| Calls in Queue:|Samtal i kö:| - Timeclock|Stämpelklocka| + Timeclock| Stämpelklocka| The user and password you entered are not active in the system|Användaren och lösenordet du har skrivit in är inte aktivt i systemet| Please try again|Vänligen försök igen| You cannot log in or out within 30 seconds of your last login or logout|Du kan inte logga in eller ut på 30 sekunder efter ditt senaste försök| -You have now logged-out|Du har nu loggats ur| -You logged out at |Du loggade ur kl| -Amount of time you were logged-in: |Inloggad tid:| -ERROR: timeclock log entry already made: |ERROR: stämpelklockan har redan använts:| +You have now logged-out|Du har nu loggats ut| +You logged out at |Du loggade ut kl | +Amount of time you were logged-in: |Inloggad tid: | +ERROR: timeclock log entry already made: |ERROR: stämpelklockan har redan använts: | BACK to Agent Login Screen|TILLBAKA till inloggningssidan| BACK to Administration|TILLBAKA till administration| BACK to Welcome Screen|TILLBAKA till välkomstssidan| -Time since you were last logged-in: |Tid sen du senast loggade in:| -You last logged-out at: |Du loggade senast ur kl:| +Time since you were last logged-in: |Tid sen du senast loggade in: | +You last logged-out at: |Du loggade senast ut kl: | Click LOGIN below to log-in|Klicka på LOGIN nedan för att logga in| -Amount of time you have been logged-in: |Hur lång tid du varit inloggad:| +Amount of time you have been logged-in: |Hur lång tid du varit inloggad: | You logged-in at:|Du loggade in kl:| Click LOGOUT below to log-out|Klicka på LOGOUT nedan för att logga ut| Undefined|Odefinierad| @@ -408,10 +466,10 @@ This phone number is not in the campaign lists|Detta nummer finns ej i kampanjli Unspecified error|Ospecifierat fel| Extended Alt Phone Information: |Utökad information om alternativt telefonnummer:| ALT DIAL NUMBER:|ALT RING NUMMER:| -Phone Code and Number:|Prefuix och telefonnummer:| -Notes: |Noteringar:| -Active: |Aktiv:| -Alt Count: |Alt Count:| +Phone Code and Number:|Prefix och telefonnummer:| +Notes: |Noteringar: | +Active: |Aktiv: | +Alt Count: |Alt Count: | Change this phone number to INACTIVE|Ändra detta nummer till INAKTIV| Change this phone number to ACTIVE|Ändra detta nummer till AKTIVT| YOU MUST LOG IN TO THE TIMECLOCK FIRST|DU MÅSTE STÄMPLA IN FÖRST| @@ -424,7 +482,7 @@ Group Alias|Gruppalias| ERROR: There are no Shifts enabled for your user group|ERROR: Det finns inga skift definierade för din användargrupp| ERROR: You are not allowed to log in outside of your shift|ERROR: Du har inte behörighet att logga in utanför ditt skift| MANAGER OVERRIDE|MANAGER OVERRIDE| -Your Shift is over or has changed, you have been logged out of your session|Ditt skift är slut eller har ändrats, du är nu urloggad från din session| +Your Shift is over or has changed, you have been logged out of your session|Ditt skift är slut eller har ändrats, du är nu utloggad från din session| ### START translations for 2.2.0 release ### You are not allowed to dial into other agent sessions|Du har inte behörighet att logga in på andra agenters sessions| QUICK TRANSFER|SNABBKOPPLA| @@ -435,10 +493,80 @@ Calls In Queue|Samtalskö| Hide Calls In Queue|Dölj samtalskö| Calls in Queue View Disabled for this campaign|Samtalskö är frånkopplad för denna kampanj| YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE|DU MÅSTE VARA I PAUSLÄGE FÖR ATT TA SAMTAL FRÅN KÖN| -Manager |Manager| +Manager |Manager | has selected your in-group choices|har valt dina ingruppsval| CONSULTATIVE|KONSULTERANDE| Close Message|Avslutningsmeddelande| TIMER NOTIFICATION|TIMERNOTIFIERING| login_language=en_us|login_language=se_se| >AGENTS<|>AGENTER<| +### START translations for 2.4 release ### +VIEW CALL LOG|VISA CALL LOG| +click to dial|klicka för att ringa| +Close Call Log|Stäng Samtalslogg| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|DU MÅSTE pausas vill visa CALL LOG| +Close Info Box|Stäng Info Box| +No calls on this day|Inga samtal denna dag| +You are in ALT dial mode, you must finish the lead before logging out|Du är i ALT uppringningsläge måste du avsluta ledningen innan du loggar ut| +Presets Button|Förinställningar Button| +SELECT A PRESET|Välj en förinställd| +Customer Hung-up, 3-way Call Ended Automatically|Kund Hung-up, slutade 3-vägs samtal automatiskt| +Manual Dial Queue Calls Waiting|Manuell uppringning Queue samtal väntar| +Manual Queue|Manuell Kö| +This phone number is outside of the local call time|Detta telefonnummer är utanför den lokala samtalstid| +Manual Queue is Off|Manuell Queue är av| +Manual Queue is On|Manuell Queue är På| +Call Notes:|Ring Anmärkningar:| +Call Notes List|Ring listan över anteckningar| +view notes|visa anteckningar| +CALL NOTES LOG|RING ANMÄRKNINGAR LOG| +Close Call Notes|Stäng Call Notes| +CALL LOG FOR THIS LEAD|Samtalslogg FÖR DENNA LEAD| +SEARCH FOR A LEAD|SÖK Ett LEAD| +SEARCH RESULTS|SÖKRESULTAT| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|DU MÅSTE pausas att söka efter ett LEAD| +Notes: when doing a search for a lead, the phone number, lead ID or|Anteckningar: när du gör en sökning efter en bly, telefonnummer, bly-ID eller| +are the best fields to use|är de bästa fält som ska användas| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Med de övriga fält kan vara långsammare. Bly sökande tillåter inte jokertecken eller delvis sökord| +Lead search requests are all logged in the system|Lead sökförfrågningar alla inloggade i systemet| +Main Phone Number|Huvud telefonnummer| +Alternate Phone Number|Alternativt telefonnummer| +Address3 Phone Number|Address3 telefonnummer| +No results found|Inga resultat hittades| +Results Found:|Hittade:| +No calls found|Inga samtal finns| +reset form|återställa formen| +Callback Status|Återuppringning Status| +Callback Lead Status|Återuppringning Bly status| +Callback Entry Time|Återuppringning Entry Time| +Callback Trigger Time|Återuppringning Trigger Time| +Callback Comments|Återuppringning Kommentarer| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|För att se information på en av de återbesök nedan, klicka på INFO länken. Att ringa kunden tillbaka nu, klicka på DIAL länken. Om du klickar på en post nedan för att slå det, kommer det att tas bort från listan| +rings all available agents until one picks up the phone|ringar alla tillgängliga medel tills man plockar upp telefonen| +No calls for this lead|Inga samtal för denna ledning| +Time Zone Warning|Time Zone Varning| +Phone Area Code Outside Dialable Zone|Telefon Riktnummer Utanför Dialable Zone| +Postal Code Outside Dialable Zone|Postnummer Utanför Dialable Zone| +Custom Transfer|Anpassad Transfer| +System Delay, Please try again|System Delay, försök igen| +Disposition Status List Hidden|Disposition Status List Dold| +The system has received a command to log you out, you have been logged out of your session|Systemet har fått ett kommando för att logga ut dig, har du loggat ut från sessionen| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Anteckningar: när du gör en sökning efter en kontakt, är wild card eller partiell söktermer inte tillåtet| +Contact search requests are all logged in the system|Kontakt Sök förfrågningar alla inloggade i systemet| +SEARCH FOR A CONTACT|Sök efter en kontakt| +CONTACTS SEARCH RESULTS|KONTAKTER SÖKRESULTAT| +LEAD SEARCH|LEAD SÖK| +Customer Time|kund tid| +TERRITORY SELECTION|territorium SELECTION| +TERRITORIES NOT SELECTED|Territorier som inte SELECTED| +SELECTED TERRITORIES|områden som väljs ut| +Dialable Leads|Dialable Leads| +You have now logged-in|Du har nu inloggade| +You logged in at|Du loggat in på| +Refresh Campaign List|Uppdatera kampanj List| +PLEASE SELECT A CAMPAIGN|Välj en kampanj| +Agents View|medel Se| +-READY|-KLAR| +-INCALL|-ANROP| +-PAUSED|-pause| +CALL DISPOSITION|RING DISPOSITION| diff --git a/agc_2-X/trunk/translations/sk_language.txt b/agc_2-X/trunk/translations/sk_language.txt index d83bcbb2..7e51d565 100644 --- a/agc_2-X/trunk/translations/sk_language.txt +++ b/agc_2-X/trunk/translations/sk_language.txt @@ -27,6 +27,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"JAN"| @@ -42,6 +43,7 @@ agc|calendar_db.js|0 "NOV"|"NOV"| "DEC"|"DEC"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|Border| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_number.gif|vdc_XB_number.gif| vdc_XB_channel.gif|vdc_XB_channel.gif| vdc_XB_seconds.gif|vdc_XB_seconds.gif| vdc_tab_script.gif|vdc_tab_script.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|Práve ste sa odhlásili, Ďakujeme| astGUIclient web-client VERSION|astGUIclient verzia web-klient| astGUIclient web client|web klient astGUIclient| @@ -491,3 +499,73 @@ CONSULTATIVE|PORADNÝ| Close Message|Zavrieť správu| TIMER NOTIFICATION|TIMER OZNAM| >AGENTS<|>AGENTI<| +### START translations for 2.4 release ### +VIEW CALL LOG|POHĽAD Denník hovorov| +click to dial|kliknite pre vytočenie| +Close Call Log|Zavrieť Call Log| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|MUSÍTE byť pozastavená Ak chcete zobraziť CALL LOG| +Close Info Box|Zavrieť Info Box| +No calls on this day|Žiadne vyzýva tento deň| +You are in ALT dial mode, you must finish the lead before logging out|Nachádzate sa v móde voľby ALT, je nutné dokončiť náskok pred odhlásením| +Presets Button|Tlačidlo predvoľby| +SELECT A PRESET|SELECT PRESET| +Customer Hung-up, 3-way Call Ended Automatically|Zákazník Hung-up, 3-way volanie končiace automaticky| +Manual Dial Queue Calls Waiting|Manuálna voľba fronty hovorov Čakanie| +Manual Queue|Ručné fronty| +This phone number is outside of the local call time|Toto telefónne číslo je mimo miestnej pohotovosti| +Manual Queue is Off|Ručné Fronta je vypnuté| +Manual Queue is On|Ručné fronta je na| +Call Notes:|Výzva Poznámky:| +Call Notes List|Výzva Poznámky Zoznam| +view notes|zobraziť poznámky| +CALL NOTES LOG|VÝZVA NOTES LOG| +Close Call Notes|Zavrieť volanie poznámky| +CALL LOG FOR THIS LEAD|VÝZVA PRE LOG tohto kábla| +SEARCH FOR A LEAD|Hľadanie olova| +SEARCH RESULTS|VÝSLEDKY HĽADANIE| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|MUSÍTE byť pozastavená na vyhľadávanie vodítku| +Notes: when doing a search for a lead, the phone number, lead ID or|Poznámky: pri tom hľadaní na vedenie, telefónne číslo, vedie ID alebo| +are the best fields to use|sú najlepšie polia na použitie| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|Použitie iných oblastiach môže byť pomalší. Vedúci vyhľadávania neumožňuje zástupných alebo čiastočnú vyhľadávacie termíny| +Lead search requests are all logged in the system|Olovo hľadanie požiadavky sú zaznamenané v systéme| +Main Phone Number|Hlavné telefónne číslo| +Alternate Phone Number|Alternatívne telefónne číslo| +Address3 Phone Number|Address3 telefónne číslo| +No results found|Neboli nájdené žiadne výsledky| +Results Found:|Nájdené:| +No calls found|Žiadne volanie nájdené| +reset form|resetovať formulár| +Callback Status|Spätné volanie Stav| +Callback Lead Status|Spätné volanie Lead stavu| +Callback Entry Time|Spätné volanie Vstup čas| +Callback Trigger Time|Spätné volanie oneskorenie| +Callback Comments|Komentáre spätné volanie| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|Ak chcete zobraziť informácie o jednej z nižšie uvedených spätné volanie, kliknite na odkaz INFO. Ak chcete volať zákazníkovi späť, kliknite na odkaz DIAL. Ak kliknete na záznam nižšie vytočiť ho, bude odstránený zo zoznamu| +rings all available agents until one picks up the phone|prstene všetky dostupné prostriedky, kým jeden zdvihne telefón| +No calls for this lead|Žiadne žiada, aby táto vedenie| +Time Zone Warning|Časové pásmo Upozornenie| +Phone Area Code Outside Dialable Zone|Telefón Area Code Mimo Dialable zóny| +Postal Code Outside Dialable Zone|PSČ Mimo Dialable zóny| +Custom Transfer|Vlastný prenos| +System Delay, Please try again|Systém Delay, prosím skúste to znova| +Disposition Status List Hidden|Dispozície Stav Hidden Zoznam| +The system has received a command to log you out, you have been logged out of your session|Systém dostal príkaz na prihlásenie vás, ste boli odhlásený zo svojho zasadnutia| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|Poznámky: pri tom hľadaní kontaktu, sú zástupné alebo čiastočné vyhľadávacie termíny nie sú povolené| +Contact search requests are all logged in the system|Žiadosti Kontakt vyhľadávania sú prihlásení do systému| +SEARCH FOR A CONTACT|Hľadanie kontaktu| +CONTACTS SEARCH RESULTS|VÝSLEDKY HĽADANIE KONTAKTY| +LEAD SEARCH|HĽADANIE LEAD| +Customer Time|zákazník čas| +TERRITORY SELECTION|VÝBER ÚZEMIA| +TERRITORIES NOT SELECTED|ÚZEMÍ NEZARADENÉ| +SELECTED TERRITORIES|vybraných teritórií| +Dialable Leads|vedie Dialable| +You have now logged-in|Máte teraz prihlásených| +You logged in at|Ste prihlásení na| +Refresh Campaign List|Obnoviť kampaň Zoznam| +PLEASE SELECT A CAMPAIGN|Vyberte KAMPAŇ| +Agents View|agenti Zobraziť| +-READY|-READY| +-INCALL|-Incall| +-PAUSED|-pozastavené| +CALL DISPOSITION|VÝZVA Disposition| diff --git a/agc_2-X/trunk/translations/tw_language.txt b/agc_2-X/trunk/translations/tw_language.txt index 3bfd9026..10d1f014 100644 --- a/agc_2-X/trunk/translations/tw_language.txt +++ b/agc_2-X/trunk/translations/tw_language.txt @@ -28,6 +28,7 @@ agc|functions.php|1 agc|vdc_form_display.php|1 agc|calendar.css|1 agc|calendar_db.js|0 +agc|phone_only.php|0 ***TRANSLATIONS*** ### special translations that should stay at the top of the file ### "JAN"|"一月"| @@ -43,6 +44,7 @@ agc|calendar_db.js|0 "NOV"|"十一月"| "DEC"|"十二月"| \./images/|../agc/images/| +css/|../agc/css/| BORDER|邊界| VALUE=SUBMIT|VALUE=SUBMIT| TYPE=SUBMIT|TYPE=Submit| @@ -102,6 +104,12 @@ vdc_XB_header.gif|vdc_XB_header_tw.gif| vdc_XB_number.gif|vdc_XB_number_tw.gif| vdc_XB_channel.gif|vdc_XB_channel_tw.gif| vdc_XB_seconds.gif|vdc_XB_seconds_tw.gif| +agc_live_call_DEAD.gif|agc_live_call_DEAD.gif| +vdc_LB_startrecording_OFF.gif|vdc_LB_startrecording_OFF.gif| +vdc_LB_webform_two.gif|vdc_LB_webform_two.gif| +vdc_LB_webform_two_OFF.gif|vdc_LB_webform_two_OFF.gif| +vdc_volume_MUTE.gif|vdc_volume_MUTE.gif| +vdc_volume_UNMUTE.gif|vdc_volume_UNMUTE.gif| You have now logged out. Thank you|您已成功登出系統| astGUIclient web-client VERSION|astGUIclient web-client版本| astGUIclient web client|astGUIclient web client| @@ -522,3 +530,73 @@ CONSULTATIVE|協商| Close Message|關閉消息| TIMER NOTIFICATION|計時器通知| >AGENTS<|>經營者<| +### START translations for 2.4 release ### +VIEW CALL LOG|查看通話記錄| +click to dial|點擊撥號| +Close Call Log|關閉通話記錄| +YOU MUST BE PAUSED TO VIEW YOUR CALL LOG|你必須停下來查看呼叫記錄| +Close Info Box|關閉信息框| +No calls on this day|在這一天沒有電話| +You are in ALT dial mode, you must finish the lead before logging out|你是在ALT撥號模式,你必須完成註銷前率先| +Presets Button|預設按鈕| +SELECT A PRESET|選擇預設| +Customer Hung-up, 3-way Call Ended Automatically|顧客洪,三路電話自動結束| +Manual Dial Queue Calls Waiting|手動撥號隊列呼叫等待| +Manual Queue|手冊隊列| +This phone number is outside of the local call time|這個電話號碼是本地通話時間之外| +Manual Queue is Off|手動隊列是關| +Manual Queue is On|手冊隊列是在| +Call Notes:|呼叫備註:| +Call Notes List|呼叫債券清單| +view notes|查看筆記| +CALL NOTES LOG|調用Notes日誌| +Close Call Notes|千鈞一發說明| +CALL LOG FOR THIS LEAD|這導致通話記錄| +SEARCH FOR A LEAD|作者:帶頭作用| +SEARCH RESULTS|搜尋結果| +YOU MUST BE PAUSED TO SEARCH FOR A LEAD|你必須停下來尋找率先| +Notes: when doing a search for a lead, the phone number, lead ID or|注:做一個領先的搜索時,電話號碼,導致ID或| +are the best fields to use|是最好的領域使用| +Using the other fields may be slower. Lead searching does not allow for wildcard or partial search terms|使用的其他領域可能會比較慢。鉛搜索不允許通配符或部分搜索字詞| +Lead search requests are all logged in the system|鉛的搜索請求都記錄在系統| +Main Phone Number|主要電話號碼| +Alternate Phone Number|備用電話號碼| +Address3 Phone Number|地址3電話號碼| +No results found|沒有找到結果| +Results Found:|結果發現:| +No calls found|沒有調用發現| +reset form|復位形式| +Callback Status|回調狀態| +Callback Lead Status|回調鉛狀態| +Callback Entry Time|回調錄入時間| +Callback Trigger Time|回調觸發時間| +Callback Comments|回調評論| +To see information on one of the callbacks below, click on the INFO link. To call the customer back now, click on the DIAL link. If you click on a record below to dial it, it will be removed from the list|看到下面的回調的信息,請單擊“信息”鏈接。現在回頭來調用客戶,單擊撥號鏈接。如果您單擊下面的記錄撥打它,它會被從名單中剔除| +rings all available agents until one picks up the phone|環所有可用了電話,直到一個選秀權代理| +No calls for this lead|這個領先的地位沒有電話| +Time Zone Warning|時區警告| +Phone Area Code Outside Dialable Zone|可撥打區外的電話區號| +Postal Code Outside Dialable Zone|可撥打區外的郵政編碼| +Custom Transfer|自定義傳輸| +System Delay, Please try again|系統延遲,請再試一次| +Disposition Status List Hidden|處置狀態列表隱藏| +The system has received a command to log you out, you have been logged out of your session|該系統已收到您註銷命令,你已註銷會話| +Notes: when doing a search for a contact, wildcard or partial search terms are not allowed|注:時,做了一個接觸搜索,通配符或部分搜索條件不允許| +Contact search requests are all logged in the system|聯繫人搜索請求都記錄在系統| +SEARCH FOR A CONTACT|搜索聯繫人| +CONTACTS SEARCH RESULTS|聯繫人搜索結果| +LEAD SEARCH|引領搜索| +Customer Time|客戶的時間| +TERRITORY SELECTION|領地的選擇| +TERRITORIES NOT SELECTED|新界未選擇| +SELECTED TERRITORIES|選定地區。| +Dialable Leads|可撥打信息| +You have now logged-in|你現在登錄| +You logged in at|您在登錄| +Refresh Campaign List|刷新活動列表| +PLEASE SELECT A CAMPAIGN|請選擇一個廣告系列| +Agents View|代理商查看| +-READY|-準備就緒| +-INCALL|-門店| +-PAUSED|-暫停| +CALL DISPOSITION|認購證的處置| diff --git a/agc_2-X/trunk/www/agc/images/agc_check_voicemail_BLINK_ru.gif b/agc_2-X/trunk/www/agc/images/agc_check_voicemail_BLINK_ru.gif new file mode 100644 index 00000000..fd4d3e84 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_check_voicemail_BLINK_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_check_voicemail_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/agc_check_voicemail_OFF_ru.gif new file mode 100644 index 00000000..34fa8791 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_check_voicemail_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_check_voicemail_ON_ru.gif b/agc_2-X/trunk/www/agc/images/agc_check_voicemail_ON_ru.gif new file mode 100644 index 00000000..f068bc1b Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_check_voicemail_ON_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_live_call_DEAD_ru.gif b/agc_2-X/trunk/www/agc/images/agc_live_call_DEAD_ru.gif new file mode 100644 index 00000000..1383ce3c Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_live_call_DEAD_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_live_call_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/agc_live_call_OFF_ru.gif new file mode 100644 index 00000000..15cb8e22 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_live_call_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_live_call_ON_ru.gif b/agc_2-X/trunk/www/agc/images/agc_live_call_ON_ru.gif new file mode 100644 index 00000000..3ae050fa Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_live_call_ON_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_tab_active_lines_ru.gif b/agc_2-X/trunk/www/agc/images/agc_tab_active_lines_ru.gif new file mode 100644 index 00000000..71fdec9d Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_tab_active_lines_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_tab_conferences_ru.gif b/agc_2-X/trunk/www/agc/images/agc_tab_conferences_ru.gif new file mode 100644 index 00000000..e814d8be Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_tab_conferences_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/agc_tab_main_ru.gif b/agc_2-X/trunk/www/agc/images/agc_tab_main_ru.gif new file mode 100644 index 00000000..c5a8ca48 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/agc_tab_main_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/dk.gif b/agc_2-X/trunk/www/agc/images/dk.gif new file mode 100644 index 00000000..9cc2c236 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/dk.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_dialnextnumber_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_dialnextnumber_OFF_ru.gif new file mode 100644 index 00000000..1aaa2427 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_dialnextnumber_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_dialnextnumber_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_dialnextnumber_ru.gif new file mode 100644 index 00000000..01e3bf69 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_dialnextnumber_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_grabparkedcall_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_grabparkedcall_OFF_ru.gif new file mode 100644 index 00000000..bf2b3bf8 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_grabparkedcall_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_grabparkedcall_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_grabparkedcall_ru.gif new file mode 100644 index 00000000..34e60fbc Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_grabparkedcall_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_hangupcustomer_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_hangupcustomer_OFF_ru.gif new file mode 100644 index 00000000..8baee596 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_hangupcustomer_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_hangupcustomer_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_hangupcustomer_ru.gif new file mode 100644 index 00000000..f9de72b8 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_hangupcustomer_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_parkcall_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_parkcall_OFF_ru.gif new file mode 100644 index 00000000..bf488afe Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_parkcall_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_parkcall_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_parkcall_ru.gif new file mode 100644 index 00000000..3806ee1a Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_parkcall_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_pause_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_pause_OFF_ru.gif new file mode 100644 index 00000000..1dd3d358 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_pause_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_pause_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_pause_ru.gif new file mode 100644 index 00000000..66d9d615 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_pause_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_quickxfer_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_quickxfer_OFF_ru.gif new file mode 100644 index 00000000..dc222a55 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_quickxfer_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_quickxfer_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_quickxfer_ru.gif new file mode 100644 index 00000000..2ea8ea61 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_quickxfer_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_OFF_ru.gif new file mode 100644 index 00000000..c62c344c Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_ru.gif new file mode 100644 index 00000000..3a5bbb81 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_resume_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_resume_OFF_ru.gif new file mode 100644 index 00000000..d840c79b Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_resume_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_resume_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_resume_ru.gif new file mode 100644 index 00000000..a14cdc9f Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_resume_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_senddtmf_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_senddtmf_OFF_ru.gif new file mode 100644 index 00000000..2a09cf4f Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_senddtmf_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_senddtmf_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_senddtmf_ru.gif new file mode 100644 index 00000000..484fa13b Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_senddtmf_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_startrecording_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_startrecording_OFF_ru.gif new file mode 100644 index 00000000..b11e8c64 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_startrecording_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_startrecording_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_startrecording_ru.gif new file mode 100644 index 00000000..36442d59 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_startrecording_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_stoprecording_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_stoprecording_OFF_ru.gif new file mode 100644 index 00000000..fbaa0c1e Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_stoprecording_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_stoprecording_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_stoprecording_ru.gif new file mode 100644 index 00000000..32f96174 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_stoprecording_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_transferconf_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_transferconf_OFF_ru.gif new file mode 100644 index 00000000..0b48e728 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_transferconf_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_transferconf_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_transferconf_ru.gif new file mode 100644 index 00000000..1cbf4137 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_transferconf_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_webform_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_OFF_ru.gif new file mode 100644 index 00000000..ff96ee77 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_webform_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_ru.gif new file mode 100644 index 00000000..6e426895 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_webform_two_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_two_OFF_ru.gif new file mode 100644 index 00000000..8a9ec032 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_two_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_webform_two_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_two_ru.gif new file mode 100644 index 00000000..f9021095 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_webform_two_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_blindtransfer_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_blindtransfer_OFF_ru.gif new file mode 100644 index 00000000..54ea6546 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_blindtransfer_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_blindtransfer_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_blindtransfer_ru.gif new file mode 100644 index 00000000..062d81c9 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_blindtransfer_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_channel_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_channel_ru.gif new file mode 100644 index 00000000..e1827b70 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_channel_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_code_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_code_ru.gif new file mode 100644 index 00000000..9a319020 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_code_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_dialwithcustomer_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_dialwithcustomer_OFF_ru.gif new file mode 100644 index 00000000..e07bab7c Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_dialwithcustomer_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_dialwithcustomer_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_dialwithcustomer_ru.gif new file mode 100644 index 00000000..5ee84bb2 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_dialwithcustomer_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_hangupbothlines_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupbothlines_OFF_ru.gif new file mode 100644 index 00000000..2fbbe12f Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupbothlines_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_hangupbothlines_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupbothlines_ru.gif new file mode 100644 index 00000000..dca79e90 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupbothlines_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_hangupxferline_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupxferline_OFF_ru.gif new file mode 100644 index 00000000..5bd18800 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupxferline_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_hangupxferline_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupxferline_ru.gif new file mode 100644 index 00000000..4bdd3917 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_hangupxferline_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_header_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_header_ru.gif new file mode 100644 index 00000000..d6cedb49 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_header_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_hotkeysactive_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_hotkeysactive_OFF_ru.gif new file mode 100644 index 00000000..c55c4621 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_hotkeysactive_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_hotkeysactive_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_hotkeysactive_ru.gif new file mode 100644 index 00000000..dfa3e8bc Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_hotkeysactive_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_internalcloser_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_internalcloser_OFF_ru.gif new file mode 100644 index 00000000..d4754582 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_internalcloser_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_internalcloser_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_internalcloser_ru.gif new file mode 100644 index 00000000..7a454141 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_internalcloser_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_leave3waycall_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_leave3waycall_OFF_ru.gif new file mode 100644 index 00000000..2310e6d3 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_leave3waycall_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_leave3waycall_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_leave3waycall_ru.gif new file mode 100644 index 00000000..b56c6c9d Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_leave3waycall_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_localcloser_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_localcloser_OFF_ru.gif new file mode 100644 index 00000000..0d4a9505 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_localcloser_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_localcloser_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_localcloser_ru.gif new file mode 100644 index 00000000..fcdd8d23 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_localcloser_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_number_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_number_ru.gif new file mode 100644 index 00000000..a744f85f Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_number_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_parkcustomerdial_OFF_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_parkcustomerdial_OFF_ru.gif new file mode 100644 index 00000000..bc067cab Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_parkcustomerdial_OFF_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_parkcustomerdial_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_parkcustomerdial_ru.gif new file mode 100644 index 00000000..11b37e6d Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_parkcustomerdial_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_XB_seconds_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_XB_seconds_ru.gif new file mode 100644 index 00000000..72ee4eec Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_XB_seconds_ru.gif differ diff --git a/agc_2-X/trunk/www/agc/images/vdc_tab_script_ru.gif b/agc_2-X/trunk/www/agc/images/vdc_tab_script_ru.gif new file mode 100644 index 00000000..1fb64d63 Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_tab_script_ru.gif differ diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 4d75fd16..e2062bad 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -24506,7 +24506,7 @@ if ($ADD==311) while (list($tzone,) = each($lead_list[$since_reset])) { $LOCALzone=3600 * $tzone; - $LOCALdate=gmdate("D M Y H:i", time() + $LOCALzone); + $LOCALdate=gmdate("D j M Y H:i", time() + $LOCALzone); if ($tzone >= 0) {$DISPtzone = "$plus$tzone";} else {$DISPtzone = "$tzone";} diff --git a/agc_2-X/trunk/www/vicidial/non_agent_api.php b/agc_2-X/trunk/www/vicidial/non_agent_api.php index b3dc3a01..a4a8d34e 100644 --- a/agc_2-X/trunk/www/vicidial/non_agent_api.php +++ b/agc_2-X/trunk/www/vicidial/non_agent_api.php @@ -3581,7 +3581,7 @@ if ($function == 'agent_stats_export') if ($login_sec > $login_start_end_check) {$login_sec = $login_start_end_check;} if ($ASsessions[$k] < 1) {$ASsessions[$k] = 1;} $avg_session_sec = ($login_sec / $ASsessions[$k]); - if ($ASpauses[$k] < 1) + if ( ($ASpauses[$k] < 1) or ($login_sec < 1) ) { $avg_pause_sec = 0; $avg_pause_session = 0; diff --git a/agc_2-X/trunk/www/vicidial/realtime_report.php b/agc_2-X/trunk/www/vicidial/realtime_report.php index 6b05fbc1..b28ed6d9 100644 --- a/agc_2-X/trunk/www/vicidial/realtime_report.php +++ b/agc_2-X/trunk/www/vicidial/realtime_report.php @@ -549,7 +549,7 @@ $select_list .= "