From 3d26ea0cd10c5d56cb99bf68c661e7de972eb47e Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 28 Jun 2012 03:06:58 +0000 Subject: [PATCH] Added Japanese agent interface, set 2.4 branch for RC 2 git-svn-id: svn://192.168.202.10@1836 3d104415-ff17-0410-8863-d5cf3c621b8a --- LANG_www/agc_jp/active_list_refresh.php | 483 + LANG_www/agc_jp/astguiclient.php | 2908 ++++ LANG_www/agc_jp/calendar.css | 95 + LANG_www/agc_jp/calendar_db.js | 335 + LANG_www/agc_jp/call_log_display.php | 197 + LANG_www/agc_jp/conf_exten_check.php | 778 + LANG_www/agc_jp/dbconnect.php | 61 + LANG_www/agc_jp/functions.php | 1435 ++ LANG_www/agc_jp/inbound_popup.php | 352 + LANG_www/agc_jp/live_exten_check.php | 279 + LANG_www/agc_jp/manager_send.php | 2112 +++ LANG_www/agc_jp/park_calls_display.php | 147 + LANG_www/agc_jp/phone_only.php | 839 + LANG_www/agc_jp/timeclock.php | 458 + LANG_www/agc_jp/vdc_db_query.php | 10008 +++++++++++ LANG_www/agc_jp/vdc_form_display.php | 469 + LANG_www/agc_jp/vdc_script_display.php | 523 + LANG_www/agc_jp/vdc_script_notes.php | 648 + LANG_www/agc_jp/vicidial.php | 13910 ++++++++++++++++ LANG_www/agc_jp/voicemail_check.php | 141 + UPGRADE | 2 + .../TO_BE_TRANSLATED_2.6.txt | 7 + www/agc/images/agc_live_call_DEAD_jp.gif | Bin 0 -> 2569 bytes www/agc/images/agc_live_call_OFF_jp.gif | Bin 0 -> 1366 bytes www/agc/images/agc_live_call_ON_jp.gif | Bin 0 -> 2118 bytes www/agc/images/vdc_LB_customxfer_OFF_jp.gif | Bin 0 -> 2033 bytes www/agc/images/vdc_LB_customxfer_jp.gif | Bin 0 -> 1581 bytes .../images/vdc_LB_dialnextnumber_OFF_jp.gif | Bin 0 -> 1867 bytes www/agc/images/vdc_LB_dialnextnumber_jp.gif | Bin 0 -> 1652 bytes .../images/vdc_LB_grabivrparkcall_OFF_jp.gif | Bin 0 -> 2073 bytes www/agc/images/vdc_LB_grabivrparkcall_jp.gif | Bin 0 -> 1641 bytes .../images/vdc_LB_grabparkedcall_OFF_jp.gif | Bin 0 -> 2046 bytes www/agc/images/vdc_LB_grabparkedcall_jp.gif | Bin 0 -> 1620 bytes .../images/vdc_LB_hangupcustomer_OFF_jp.gif | Bin 0 -> 1957 bytes www/agc/images/vdc_LB_hangupcustomer_jp.gif | Bin 0 -> 1616 bytes www/agc/images/vdc_LB_ivrparkcall_OFF_jp.gif | Bin 0 -> 2061 bytes www/agc/images/vdc_LB_ivrparkcall_jp.gif | Bin 0 -> 1595 bytes www/agc/images/vdc_LB_parkcall_OFF_jp.gif | Bin 0 -> 2041 bytes www/agc/images/vdc_LB_parkcall_jp.gif | Bin 0 -> 1598 bytes www/agc/images/vdc_LB_pause_OFF_jp.gif | Bin 0 -> 1606 bytes www/agc/images/vdc_LB_pause_jp.gif | Bin 0 -> 1496 bytes www/agc/images/vdc_LB_quickxfer_OFF_jp.gif | Bin 0 -> 2032 bytes www/agc/images/vdc_LB_quickxfer_jp.gif | Bin 0 -> 1569 bytes www/agc/images/vdc_LB_requeue_call_OFF_jp.gif | Bin 0 -> 2044 bytes www/agc/images/vdc_LB_requeue_call_jp.gif | Bin 0 -> 1617 bytes www/agc/images/vdc_LB_resume_OFF_jp.gif | Bin 0 -> 1602 bytes www/agc/images/vdc_LB_resume_jp.gif | Bin 0 -> 1471 bytes www/agc/images/vdc_LB_senddtmf_OFF_jp.gif | Bin 0 -> 1882 bytes www/agc/images/vdc_LB_senddtmf_jp.gif | Bin 0 -> 1539 bytes .../images/vdc_LB_startrecording_OFF_jp.gif | Bin 0 -> 2057 bytes www/agc/images/vdc_LB_startrecording_jp.gif | Bin 0 -> 1620 bytes .../images/vdc_LB_stoprecording_OFF_jp.gif | Bin 0 -> 2039 bytes www/agc/images/vdc_LB_stoprecording_jp.gif | Bin 0 -> 1604 bytes www/agc/images/vdc_LB_transferconf_OFF_jp.gif | Bin 0 -> 2044 bytes www/agc/images/vdc_LB_transferconf_jp.gif | Bin 0 -> 1584 bytes www/agc/images/vdc_LB_webform_OFF_jp.gif | Bin 0 -> 1472 bytes www/agc/images/vdc_LB_webform_jp.gif | Bin 0 -> 1472 bytes www/agc/images/vdc_LB_webform_two_OFF_jp.gif | Bin 0 -> 1479 bytes www/agc/images/vdc_LB_webform_two_jp.gif | Bin 0 -> 1479 bytes .../images/vdc_XB_blindtransfer_OFF_jp.gif | Bin 0 -> 1832 bytes www/agc/images/vdc_XB_blindtransfer_jp.gif | Bin 0 -> 1504 bytes www/agc/images/vdc_XB_channel_jp.gif | Bin 0 -> 1250 bytes www/agc/images/vdc_XB_code_jp.gif | Bin 0 -> 1238 bytes www/agc/images/vdc_XB_contactsbutton_jp.gif | Bin 0 -> 1432 bytes .../images/vdc_XB_dialwithcustomer_OFF_jp.gif | Bin 0 -> 1891 bytes www/agc/images/vdc_XB_dialwithcustomer_jp.gif | Bin 0 -> 1553 bytes .../images/vdc_XB_hangupbothlines_OFF_jp.gif | Bin 0 -> 1822 bytes www/agc/images/vdc_XB_hangupbothlines_jp.gif | Bin 0 -> 1572 bytes .../images/vdc_XB_hangupxferline_OFF_jp.gif | Bin 0 -> 1801 bytes www/agc/images/vdc_XB_hangupxferline_jp.gif | Bin 0 -> 1561 bytes www/agc/images/vdc_XB_header_jp.gif | Bin 0 -> 1451 bytes .../images/vdc_XB_hotkeysactive_OFF_jp.gif | Bin 0 -> 1915 bytes www/agc/images/vdc_XB_hotkeysactive_jp.gif | Bin 0 -> 1587 bytes .../images/vdc_XB_internalcloser_OFF_jp.gif | Bin 0 -> 1904 bytes www/agc/images/vdc_XB_internalcloser_jp.gif | Bin 0 -> 1497 bytes .../images/vdc_XB_leave3waycall_OFF_jp.gif | Bin 0 -> 1976 bytes www/agc/images/vdc_XB_leave3waycall_jp.gif | Bin 0 -> 1573 bytes www/agc/images/vdc_XB_localcloser_OFF_jp.gif | Bin 0 -> 1722 bytes www/agc/images/vdc_XB_localcloser_jp.gif | Bin 0 -> 1475 bytes www/agc/images/vdc_XB_number_jp.gif | Bin 0 -> 1280 bytes .../images/vdc_XB_parkcustomerdial_OFF_jp.gif | Bin 0 -> 1915 bytes www/agc/images/vdc_XB_parkcustomerdial_jp.gif | Bin 0 -> 1607 bytes www/agc/images/vdc_XB_presetsbutton_jp.gif | Bin 0 -> 1428 bytes www/agc/images/vdc_XB_seconds_jp.gif | Bin 0 -> 1152 bytes www/agc/images/vdc_tab_form_jp.gif | Bin 0 -> 1387 bytes www/agc/images/vdc_tab_script_jp.gif | Bin 0 -> 1458 bytes www/agc/images/vdc_volume_MUTE_jp.gif | Bin 0 -> 1514 bytes www/agc/images/vdc_volume_UNMUTE_jp.gif | Bin 0 -> 1461 bytes www/vicidial/welcome_demo.php | 3 + www/vicidial/welcome_languages.php | 3 + 90 files changed, 36193 insertions(+) create mode 100644 LANG_www/agc_jp/active_list_refresh.php create mode 100644 LANG_www/agc_jp/astguiclient.php create mode 100644 LANG_www/agc_jp/calendar.css create mode 100644 LANG_www/agc_jp/calendar_db.js create mode 100644 LANG_www/agc_jp/call_log_display.php create mode 100644 LANG_www/agc_jp/conf_exten_check.php create mode 100644 LANG_www/agc_jp/dbconnect.php create mode 100644 LANG_www/agc_jp/functions.php create mode 100644 LANG_www/agc_jp/inbound_popup.php create mode 100644 LANG_www/agc_jp/live_exten_check.php create mode 100644 LANG_www/agc_jp/manager_send.php create mode 100644 LANG_www/agc_jp/park_calls_display.php create mode 100644 LANG_www/agc_jp/phone_only.php create mode 100644 LANG_www/agc_jp/timeclock.php create mode 100644 LANG_www/agc_jp/vdc_db_query.php create mode 100644 LANG_www/agc_jp/vdc_form_display.php create mode 100644 LANG_www/agc_jp/vdc_script_display.php create mode 100644 LANG_www/agc_jp/vdc_script_notes.php create mode 100644 LANG_www/agc_jp/vicidial.php create mode 100644 LANG_www/agc_jp/voicemail_check.php create mode 100644 www/agc/images/agc_live_call_DEAD_jp.gif create mode 100644 www/agc/images/agc_live_call_OFF_jp.gif create mode 100644 www/agc/images/agc_live_call_ON_jp.gif create mode 100644 www/agc/images/vdc_LB_customxfer_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_customxfer_jp.gif create mode 100644 www/agc/images/vdc_LB_dialnextnumber_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_dialnextnumber_jp.gif create mode 100644 www/agc/images/vdc_LB_grabivrparkcall_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_grabivrparkcall_jp.gif create mode 100644 www/agc/images/vdc_LB_grabparkedcall_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_grabparkedcall_jp.gif create mode 100644 www/agc/images/vdc_LB_hangupcustomer_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_hangupcustomer_jp.gif create mode 100644 www/agc/images/vdc_LB_ivrparkcall_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_ivrparkcall_jp.gif create mode 100644 www/agc/images/vdc_LB_parkcall_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_parkcall_jp.gif create mode 100644 www/agc/images/vdc_LB_pause_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_pause_jp.gif create mode 100644 www/agc/images/vdc_LB_quickxfer_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_quickxfer_jp.gif create mode 100644 www/agc/images/vdc_LB_requeue_call_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_requeue_call_jp.gif create mode 100644 www/agc/images/vdc_LB_resume_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_resume_jp.gif create mode 100644 www/agc/images/vdc_LB_senddtmf_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_senddtmf_jp.gif create mode 100644 www/agc/images/vdc_LB_startrecording_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_startrecording_jp.gif create mode 100644 www/agc/images/vdc_LB_stoprecording_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_stoprecording_jp.gif create mode 100644 www/agc/images/vdc_LB_transferconf_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_transferconf_jp.gif create mode 100644 www/agc/images/vdc_LB_webform_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_webform_jp.gif create mode 100644 www/agc/images/vdc_LB_webform_two_OFF_jp.gif create mode 100644 www/agc/images/vdc_LB_webform_two_jp.gif create mode 100644 www/agc/images/vdc_XB_blindtransfer_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_blindtransfer_jp.gif create mode 100644 www/agc/images/vdc_XB_channel_jp.gif create mode 100644 www/agc/images/vdc_XB_code_jp.gif create mode 100644 www/agc/images/vdc_XB_contactsbutton_jp.gif create mode 100644 www/agc/images/vdc_XB_dialwithcustomer_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_dialwithcustomer_jp.gif create mode 100644 www/agc/images/vdc_XB_hangupbothlines_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_hangupbothlines_jp.gif create mode 100644 www/agc/images/vdc_XB_hangupxferline_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_hangupxferline_jp.gif create mode 100644 www/agc/images/vdc_XB_header_jp.gif create mode 100644 www/agc/images/vdc_XB_hotkeysactive_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_hotkeysactive_jp.gif create mode 100644 www/agc/images/vdc_XB_internalcloser_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_internalcloser_jp.gif create mode 100644 www/agc/images/vdc_XB_leave3waycall_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_leave3waycall_jp.gif create mode 100644 www/agc/images/vdc_XB_localcloser_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_localcloser_jp.gif create mode 100644 www/agc/images/vdc_XB_number_jp.gif create mode 100644 www/agc/images/vdc_XB_parkcustomerdial_OFF_jp.gif create mode 100644 www/agc/images/vdc_XB_parkcustomerdial_jp.gif create mode 100644 www/agc/images/vdc_XB_presetsbutton_jp.gif create mode 100644 www/agc/images/vdc_XB_seconds_jp.gif create mode 100644 www/agc/images/vdc_tab_form_jp.gif create mode 100644 www/agc/images/vdc_tab_script_jp.gif create mode 100644 www/agc/images/vdc_volume_MUTE_jp.gif create mode 100644 www/agc/images/vdc_volume_UNMUTE_jp.gif diff --git a/LANG_www/agc_jp/active_list_refresh.php b/LANG_www/agc_jp/active_list_refresh.php new file mode 100644 index 00000000..0d28a1c3 --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +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 "ローカル内線";} +if ($ADD==5) {echo "会議";} +if ($ADD==99999) {echo "ヘルプ";} +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/LANG_www/agc_jp/astguiclient.php b/LANG_www/agc_jp/astguiclient.php new file mode 100644 index 00000000..652e6103 --- /dev/null +++ b/LANG_www/agc_jp/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 "今、ログアウトしています。ありがとうございました。\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 "astGUIclient webクライアント: Login\n"; + echo "\n"; + echo "\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 "\n"; + echo "
ログイン
 
ユーザログイン:
ユーザパスワード:
電話ログイン:
電話パスワード:

バージョン: $version       ビルド: $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 "astGUIclient webクライアント: 電話ログイン\n"; +echo "\n"; +echo "\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 "
電話ログイン
 
電話ログイン:
電話パスワード:

バージョン: $version       ビルド: $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 "astGUIclient webクライアント: 電話ログイン\n"; + echo "\n"; + echo "\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 "
電話ログイン
 
すみません。あなたの電話ログインとパスワードはこのシステムでアクティブではありません。再度試してください。:
 
電話ログイン:
電話パスワード:

バージョン: $version       ビルド: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } +else + { + echo "astGUIclient webクライアント\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"; + + +?> + +
+ + + + + + + + + +
+ + +ログアウト
\n"; ?> +
メインパネルアクティブラインパネル会議パネルボイスメールをチェックする。ライブの電話
+
+ + +

Logout
+
+ + +
TRUNK HANGUP

+ Active Trunks Menu
+ ハングアップトランク   |   + ハイジャックトランク   |   + リッスントランク   |   + 再読み込み   |   + メインウィンドウに戻る +
+
+ + +
ローカルハングアップ

+ アクティブローカルメニュー
+ ハングアップローカル   |   + ハイジャックローカル   |   + リッスンローカル   |   + 再読み込み   |   + メインウィンドウに戻る +
+
+ + + + + + + +
ライブの電話転送
転送されるチャンネル: Channel
内線:
内線メニュー
+
+ 選択内線へ送信

+ 選択ボイスメールボックスへ送信

+ この番号に送信:


+ 再読み込み


+ メインウィンドウに戻る

+
会議:
(会議に送信するために以下の番号をクリックする。)
私のチャンネルも送信する。
会議メニュー
+
+ + + + + +
ローカル内線ダイアル
電話呼び出し: Channel
内線:
内線メニュー
+
+ 選択内線に電話する

+ 選択ボイスメールボックスに電話する

+ 再読み込み


+ メインウィンドウに戻る

+
+
+ + +
保留電話:
+ メインウィンドウに戻る

+
+
+ + + + + + + + + + + + + + + +
  +
ボイスメール     新:     旧:             マニュアルダイアル       DIAL
保留電話: 0                ローカルダイアル内線
外部への電話:
内部への電話:
astGUIclient web-クライアントバージョン: ビルド:
+ + + + $h) + { + if (strlen($favorites[$h])>1) + { + echo "\n"; + } + $h++; + } +?> + +
お気に入り       編集
$favorites[$h] - $favorites_names[$h]
 
+
+ + + + + + + +
お気に入り

 
お気に入りの変更を送信する-要ログアウト
メインウィンドウに戻る-変更を無視する
+
+ +
+ + + + + + + + + + + + + +
+STOP | START     リスレッシュレート: 1000 ms より速く | より遅く

+
初期化中..
+
有効な内線
+再読み込み | +オーダー | +
外線
+再読み込み | +オーダー | +
ローカル内線
+再読み込み | +オーダー | +
+ データはここを通ります。

+
+ データはここを通ります。

トランクアクション +
+ データはここを通ります。

ローカルアクション +
+
+ + + + +
+ + +会議リスト + + + +
+その会議での情報については、左側の会議ルーム番号をクリックしてください。 +
+ + + + + + + + + + + + + + + + + + diff --git a/LANG_www/agc_jp/calendar.css b/LANG_www/agc_jp/calendar.css new file mode 100644 index 00000000..a3ddcae5 --- /dev/null +++ b/LANG_www/agc_jp/calendar.css @@ -0,0 +1,95 @@ +/* calendar icon */ +img.tcalIcon { + cursor: pointer; + margin-left: 1px; + vertical-align: middle; +} +/* calendar container element */ +div#tcal { + position: absolute; + visibility: hidden; + z-index: 100; + width: 158px; + padding: 2px 0 0 0; +} +/* all tables in calendar */ +div#tcal table { + width: 100%; + border: 1px solid silver; + border-collapse: collapse; + background-color: white; +} +/* navigation table */ +div#tcal table.ctrl { + border-bottom: 0; +} +/* navigation buttons */ +div#tcal table.ctrl td { + width: 15px; + height: 20px; +} +/* month year header */ +div#tcal table.ctrl th { + background-color: white; + color: black; + border: 0; +} +/* week days header */ +div#tcal th { + border: 1px solid silver; + border-collapse: collapse; + text-align: center; + padding: 3px 0; + font-family: tahoma, verdana, arial; + font-size: 10px; + background-color: gray; + color: white; +} +/* date cells */ +div#tcal td { + border: 0; + border-collapse: collapse; + text-align: center; + padding: 2px 0; + font-family: tahoma, verdana, arial; + font-size: 11px; + width: 22px; + cursor: pointer; +} +/* date highlight + in case of conflicting settings order here determines the priority from least to most important */ +div#tcal td.othermonth { + color: silver; +} +div#tcal td.weekend { + background-color: #ACD6F5; +} +div#tcal td.today { + border: 1px solid red; +} +div#tcal td.selected { + background-color: #FFB3BE; +} +/* iframe element used to suppress windowed controls in IE5/6 */ +iframe#tcalIF { + position: absolute; + visibility: hidden; + z-index: 98; + border: 0; +} +/* transparent shadow */ +div#tcalShade { + position: absolute; + visibility: hidden; + z-index: 99; +} +div#tcalShade table { + border: 0; + border-collapse: collapse; + width: 100%; +} +div#tcalShade table td { + border: 0; + border-collapse: collapse; + padding: 0; +} diff --git a/LANG_www/agc_jp/calendar_db.js b/LANG_www/agc_jp/calendar_db.js new file mode 100644 index 00000000..9595fd91 --- /dev/null +++ b/LANG_www/agc_jp/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' : ['1月', 'February', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], + 'yearscroll': true, // show year scroller + 'weekstart': 0, // first day of week: 0-Su or 1-Mo + 'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx. + 'imgpath' : '../agc/images/' // directory with calendar images +} +// date parsing function +function f_tcalParseDate (s_date) { + + var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/; + if (!re_date.exec(s_date)) + return alert ("無効 date: '" + s_date + "'.\nAccepted format is yyyy-mm-dd.") + var n_day = Number(RegExp.$3), + n_month = Number(RegExp.$2), + n_year = Number(RegExp.$1); + + if (n_year < 100) + n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900); + if (n_month < 1 || n_month > 12) + return alert ("無効 month value: '" + n_month + "'.\nAllowed range is 01-12."); + var d_numdays = new Date(n_year, n_month, 0); + if (n_day > d_numdays.getDate()) + return alert("無効 day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + "."); + + return new Date (n_year, n_month - 1, n_day); +} +// date generating function +function f_tcalGenerDate (d_date) { + return ( + d_date.getFullYear() + "-" + + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-" + + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + ); +} + +// implementation +function tcal (a_cfg, a_tpl) { + + // apply default template if not specified + if (!a_tpl) + a_tpl = A_TCALDEF; + + // register in global collections + if (!window.A_TCALS) + window.A_TCALS = []; + if (!window.A_TCALSIDX) + window.A_TCALSIDX = []; + + this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length; + window.A_TCALS[this.s_id] = this; + window.A_TCALSIDX[window.A_TCALSIDX.length] = this; + + // assign methods + this.f_show = f_tcal_show; + this.f_hide = f_tcal_hide; + this.f_toggle = f_tcalToggle; + this.f_update = f_tcalUpdate; + this.f_relDate = f_tcalRelDate; + this.f_parseDate = f_tcalParseDate; + this.f_generDate = f_tcalGenerDate; + + // create calendar icon + this.s_iconId = 'tcalico_' + this.s_id; + this.e_icon = f_getElement(this.s_iconId); + if (!this.e_icon) { + document.write('Open Calendar'); + this.e_icon = f_getElement(this.s_iconId); + } + // save received parameters + this.a_cfg = a_cfg; + this.a_tpl = a_tpl; +} + +function f_tcal_show (d_date) { + + // find input field + if (!this.a_cfg.controlname) + throw("TC: control name is not specified"); + if (this.a_cfg.formname) { + var e_form = document.forms[this.a_cfg.formname]; + if (!e_form) + throw("TC: form '" + this.a_cfg.formname + "' can not be found"); + this.e_input = e_form.elements[this.a_cfg.controlname]; + } + else + this.e_input = f_getElement(this.a_cfg.controlname); + + if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT') + throw("TC: element '" + this.a_cfg.controlname + "' does not exist in " + + (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document')); + + // dynamically create HTML elements if needed + this.e_div = f_getElement('tcal'); + if (!this.e_div) { + this.e_div = document.createElement("DIV"); + this.e_div.id = 'tcal'; + document.body.appendChild(this.e_div); + } + this.e_shade = f_getElement('tcalShade'); + if (!this.e_shade) { + this.e_shade = document.createElement("DIV"); + this.e_shade.id = 'tcalShade'; + document.body.appendChild(this.e_shade); + } + this.e_iframe = f_getElement('tcalIF') + if (b_ieFix && !this.e_iframe) { + this.e_iframe = document.createElement("IFRAME"); + this.e_iframe.style.filter = 'alpha(opacity=0)'; + this.e_iframe.id = 'tcalIF'; + this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif'; + document.body.appendChild(this.e_iframe); + } + + // hide all calendars + f_tcal_hideAll(); + + // generate HTML and show calendar + this.e_icon = f_getElement(this.s_iconId); + if (!this.f_update()) + return; + + this.e_div.style.visibility = 'visible'; + this.e_shade.style.visibility = 'visible'; + if (this.e_iframe) + this.e_iframe.style.visibility = 'visible'; + + // change icon and status + this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif'; + this.e_icon.title = 'Close Calendar'; + this.b_visible = true; +} + +function f_tcal_hide (n_date) { + if (n_date) + this.e_input.value = this.f_generDate(new Date(n_date)); + + // no action if not visible + if (!this.b_visible) + return; + + // hide elements + if (this.e_iframe) + this.e_iframe.style.visibility = 'hidden'; + if (this.e_shade) + this.e_shade.style.visibility = 'hidden'; + this.e_div.style.visibility = 'hidden'; + + // change icon and status + this.e_icon = f_getElement(this.s_iconId); + this.e_icon.src = this.a_tpl.imgpath + 'cal.gif'; + this.e_icon.title = 'Open Calendar'; + this.b_visible = false; +} + +function f_tcalToggle () { + return this.b_visible ? this.f_hide() : this.f_show(); +} + +function f_tcalUpdate (d_date) { + + var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : f_tcalResetTime(new Date()); + var d_selected = this.e_input.value == '' + ? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today) + : this.f_parseDate(this.e_input.value); + + // figure out date to display + if (!d_date) + // selected by default + d_date = d_selected; + else if (typeof(d_date) == 'number') + // get from number + d_date = f_tcalResetTime(new Date(d_date)); + else if (typeof(d_date) == 'string') + // parse from string + this.f_parseDate(d_date); + + if (!d_date) return false; + + // first date to display + var d_firstday = new Date(d_date); + d_firstday.setDate(1); + d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7); + + var a_class, s_html = '' + + (this.a_tpl.yearscroll ? '' : '') + + '' + + (this.a_tpl.yearscroll ? '' : '') + + '
' + + this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear() + + '
'; + + // print weekdays titles + for (var i = 0; i < 7; i++) + s_html += ''; + s_html += '' ; + + // print calendar table + var n_date, n_month, d_current = new Date(d_firstday); + while (d_current.getMonth() == d_date.getMonth() || + d_current.getMonth() == d_firstday.getMonth()) { + + // print row heder + s_html +=''; + for (var n_wday = 0; n_wday < 7; n_wday++) { + + a_class = []; + n_date = d_current.getDate(); + n_month = d_current.getMonth(); + + // other month + if (d_current.getMonth() != d_date.getMonth()) + a_class[a_class.length] = 'othermonth'; + // weekend + if (d_current.getDay() == 0 || d_current.getDay() == 6) + a_class[a_class.length] = 'weekend'; + // today + if (d_current.valueOf() == d_today.valueOf()) + a_class[a_class.length] = 'today'; + // selected + if (d_current.valueOf() == d_selected.valueOf()) + a_class[a_class.length] = 'selected'; + + s_html += '' + + d_current.setDate(++n_date); + while (d_current.getDate() != n_date && d_current.getMonth() == n_month) { + d_current.setHours(d_current.getHours + 1); + d_current = f_tcalResetTime(d_current); + } + } + // print row footer + s_html +=''; + } + s_html +='
' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + '
' : '>') + n_date + '
'; + + // update HTML, positions and sizes + this.e_div.innerHTML = s_html; + + var n_width = this.e_div.offsetWidth; + var n_height = this.e_div.offsetHeight; + var n_top = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight; + var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth; + if (n_left < 0) n_left = 0; + + this.e_div.style.left = n_left + 'px'; + this.e_div.style.top = n_top + 'px'; + + this.e_shade.style.width = (n_width + 8) + 'px'; + this.e_shade.style.left = (n_left - 1) + 'px'; + this.e_shade.style.top = (n_top - 1) + 'px'; + this.e_shade.innerHTML = b_ieFix + ? '
' + : '
'; + + if (this.e_iframe) { + this.e_iframe.style.left = n_left + 'px'; + this.e_iframe.style.top = n_top + 'px'; + this.e_iframe.style.width = (n_width + 6) + 'px'; + this.e_iframe.style.height = (n_height + 6) +'px'; + } + return true; +} + +function f_getPosition (e_elemRef, s_coord) { + var n_pos = 0, n_offset, + e_elem = e_elemRef; + + while (e_elem) { + n_offset = e_elem["offset" + s_coord]; + n_pos += n_offset; + e_elem = e_elem.offsetParent; + } + // margin correction in some browsers + if (b_ieMac) + n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']); + else if (b_safari) + n_pos -= n_offset; + + e_elem = e_elemRef; + while (e_elem != document.body) { + n_offset = e_elem["scroll" + s_coord]; + if (n_offset && e_elem.style.overflow == 'scroll') + n_pos -= n_offset; + e_elem = e_elem.parentNode; + } + return n_pos; +} + +function f_tcalRelDate (d_date, d_diff, s_units) { + var s_units = (s_units == 'y' ? 'FullYear' : 'Month'); + var d_result = new Date(d_date); + d_result['set' + s_units](d_date['get' + s_units]() + d_diff); + if (d_result.getDate() != d_date.getDate()) + d_result.setDate(0); + return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"'; +} + +function f_tcal_hideAll () { + for (var i = 0; i < window.A_TCALSIDX.length; i++) + window.A_TCALSIDX[i].f_hide(); +} + +function f_tcalResetTime (d_date) { + d_date.setHours(0); + d_date.setMinutes(0); + d_date.setSeconds(0); + d_date.setMilliseconds(0); + return d_date; +} + +f_getElement = document.all ? + function (s_id) { return document.all[s_id] } : + function (s_id) { return document.getElementById(s_id) }; + +if (document.addEventListener) + window.addEventListener('scroll', f_tcal_hideAll, false); +if (window.attachEvent) + window.attachEvent('onscroll', f_tcal_hideAll); + +// global variables +var s_userAgent = navigator.userAgent.toLowerCase(), + re_webkit = /WebKit\/(\d+)/i; +var b_mac = s_userAgent.indexOf('mac') != -1, + b_ie5 = s_userAgent.indexOf('msie 5') != -1, + b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1; +var b_ieFix = b_ie5 || b_ie6, + b_ieMac = b_mac && b_ie5, + b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500; diff --git a/LANG_www/agc_jp/call_log_display.php b/LANG_www/agc_jp/call_log_display.php new file mode 100644 index 00000000..a653b92d --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "電話ログ表示"; +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 有効ではない またはプロトコル $protocol 有効ではない\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/LANG_www/agc_jp/conf_exten_check.php b/LANG_www/agc_jp/conf_exten_check.php new file mode 100644 index 00000000..bd310869 --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +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) + { + $channel_live=0; + echo "Conf Exten $conf_exten 有効ではない\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 オン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 + $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 オン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 オン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 . '|ステータス: ' . $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 有効ではない or Exten $exten 有効ではない\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 "会議 $conf_exten 登録されています $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/LANG_www/agc_jp/dbconnect.php b/LANG_www/agc_jp/dbconnect.php new file mode 100644 index 00000000..e02ca392 --- /dev/null +++ b/LANG_www/agc_jp/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/LANG_www/agc_jp/functions.php b/LANG_www/agc_jp/functions.php new file mode 100644 index 00000000..cc866913 --- /dev/null +++ b/LANG_www/agc_jp/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/LANG_www/agc_jp/inbound_popup.php b/LANG_www/agc_jp/inbound_popup.php new file mode 100644 index 00000000..672b0210 --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 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"; +?> + + +ライブ内部向け電話"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "

ライブ内部向け電話

\n"; +echo "$NOW_TIME

\n"; +} + + +$MT[0]=''; +$row=''; $rowx=''; +$channel_live=1; +if (strlen($uniqueid)<9) + { + $channel_live=0; + echo "Uniqueid $uniqueid 有効ではない\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 "
ダイアルした番号: $row[8]
注:$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|
\n"; + echo "電話を切る - \n"; + echo "マイボイスメールに送信する\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/LANG_www/agc_jp/live_exten_check.php b/LANG_www/agc_jp/live_exten_check.php new file mode 100644 index 00000000..f3dd49a7 --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "ライブ内線チェック"; +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 有効ではない またはプロトコル $protocol 有効ではない\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/LANG_www/agc_jp/manager_send.php b/LANG_www/agc_jp/manager_send.php new file mode 100644 index 00000000..dfd803e9 --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "マネージャーが送信する: "; + 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 "ヘルプ";} + 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 有効ではない or queryCID $queryCID 有効ではない, Originate 挿入されていないコマンド\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 送信されたコマンド Exten $exten チャンネル $channel オン$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 "これらの変数の1つ 有効ではない:\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 + { + $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 "これらの変数の1つ 有効ではない:\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 + { + $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 有効ではない 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"; + 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 送信されたコマンド Exten $exten チャンネル $channel オン$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 有効ではない or ext_context $ext_context or queryCID $queryCID 有効ではない, Hangup 挿入されていないコマンド\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 有効ではない or queryCID $queryCID 有効ではない, Hangup 挿入されていないコマンド\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 ライブではない オン$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";} + $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 ライブではない オン$call_server_ip, Hangup 挿入されていないコマンド $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 オン$call_server_ip, Hangup 挿入されていないコマンド $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 送信されたコマンド チャンネル $channel オン$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 "これらの変数の1つ 有効ではない:\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 + { + 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 "これらの変数の1つ 有効ではない:\n"; + echo "Channel $channel 2文字以上でなければなりません。\n"; + echo "queryCID $queryCID 14文字以上でなければなりません。\n"; + echo "exten $exten 送信されなければなりません。\n"; + echo "extenName $extenName 送信されなければなりません。\n"; + echo "ext_context $ext_context 送信されなければなりません。\n"; + echo "ext_priority $ext_priority 送信されなければなりません。\n"; + echo "parkedby $parkedby 送信されなければなりません。\n"; + echo "\nRedirectToPark Action 送信されない\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','$CalLCID','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);} + $ACTION="Redirect"; + + $stmt = "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") + { + 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 "これらの変数の1つ 有効ではない:\n"; + echo "Channel $channel 2文字以上でなければなりません。\n"; + echo "queryCID $queryCID 14文字以上でなければなりません。\n"; + echo "exten $exten 送信されなければなりません。\n"; + echo "ext_context $ext_context 送信されなければなりません。\n"; + echo "ext_priority $ext_priority 送信されなければなりません。\n"; + echo "\nRedirectFromPark Action 送信されない\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);} + $ACTION="Redirect"; + + $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 "これらの変数の1つ 有効ではない:\n"; + echo "Channel $channel 2文字以上でなければなりません。\n"; + echo "queryCID $queryCID 14文字以上でなければなりません。\n"; + echo "exten $exten 送信されなければなりません。\n"; + echo "extenName $extenName 送信されなければなりません。\n"; + echo "ext_context $ext_context 送信されなければなりません。\n"; + echo "ext_priority $ext_priority 送信されなければなりません。\n"; + echo "parkedby $parkedby 送信されなければなりません。\n"; + echo "\nRedirectToPark Action 送信されない\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','$CalLCID','$extenName','$parkedby','$NOW_TIME');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);} + $ACTION="Redirect"; + + $stmt = "UPDATE vicidial_auto_calls SET extension='保留_IVR' where callerid='$CalLCID' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02088',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVR保留ED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02107',$user,$server_ip,$session_name,$one_mysql_log);} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02108',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $time_id=0; + $stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02109',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + $queue = $row[1]; + $agent = $row[2]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + if ($VAC_eq_ct > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLERONHOLD',data1='IVR保留',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02110',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + # $fp = fopen ("./vicidial_debug.txt", "a"); + # fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n"); + # fclose($fp); + } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02089',$user,$server_ip,$session_name,$one_mysql_log);} + } + +if ($ACTION=="RedirectFromParkIVR") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "これらの変数の1つ 有効ではない:\n"; + echo "Channel $channel 2文字以上でなければなりません。\n"; + echo "queryCID $queryCID 14文字以上でなければなりません。\n"; + echo "exten $exten 送信されなければなりません。\n"; + echo "ext_context $ext_context 送信されなければなりません。\n"; + echo "ext_priority $ext_priority 送信されなければなりません。\n"; + echo "\nRedirectFromPark Action 送信されない\n"; + } + else + { + if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;} + $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);} + $ACTION="Redirect"; + + $stmt = "UPDATE vicidial_auto_calls SET extension='' where callerid='$CalLCID' limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02090',$user,$server_ip,$session_name,$one_mysql_log);} + + $parked_sec=0; + $stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02111',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_pl_ct = mysql_num_rows($rslt); + if ($VAC_pl_ct > 0) + { + $row=mysql_fetch_row($rslt); + $parked_sec = ($StarTtime - $row[0]); + + $stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02112',$user,$server_ip,$session_name,$one_mysql_log);} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02113',$user,$server_ip,$session_name,$one_mysql_log);} + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $time_id=0; + $stmt="SELECT time_id,queue,agent from queue_log where call_id='$CalLCID' and verb='CONNECT' order by time_id desc limit 1;"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02114',$user,$server_ip,$session_name,$one_mysql_log);} + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + $queue = $row[1]; + $agent = $row[2]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + if ($VAC_eq_ct > 0) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$queue',agent='Agent/$user',verb='CALLEROFFHOLD',data1='$parked_sec',data2='IVR保留',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02115',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + } + } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02091',$user,$server_ip,$session_name,$one_mysql_log);} + } + + +if ($ACTION=="RedirectName") + { + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) ) + { + $channel_live=0; + echo "これらの変数の1つ 有効ではない:\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 + { + $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 "これらの変数の1つ 有効ではない:\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 + { + $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 "これらの変数の1つ 有効ではない:\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) + { + $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 オン$server_ip, Redirect 挿入されていないコマンド\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "空の会議を見つけることができません。 オン$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 ライブではない オン$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';"; + 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 ライブではない オン$server_ip, Redirect 挿入されていないコマンド\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ライブではない オン$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 挿入されていないコマンド\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 送信されたコマンド チャンネル $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";} + } + } + 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 オン$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 "これらの変数の1つ 有効ではない:\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"); + 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 オン$server_ip, Redirect 挿入されていないコマンド\n|$stmt|"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "空の会議を見つけることができません。 オン$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 ライブではない オン$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';"; + 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 ライブではない オン$server_ip, Redirect 挿入されていないコマンド\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel ライブではない オン$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 送信されたコマンド チャンネル $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 + { + $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 送信されたコマンド チャンネル $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";} + } + } + 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 "これらの変数の1つ 有効ではない:\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 + { + 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 ライブではない オン$server_ip, Redirect 挿入されていないコマンド\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 送信されたコマンド チャンネル $channel オン$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 有効ではない or queryCID $queryCID 有効ではない or filename: $filename 有効ではない, $ACTION 挿入されていないコマンド\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 ライブではない オン$server_ip, $ACTION 挿入されていないコマンド\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 送信されたコマンド チャンネル $channel オン$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 有効ではない or exten $exten 有効ではない or filename: $filename 有効ではない, $ACTION 挿入されていないコマンド\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 オン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 送信されたコマンド チャンネル $channel オン$server_ip\nFilename: $filename\nRecorDing_ID: $recording_id\n 録音は最大60分まで続きます。\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 "会議 $exten, Stage $stage 有効ではない or queryCID $queryCID 有効ではない, Originate 挿入されていないコマンド\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 送信されたコマンド 会議 $exten, Stage $stage チャンネル $channel オン$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/LANG_www/agc_jp/park_calls_display.php b/LANG_www/agc_jp/park_calls_display.php new file mode 100644 index 00000000..e2ca940d --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "保留中の電話表示"; +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 有効ではない またはプロトコル $protocol 有効ではない\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/LANG_www/agc_jp/phone_only.php b/LANG_www/agc_jp/phone_only.php new file mode 100644 index 00000000..c36cdb09 --- /dev/null +++ b/LANG_www/agc_jp/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 日本語
\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 日本語
\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 日本語
\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 日本語
\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/LANG_www/agc_jp/timeclock.php b/LANG_www/agc_jp/timeclock.php new file mode 100644 index 00000000..b62923ba --- /dev/null +++ b/LANG_www/agc_jp/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 = "入力したユーザ名とパスワードはこのシステム内では有効ではありません。
再度、お試しください。:"; + + echo"\n"; + echo"Agent タイムクロック\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 "
タイムクロック
 
ユーザログイン:
ユーザパスワード:
 

バージョン: $version       ビルド: $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 秒 of your last login/logout + $VDdisplayMESSAGE = "最後にログインまたはログアウトの30秒以内にログインまたはログアウトすることができません。"; + + echo"\n"; + echo"Agent タイムクロック\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 "
タイムクロック
 
ユーザログイン:
ユーザパスワード:
 

バージョン: $version       ビルド: $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 = "今、ログインしました。"; + $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';"; + 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 = "今、ログアウトしました。"; + $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';"; + 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 "エラー:タイムクロックログ入力がすでに行われました:$status|$stage"; exit;} + + if ($referrer=='agent') + {$BACKlink = "エージェントログイン画面に戻る";} + if ($referrer=='admin') + {$BACKlink = "管理に戻る";} + if ($referrer=='welcome') + {$BACKlink = "ようこそ画面に戻る";} + + echo"\n"; + echo"Agent タイムクロック\n"; + echo"\n"; + echo"\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
タイムクロック
 
$LOGtimeMESSAGE
 
$BACKlink
 

バージョン: $version       ビルド: $build
\n"; + echo "\n\n"; + echo "\n\n"; + + exit; + } + + + + + if ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) + { + $VDdisplayMESSAGE = "最後にログインしてからの時間:$totTIME_HMS"; + $log_action = 'login'; + $button_name = 'LOGIN'; + $LOGtimeMESSAGE = "以下の時間に最後にログアウトしました:$last_action_date

ログインするために以下のログインをクリックする"; + } + if ($status=='LOGIN') + { + $VDdisplayMESSAGE = "ログインしていた時間:$totTIME_HMS"; + $log_action = 'logout'; + $button_name = 'LOGOUT'; + $LOGtimeMESSAGE = "以下の時間にログインしました: $last_action_date
ログインしていた時間:$totTIME_HMS

ログアウトするために以下のログアウトをクリックする"; + } + + echo"\n"; + echo"Agent タイムクロック\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 "
タイムクロック
 
$LOGtimeMESSAGE
 
 

バージョン: $version       ビルド: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + + exit; + } + + + + } + +else + { + echo"\n"; + echo"Agent タイムクロック\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 "
タイムクロック
 
ユーザログイン:
ユーザパスワード:
 

バージョン: $version       ビルド: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + } + +exit; + +?> diff --git a/LANG_www/agc_jp/vdc_db_query.php b/LANG_www/agc_jp/vdc_db_query.php new file mode 100644 index 00000000..1fb79aaf --- /dev/null +++ b/LANG_www/agc_jp/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["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"); +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 => "ユーザ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,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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + } + +if ($format=='debug') + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "VICIDiaL データベースクエリースクリプト"; + 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 = "エラー:あなたのユーザグループに有効化されたシフトはありません。\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 = "エラー:あなたのシフトの外部にログインすることは許可されていません。\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"; + 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 "グループ選択 $closer_choice 有効ではない\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 グループ選択 $closer_choice ユーザに登録されています $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 有効ではない\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 ユーザに登録されています $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 "ホッパーが空です\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 + $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 電話 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 番号\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 番号\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 "番号 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 電話 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 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 .= "電話 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 ";} + } + } + ##### 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); + + # 電話OUTBOUND (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 "ホッパーが空です\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 "代替電話 番号 ステータス NOT CHANGED\n"; + echo "$phone_number $stage $lead_id or $called_count 有効ではない\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 "代替電話 番号 ステータス 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 有効ではない\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 有効ではない\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 " 電話 NOT PLACED\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,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); + + # 電話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' $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 有効ではない\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 秒, 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 "ログが入力されていません\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 + { + $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 挿入済み: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "ログが入力されていません\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 挿入済み: $uniqueid|$channel|$NOW_TIME"; + # } + # else + # { + # echo "ログが入力されていません\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 "ログが入力されていません\n"; + echo "uniqueid $uniqueid or lead_id: $lead_id 有効ではない\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 挿入済み: $uniqueid|$channel|$NOW_TIME\n"; + echo "$StarTtime\n"; + } + else + { + echo "ログが入力されていません\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 "ログが入力されていません\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 "キャンペーン $campaign 有効ではない\n"; + echo "lead_id $lead_id 有効ではない\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 "キャンペーン $campaign 有効ではない\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 オン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 オン$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 有効ではない\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 オン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 有効ではない\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($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); + 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); + } + + ### 電話BACK 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','$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);} + } + + ### 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';"; + 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 ユーザ$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 最後 Attempt, Date of 最後 Non-Contact, Date of 最後 Contact, Date of 最後 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 . ' 変更されています ' . $dispo_choice . " ステータス\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 有効ではない\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 有効ではない\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 オン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"; + } + } + + +################################################################################ +### 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 有効ではない\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 有効ではない\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 ' 一時停止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') + { + $AXVSuserオーダー[$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') + { + $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 "
  "; + 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($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 "    -準備ができている      -インコール      -一時停止  \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 "このキャンペーンに対し無効になっている列になっている電話ビュー\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 オン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 オン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 "
    電話     名前     待つ     エージェント           内部向けグループ     タイプ  
保留電話を取る     $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 "行く       "; + echo "閉じる"; + 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 "
  #     日付/時間     長さ     ステータス     電話     名前     キャンペーン     内部向け/外部向け     代替     電話を切る     情報     ダイアル  
この日には電話がありません。
$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] 情報 ダイアル
"; + 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 "
  #     名前     電話     ステータス     最後 電話     市町村     都道府県     郵便番号     情報     ダイアル  
結果が見つかりません。
$u$ALLname[$i] $ALLphone_code[$i] $ALLphone_number[$i] $ALLstatus[$i] $ALLcall_date[$i] $ALLcity[$i] $ALLstate[$i] $ALLpostal_code[$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; + } + } + + + +################################################################################ +### 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 "
  #     最初 名前     最後 名前     事務室     携帯電話     他の 1     他の 2     業界  
結果が見つかりません。
$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 = 'ベンダーID'; + $label_gender = 'Gender'; + $label_phone_number = '電話'; + $label_phone_code = 'ダイアルコード'; + $label_alt_phone = '代替電話'; + $label_security_phrase = '示す'; + $label_email = 'メール'; + $label_comments = 'コメント'; + + $stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,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 .= "ダイアル";} + } + if ( ($label_phone_number=='---HIDE---') and ($hide_dial_links < 1) ) + { + $INFOout .= "
Dial Link:   ダイアル"; + } + $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 .= "ダイアル";} + } + $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] = "注: $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] = "注: $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 .= "
  #     日付/時間     エージェント     長さ     ステータス     電話     キャンペーン     内部向け/外部向け     代替     電話を切る  
  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 +################################################################################ +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: このキャンペーンに対し無効になっている列になっている電話ビュー\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/LANG_www/agc_jp/vdc_form_display.php b/LANG_www/agc_jp/vdc_form_display.php new file mode 100644 index 00000000..928fe0ed --- /dev/null +++ b/LANG_www/agc_jp/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/LANG_www/agc_jp/vdc_script_display.php b/LANG_www/agc_jp/vdc_script_display.php new file mode 100644 index 00000000..6cd51669 --- /dev/null +++ b/LANG_www/agc_jp/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/LANG_www/agc_jp/vdc_script_notes.php b/LANG_www/agc_jp/vdc_script_notes.php new file mode 100644 index 00000000..e496d344 --- /dev/null +++ b/LANG_www/agc_jp/vdc_script_notes.php @@ -0,0 +1,648 @@ + LICENSE: AGPLv2 +# +# This script is designed open in the SCRIPT tab in the agent interface through +# an IFRAME. It will create a new record for every SUBMIT +# +# Example of a ViciDial agent SCRIPT using this script: +# +# +# CHANGELOG: +# 100215-0744 - First build of script +# 100622-2230 - Added field labels +# + +$version = '2.4-2'; +$build = '100622-2230'; + +require("dbconnect.php"); + + +if (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} + elseif (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} +if (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} + elseif (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + $vendor_lead_code = $vendor_id; +if (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} + elseif (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} +if (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];} + elseif (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];} +if (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} + elseif (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} +if (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} + elseif (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} +if (isset($_POST["title"])) {$title=$_POST["title"];} + elseif (isset($_GET["title"])) {$title=$_GET["title"];} +if (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} + elseif (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} +if (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];} + elseif (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];} +if (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} + elseif (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} +if (isset($_POST["address1"])) {$address1=$_POST["address1"];} + elseif (isset($_GET["address1"])) {$address1=$_GET["address1"];} +if (isset($_POST["address2"])) {$address2=$_POST["address2"];} + elseif (isset($_GET["address2"])) {$address2=$_GET["address2"];} +if (isset($_POST["address3"])) {$address3=$_POST["address3"];} + elseif (isset($_GET["address3"])) {$address3=$_GET["address3"];} +if (isset($_POST["city"])) {$city=$_POST["city"];} + elseif (isset($_GET["city"])) {$city=$_GET["city"];} +if (isset($_POST["state"])) {$state=$_POST["state"];} + elseif (isset($_GET["state"])) {$state=$_GET["state"];} +if (isset($_POST["province"])) {$province=$_POST["province"];} + elseif (isset($_GET["province"])) {$province=$_GET["province"];} +if (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} + elseif (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} +if (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} + elseif (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} +if (isset($_POST["gender"])) {$gender=$_POST["gender"];} + elseif (isset($_GET["gender"])) {$gender=$_GET["gender"];} +if (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];} + elseif (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];} +if (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} + elseif (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} +if (isset($_POST["email"])) {$email=$_POST["email"];} + elseif (isset($_GET["email"])) {$email=$_GET["email"];} +if (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];} + elseif (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];} +if (isset($_POST["comments"])) {$comments=$_POST["comments"];} + elseif (isset($_GET["comments"])) {$comments=$_GET["comments"];} +if (isset($_POST["user"])) {$user=$_POST["user"];} + elseif (isset($_GET["user"])) {$user=$_GET["user"];} +if (isset($_POST["pass"])) {$pass=$_POST["pass"];} + elseif (isset($_GET["pass"])) {$pass=$_GET["pass"];} +if (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} + elseif (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} +if (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} + elseif (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} +if (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];} + elseif (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];} +if (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} + elseif (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} +if (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];} + elseif (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];} +if (isset($_POST["closer"])) {$closer=$_POST["closer"];} + elseif (isset($_GET["closer"])) {$closer=$_GET["closer"];} +if (isset($_POST["group"])) {$group=$_POST["group"];} + elseif (isset($_GET["group"])) {$group=$_GET["group"];} +if (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} + elseif (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} +if (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];} + elseif (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];} +if (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} + elseif (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} +if (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} + elseif (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} +if (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];} + elseif (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];} +if (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];} + elseif (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];} +if (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} + elseif (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} +if (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];} + elseif (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];} +if (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} + elseif (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} +if (isset($_POST["phone"])) {$phone=$_POST["phone"];} + elseif (isset($_GET["phone"])) {$phone=$_GET["phone"];} +if (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} + elseif (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} +if (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} + elseif (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} +if (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];} + elseif (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];} +if (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];} + elseif (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];} +if (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];} + elseif (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];} +if (isset($_POST["rank"])) {$rank=$_POST["rank"];} + elseif (isset($_GET["rank"])) {$rank=$_GET["rank"];} +if (isset($_POST["owner"])) {$owner=$_POST["owner"];} + elseif (isset($_GET["owner"])) {$owner=$_GET["owner"];} +if (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];} + elseif (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];} +if (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];} + elseif (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];} +if (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];} + elseif (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];} +if (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];} + elseif (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];} +if (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} + elseif (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} +if (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];} + elseif (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];} +if (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} + elseif (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} +if (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];} + elseif (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];} +if (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];} + elseif (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];} +if (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];} + elseif (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];} +if (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];} + elseif (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];} +if (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];} + elseif (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];} +if (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];} + elseif (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];} +if (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];} + elseif (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];} +if (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];} + elseif (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];} +if (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];} + elseif (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];} +if (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];} + elseif (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];} +if (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];} + elseif (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];} +if (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];} + elseif (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];} +if (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];} + elseif (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];} +if (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];} + elseif (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} +if (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];} + elseif (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];} + +if (isset($_POST["DB"])) {$DB=$_POST["DB"];} + elseif (isset($_GET["DB"])) {$DB=$_GET["DB"];} +if (isset($_POST["process"])) {$process=$_POST["process"];} + elseif (isset($_GET["process"])) {$process=$_GET["process"];} +if (isset($_POST["vicidial_id"])) {$vicidial_id=$_POST["vicidial_id"];} + elseif (isset($_GET["vicidial_id"])) {$vicidial_id=$_GET["vicidial_id"];} +if (isset($_POST["call_date"])) {$call_date=$_POST["call_date"];} + elseif (isset($_GET["call_date"])) {$call_date=$_GET["call_date"];} +if (isset($_POST["order_id"])) {$order_id=$_POST["order_id"];} + elseif (isset($_GET["order_id"])) {$order_id=$_GET["order_id"];} +if (isset($_POST["appointment_date"])) {$appointment_date=$_POST["appointment_date"];} + elseif (isset($_GET["appointment_date"])) {$appointment_date=$_GET["appointment_date"];} +if (isset($_POST["appointment_time"])) {$appointment_time=$_POST["appointment_time"];} + elseif (isset($_GET["appointment_time"])) {$appointment_time=$_GET["appointment_time"];} +if (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];} + elseif (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} +if (isset($_POST["notesid"])) {$notesid=$_POST["notesid"];} + elseif (isset($_GET["notesid"])) {$notesid=$_GET["notesid"];} +if ($notesid < 100) + {$notesid=0;} +if (strlen($vicidial_id) < 1) + {$vicidial_id = $uniqueid;} +if (strlen($appointment_time) < 1) + {$appointment_time = '12:00:00';} + +$appointment_timeARRAY = explode(":",$appointment_time); +$appointment_hour = $appointment_timeARRAY[0]; +$appointment_min = $appointment_timeARRAY[1]; + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 + +$txt = '.txt'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +$MT[0]=''; +$agents='@agents'; + +if (strlen($call_date) < 1) + {$call_date = $NOW_TIME;} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $timeclock_end_of_day = $row[1]; + $agentonly_callback_campaign_lock = $row[2]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec); + $phone_code = ereg_replace("[^0-9]","",$phone_code); + $phone_number = ereg_replace("[^0-9]","",$phone_number); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + +if ($DB > 0) + { + echo "
$lead_id|$entry_date|$modify_date|$status|$user|$vendor_lead_code|$source_id|$list_id|$gmt_offset_now|$called_since_last_reset|$phone_code|$phone_number|$title|$first_name|$middle_initial|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country_code|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$last_local_call_time|$rank|$owner|\n
"; + } + +### BEGIN find any custom field labels ### +$label_title = 'タイトル'; +$label_first_name = '最初'; +$label_middle_initial = 'MI'; +$label_last_name = '最後'; +$label_address1 = '住所1'; +$label_address2 = '住所2'; +$label_address3 = '住所3'; +$label_city = '市町村'; +$label_state = '都道府県'; +$label_province = '都道府県'; +$label_postal_code = '郵便番号'; +$label_vendor_lead_code = 'ベンダーID'; +$label_gender = 'Gender'; +$label_phone_number = '電話'; +$label_phone_code = 'ダイアルコード'; +$label_alt_phone = '代替電話'; +$label_security_phrase = '示す'; +$label_email = 'メール'; +$label_comments = 'コメント'; + +$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +if (strlen($row[0])>0) {$label_title = $row[0];} +if (strlen($row[1])>0) {$label_first_name = $row[1];} +if (strlen($row[2])>0) {$label_middle_initial = $row[2];} +if (strlen($row[3])>0) {$label_last_name = $row[3];} +if (strlen($row[4])>0) {$label_address1 = $row[4];} +if (strlen($row[5])>0) {$label_address2 = $row[5];} +if (strlen($row[6])>0) {$label_address3 = $row[6];} +if (strlen($row[7])>0) {$label_city = $row[7];} +if (strlen($row[8])>0) {$label_state = $row[8];} +if (strlen($row[9])>0) {$label_province = $row[9];} +if (strlen($row[10])>0) {$label_postal_code = $row[10];} +if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];} +if (strlen($row[12])>0) {$label_gender = $row[12];} +if (strlen($row[13])>0) {$label_phone_number = $row[13];} +if (strlen($row[14])>0) {$label_phone_code = $row[14];} +if (strlen($row[15])>0) {$label_alt_phone = $row[15];} +if (strlen($row[16])>0) {$label_security_phrase = $row[16];} +if (strlen($row[17])>0) {$label_email = $row[17];} +if (strlen($row[18])>0) {$label_comments = $row[18];} +### END find any custom field labels ### + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) + { + echo "無効 ユーザ名/パスワード: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +echo "\n"; +echo "\n"; +echo "\n"; +echo "ViciDial 注"; +echo "\n"; +echo "\n"; +echo "\n"; +?> + +\n"; +echo "\n"; + +if ($process > 0) + { + #Update vicidial_list record + $stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + #Update the agent screen with new data + $stmt="UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='vendor_lead_code,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,phone_code,phone_number,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + + if ($notesid < 100) + { + # Insert into vicidial_call_notes + $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + $notesid = mysql_insert_id($link); + } + else + { + # update vicidial_call_notes record + $stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $affected_rows = mysql_affected_rows($link); + } + + echo "
Data Changes Accepted

"; + } + +$URLarray = explode("?", $PHP_SELF); +$URLsubmit = $URLarray[0]; +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+> + + + + + + + + + + + + + + + + + + +
: *
: *
: *
:
:
: *
: + *
: *
: *
Order ID:
Appointment Date/Time: + + + + + + + +
Appointment 注:

+
Please click 送信 to commit the changes,           * denotes required fields
+
+ + + + +
+ + +
+ + + + + + + + + + diff --git a/LANG_www/agc_jp/vicidial.php b/LANG_www/agc_jp/vicidial.php new file mode 100644 index 00000000..67939eda --- /dev/null +++ b/LANG_www/agc_jp/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 "今、ログアウトしています。ありがとうございました。\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 オンhold count +$agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count + $campagentstatctmax = '3'; # Number of 秒 for campaign call and agent stats +$show_campname_pulldown = '1'; # set to 1 to show campaign name オンlogin pulldown +$webform_sessionname = '1'; # set to 1 to include the session_name in webform URL +$local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server +$clientDST = '1'; # set to 1 to check for DST オンserver for agent time +$no_delete_sessions = '1'; # set to 1 to not delete sessions at logout +$volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels +$PreseT_DiaL_LinKs = '0'; # set to 1 to show a ダイアル link for Dial Presets +$LogiNAJAX = '1'; # set to 1 to do lookups オンcampaigns for login +$HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" +$hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon 顧客を停止させる +$LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout +$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$DefaulTAlTDiaL = '0'; # set to 1 to enable ALT ダイアル by default if enabled for the campaign +$AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option +$disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen +$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link オンthe agent login screen +$conf_check_attempts = '3'; # number of attempts to try before loosing webserver connection, for bad network setups +$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, 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'; + +# 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 = 'ベンダーID'; +$label_gender = 'Gender'; +$label_phone_number = '電話'; +$label_phone_code = 'ダイアルコード'; +$label_alt_phone = '代替電話'; +$label_security_phrase = '示す'; +$label_email = 'メール'; +$label_comments = 'コメント'; + +$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +if (strlen($row[0])>0) {$label_title = $row[0];} +if (strlen($row[1])>0) {$label_first_name = $row[1];} +if (strlen($row[2])>0) {$label_middle_initial = $row[2];} +if (strlen($row[3])>0) {$label_last_name = $row[3];} +if (strlen($row[4])>0) {$label_address1 = $row[4];} +if (strlen($row[5])>0) {$label_address2 = $row[5];} +if (strlen($row[6])>0) {$label_address3 = $row[6];} +if (strlen($row[7])>0) {$label_city = $row[7];} +if (strlen($row[8])>0) {$label_state = $row[8];} +if (strlen($row[9])>0) {$label_province = $row[9];} +if (strlen($row[10])>0) {$label_postal_code = $row[10];} +if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];} +if (strlen($row[12])>0) {$label_gender = $row[12];} +if (strlen($row[13])>0) {$label_phone_number = $row[13];} +if (strlen($row[14])>0) {$label_phone_code = $row[14];} +if (strlen($row[15])>0) {$label_alt_phone = $row[15];} +if (strlen($row[16])>0) {$label_security_phrase = $row[16];} +if (strlen($row[17])>0) {$label_email = $row[17];} +if (strlen($row[18])>0) {$label_comments = $row[18];} +### END find any custom field labels ### + +$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: 再ログイン\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" 再ログイン
 
電話ログイン:
電話パスワード:
ユーザログイン:
ユーザパスワード:
キャンペーン: $camp_form_code
  \n"; + echo "

バージョン: $version       ビルド: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + +if ($user_login_first == 1) + { + if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) ) + { + echo "Agent web client: キャンペーンログイン\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + #echo "\n"; + #echo "\n"; + echo "

ユーザログイン

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" キャンペーンログイン
 
ユーザログイン:
ユーザパスワード:
キャンペーン: $camp_form_code
  \n"; + echo "

バージョン: $version       ビルド: $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 " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" ログイン
 
電話ログイン:
電話パスワード:
ユーザログイン: /
ユーザパスワード:
キャンペーン: $camp_form_code
\"   \n"; + echo "

バージョン: $version       ビルド: $build
\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + } + } + } + +if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) ) + { + echo "Agent web client: 電話ログイン\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\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\" phone login
 
電話ログイン:
電話パスワード:
  \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) 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 = "最初にタイムクロックにログインしなければなりません。
"; + } + } + ### 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 = "エラー:あなたのユーザグループに有効化されたシフトはありません。
"; + } + 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 = "エラー:あなたのシフトの外部にログインすることは許可されていません。
"; + } + } + if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) ) + { + $VDdisplayMESSAGE.= "

マネージャー優先:
\n"; + $VDdisplayMESSAGE.= "
\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "\n"; + $VDdisplayMESSAGE.= "マネージャーログイン:
\n"; + $VDdisplayMESSAGE.= "マネージャーパスワード:
\n"; + $VDdisplayMESSAGE.= "
\n"; + } + } + ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR + + + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|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: キャンペーンログイン\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "Sorry, you are not allowed to login to this campaign: $VD_campaign\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ログイン: \n
"; + echo "パスワード:
\n"; + echo "キャンペーン: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + ##### check to see that the campaign is active + $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01009',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $CAMPactive=$row[0]; + if($CAMPactive>0) + { + $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("/保留_/",$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 = "キャンペーンがアクティブではありません。再度試してください。
"; + } + } + else + { + if ($WeBRooTWritablE > 0) + { + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); + fclose($fp); + } + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "ログインが間違っています。再度試してください。
"; + } + } + if ($VDloginDISPLAY) + { + echo "Agent web client: キャンペーンログイン\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "

$VDdisplayMESSAGE

"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" キャンペーンログイン
 
ユーザログイン:
ユーザパスワード:
キャンペーン: $camp_form_code
  \n"; + echo "

バージョン: $version       ビルド: $build
\n"; + echo "\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + $original_phone_login = $phone_login; + + # code for parsing load-balanced agent phone allocation where agent interface + # will send multiple phones-table logins so that the script can determine the + # server that has the fewest agents logged into it. + # login: ca101,cb101,cc101 + $alias_found=0; + $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01018',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_found = $row[0]; + } + if ($alias_found > 0) + { + $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01019',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_name = $row[0]; + $phone_login = $row[1]; + } + } + + $pa=0; + if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) + { + $phoneSQL = "("; + $phones_auto = explode(',',$phone_login); + $phones_auto_ct = count($phones_auto); + while($pa < $phones_auto_ct) + { + if ($pa > 0) + {$phoneSQL .= " or ";} + $desc = ($phones_auto_ct - $pa); # traverse in reverse order + $phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')"; + $pa++; + } + $phoneSQL .= ")"; + } + else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";} + + $authphone=0; + #$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; + $stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01020',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $authphone=$row[0]; + if (!$authphone) + { + echo "Agent web client: 電話ログイン Error\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "


"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\"VICIdial\" ログインError
 
すみません。あなたの電話ログインとパスワードはこのシステムでアクティブではありません。再度試してください。:
 
電話ログイン:
電話パスワード:

バージョン: $version       ビルド: $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 オンthis campaign + if ($allow_closers=="Y") + { + $VICIDiaL_allow_closers = 1; + echo "\n"; + } + else + { + $VICIDiaL_allow_closers = 0; + echo "\n"; + } + + + $session_ext = eregi_replace("[^a-z0-9]", "", $extension); + if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);} + $session_rand = (rand(1,9999999) + 10000000); + $session_name = "$StarTtimE$US$session_ext$session_rand"; + + if ($webform_sessionname) + {$webform_sessionname = "&session_name=$session_name";} + else + {$webform_sessionname = '';} + + $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01029',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01030',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + if ( ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) + { + ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly + $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01032',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $prev_login_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $prev_login_ct) + { + $row=mysql_fetch_row($rslt); + $session_id =$row[0]; + $i++; + } + if ($prev_login_ct > 0) + {echo "\n";} + else + { + ##### grab the next available vicidial_conference room and reserve it + $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null));"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01033',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_conferences set extension='$SIP_user', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01034',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and ( (extension='$SIP_user') or (extension='$VD_login') );"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $session_id = $row[0]; + } + echo "\n"; + } + + ### mark leads that were not dispositioned during previous calls as ERI + $stmt="UPDATE vicidial_list set status='ERI', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $vlERIaffected_rows = mysql_affected_rows($link); + echo "\n"; + + $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01037',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $vhICaffected_rows = mysql_affected_rows($link); + echo "\n"; + + $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01038',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $vlaLIaffected_rows = mysql_affected_rows($link); + echo "\n"; + + $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01039',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $vliaLIaffected_rows = mysql_affected_rows($link); + echo "\n"; + + ### insert an entry into the user log for the login event + $vul_data = "$vlERIaffected_rows|$vhICaffected_rows|$vlaLIaffected_rows|$vliaLIaffected_rows"; + $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group,session_id,server_ip,extension,computer_ip,browser,data) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group','$session_id','$server_ip','$protocol/$extension','$ip','$browser','$vul_data')"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01031',$VD_login,$server_ip,$session_name,$one_mysql_log);} + + # echo "You have logged in as user: $VD_login オンphone: $SIP_user キャンペーンへ: $VD_campaign
\n"; + $VICIDiaL_is_logged_in=1; + + ### set the callerID for manager middleware-app to connect the phone to the user + $SIqueryCID = "S$CIDdate$session_id"; + + ############################################# + ##### START SYSTEM_SETTINGS LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages,queuemetrics_loginout,queuemetrics_addmember_enabled,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 新 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 オン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: キャンペーンログイン\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "すみませんが、このキャンペーンへのホッパーにおける見込み客がありません。\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ログイン: \n
"; + echo "パスワード:
\n"; + echo "キャンペーン: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + if (strlen($session_id) < 1) + { + echo "Agent web client: キャンペーンログイン\n"; + echo "\n"; + echo "\n"; + if ($hide_timeclock_link < 1) + {echo " タイムクロック
\n";} + echo "\n"; + echo "\n"; +echo "\n";echo "\n"; echo "
English 日本語
\n"; + echo "Sorry, there are no available sessions\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "ログイン: \n
"; + echo "パスワード:
\n"; + echo "キャンペーン: $camp_form_code
\n"; + echo "   \n"; + echo "\n"; + echo "
\n\n"; + echo "\n\n"; + echo "\n\n"; + exit; + } + + if (ereg('MSIE',$browser)) + { + $useIE=1; + echo "\n"; + } + else + { + $useIE=0; + echo "\n"; + } + + $StarTtimE = date("U"); + $NOW_TIME = date("Y-m-d H:i:s"); + ##### Agent is going to log in so insert the vicidial_agent_log entry now + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01050',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); + echo "\n"; + + ##### update vicidial_campaigns to show agent has logged in + $stmt="UPDATE vicidial_campaigns set campaign_logindate='$NOW_TIME' where campaign_id='$VD_campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01064',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VCaffected_rows = mysql_affected_rows($link); + echo "\n"; + + if ($enable_queuemetrics_logging > 0) + { + $StarTtimEpause = ($StarTtimE + 1); + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimEpause',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEREASON',data1='LOGIN',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 秒 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';} + + +################################################################ +### 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('1月','February','3月','4月','5月','6月', + '7月','8月','9月','10月','11月','12月'); +$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 +
+
+
+
+ + + + + +
+ + + + + ユーザとしてログインしました + ring)";} + echo "  キャンペーンへ: $VD_campaign  \n"; + ?> +     + + 0) {echo "領域     \n";} ?> + 0) {echo "グループ     \n";} ?> + ログアウト\n"; ?> +
+
+ + + + + + + 0) + {echo "\n";} + ?> + + + +
MAINSCRIPT\"FORM\"  LIVE   セッションID:    ライブの電話
+
+ + +

Agent Screen
+
+ + + + + + + + + + + + + +
+
\n"; + } + ?> + + ステータス:
+
+ 次の番号をダイアルする
+ + + 見込み客プレビュー
+ 代替電話ダイヤル
+ + ファイルを記録する:
+
+
+ IDを記録する:
+
+ + 記録を開始する
+
+ ウェブフォーム
+ 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"; + } + + + ?> + +
+
+ +
+
+  
+  
+ + +
+ + + + + +マニュアルダイアル       高速ダイヤル
+
+ + +
+
+ + +コールログを見る
+
+ + +     + + + +
バージョン:   ビルド:     サーバ:              
+ + 会議コールチャンネル情報を表示する +

 
+
+ 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"; + } + else {echo "
\n";} + ?> +

 
+
+ +
 列になっている電話:  
 
+ + + 0) + { + if ($view_calls_in_queue_launch > 0) + {echo "列になっている電話を隠す\n";} + else + {echo "列になっている電話を示す\n";} + } +?> + + + +X 有効なコールバック
+
+ +
  +他のエージェントのステータス:  
 
+ +$webphone_content\n"; + } +else + { + echo "
  + Web 電話:  
$webphone_content
\n"; + } +?> + + +
エージェントビュー +
+ + + +
  Web電話 View -
+ + + + + 0) + { + echo "ダイヤルできる見込み客:
 \n"; + } +?> +
+ + + + +
\n";} + ?> +
AGENT SCRIPT
+
+ + +再読み込み + + + +
\n";} + ?> +
+
+ + +再読み込み + + + + + + + +
+ + + トランスファー-会議            
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + ローカルクローザー     + + Xferラインを停止させる +
+ seconds +   + channel + + 助言に関する   + + 両方のラインを停止させる +
+ 電話番号 +   + +                     + +   + + エージェント + + + + + ダイアル優先 + + 3方向の電話から出る +
+ ブラインドトランスファーをダイアルする +   + 顧客とダイアルする +   + 顧客ダイアルを保留する +   + + プリセットボタン + + Contacts Button + + + D1 + D2 + D3 + D4 + D5 + + +   + Blind Transfer VMail Message +
+ +
+
+
+
+ +
+提供されているエージェントの転送:
+ + + + + +
として配置された見込み客:

+ -
+
+
+ + + + + + + +
ホットキーを配置する: + アクティブな時は、この電話に対して希望する配置のキーボードのキーを単に押してください。電話はその時切れ、自動的に配置されます。:
+ + + + + +
+
+ + + + + + + + + +
前のコールバック情報: 閉じる
+
+
+
+
+ +
+
+ + + + + + + + + +
拡張された代替電話情報: 最小化
+
+
+
+
+ +
+
+ + + + + +
最大化
Alt 電話 Info
+
+ + +
誰もあなたのセッションにいません:
+ 戻る +

+ 再度エージェントに電話する +
+
+ + +
顧客が電話を切りました。:
+ 戻る +

+ 電話を終え、配置する +
+
+ + +
まとめを呼び出す: 秒がまとめに残っています。

+ +

+ まとめを終え、続けてください。 +
+
+ + +
+


+ メッセージを閉じる +
+
+ + +
あなたのセッションは無効になりました。
ログアウト

戻る +
+
+ + +
あなたのシステムとは時間の同期化の問題があります。システム管理者に連絡してください。


戻る +
+
+ + +

ログアウト
+
+ + +
+
+ + +
 
+
+ + +
今回以下の顧客情報の変更は行われません。電話を切る前に顧客情報を変更しなければなりません。.
+
+ + +
コールを配置する :       再度、電話を切る       最小化
+
\n";} + ?> + + + + End-of-call配置の選択 +
+ エージェントダイアルを一時停止
+ クリアフォーム | + 送信 +

+ ウェブフォーム 送信 +

  +
+
+ + +
電話のかけ直しの日付を選ぶ :
+
\n";} + ?> + + + 以下の日付を選ぶ   +     + Hour: +   + Minutes: +   + +  
+ マイ・コールバックのみ
";} + ?> + CBコメント:

+ + 送信

+ +

  +
+
+ + +
エージェント用のコールバック :
以下の1つのコールバックにある情報を見るには、情報リンクをクリックしてください。今、顧客に電話をかけ直すためには、ダイヤルリンクをクリックしてください。電話するために以下の記録をクロックすると、それはリストから削除されます。. +
+
\n";} + ?> +
+
  + 再読み込み +                 + 戻る +
+
+ + +
のための新たなマニュアルダイアルの見込み客 :

電話したいと思う新たな見込み客に対しては以下の情報を入力してください。. +
+ \n"; + } + ?> + 注:全ての新たなマニュアルダイアルの見込み客はリストに入ります。

+ + + + + + + + + + + + + + + +
ダイアルコード:   (これは通常、米国とカナダでの1です。)
電話 番号: +   (電話番号のみです) + + + +
既存の見込み客を検索:   (このオプションがチェックされてる場合、新たな見込み客としてそれを挿入する前にシステム内で電話番号を見つけようとします。)
+

+     +
+

番号をダイアルしたいが、新たな見込み客として追加したくない場合、以下のダイアル優先欄に電話したいと思う正確なダイアル文字を入力してください。この電話を切るには、画面下のこのセッションリンク内の電話を開き、そこのチャンネルリンクをクリックし、電話を切らなければなりません。.
 
ダイアル優先:   (電話番号のみです) +
+
+ 今、ダイアルしてください +                 + プレビューコール +                 + 戻る +
+
+ + +
クローザー内部向けグループ選択
+
\n";} + ?> + クローザー内部向けグループ選択 +
+ 0) and ($disable_blended_checkbox < 1) and ($dial_method != 'INBOUND_MAN') and ($VU_agent_choose_blended > 0) ) + { + ?> + 混合コーリング(外部向けが有効化)
+ + リセット | + 送信 +



  +
+
+ + +
領域選択
+
\n";} + ?> + Territory Selection +
+ リセット | + 送信 +



  +
+
+ + + チャンネル + チャンネル + マイ・コールバックのみ
";} + if ( ($outbound_autodial_active < 1) or ($disable_blended_checkbox > 0) or ($dial_method == 'INBOUND_MAN') or ($VU_agent_choose_blended < 1) ) + {echo " 混合コーリング
";} + ?> +
+ + +
      電話ログ表示:             閉じる [X]
+
\n";} + ?> +
Call log List
+

  +
+
+ + +
      連絡先の検索:             閉じる [X]
+
\n";} + ?> +

+ 注:連絡先を検索する時は、ワイルドカードや部分的な検索用語は許可されません。.
連絡先検索依頼はシステム内で全て記録されます。. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Office Number:
最初 Name:
最後 Name:
BU Name:
Department:
Group Name:
Job タイトル:
Location:

送信 検索             リセットフォーム
+

  +
+
+ + +
      連絡先検索結果:             閉じる [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      見込み客を検索:             閉じる [X]
+
\n";} + ?> +

+ 注:見込み客を検索する時、電話番号、見込み客IDまたは 使用するのに最も良い欄.
他の欄を使用すると遅くなる場合があります。見込み客検索はワイルドカードや部分的な検索条件は居されていません。.
見込み客検索依頼はシステム内で全て記録されています。. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
電話 Number:
電話 Number Fields: + 主電話番号 + 代替電話番号 + 住所3電話番号 +
Lead ID:
:
:
:
:
:
:

送信 検索             リセットフォーム
+

  +
+
+ + +
      検索結果:             閉じる [X]
+
\n";} + ?> +
Search Results
+

  +
+
+ + +
      電話メモログ:             閉じる [X]
+
\n";} + ?> +
電話メモリスト
+

  + 情報BOXを閉じる +
+
+ + +
      顧客情報:             閉じる [X] +
+
\n";} + ?> + Lead Info +

  + 情報BOXを閉じる +
+
+ + +
一時停止コードを選んでください:
+
\n";} + ?> + 一時停止Code Selection + +

  +
+
+ + +
プリセットを選ぶ :
+
\n";} + ?> + Presets Selection + +
+
+ + +
グループエイリアスを選んでください。 :
+
\n";} + ?> + グループエイリアス選択 + +

  +
+
+ + +
アラート :
+     +

戻る +
+
+ + + + +
+ + +
+ + + + + + +
+ +
+ + + + + +
+   エージェントアラート! +
+ + + + + + +
  +

+alert +
  +

+ + アラート + +

+
+ +
  + +
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/LANG_www/agc_jp/voicemail_check.php b/LANG_www/agc_jp/voicemail_check.php new file mode 100644 index 00000000..028ffa1b --- /dev/null +++ b/LANG_www/agc_jp/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 "無効 ユーザ名/パスワード: |$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"; + 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 "無効 session_name: |$session_name|$server_ip|\n"; + exit; + } + else + { + # do nothing for now + } + } + } + +if ($format=='debug') +{ +echo "\n"; +echo "\n"; +echo "\n"; +echo "ボイスメールチェック"; +echo "\n"; +echo "\n"; +echo "\n"; +} + + $MT[0]=''; + $row=''; $rowx=''; + if (strlen($vmail_box)<1) + { + $channel_live=0; + echo "ボイスメールボックス $vmail_box 有効ではない\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/UPGRADE b/UPGRADE index ee712628..cdad4714 100644 --- a/UPGRADE +++ b/UPGRADE @@ -69,6 +69,8 @@ OTHER CHANGES: 5. Added Safe Harbor Audio Field to campaign options which allows for a lead field to be used as an override safe harbor audio on a per-lead basis +6. Added Japanese agent web interface translation + diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt index 687e3f54..d76d7613 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt @@ -18,6 +18,13 @@ DIAL IN-GROUP|| Dial In-Group|| Click Here to Activate|| Click Here to Deactivate|| +ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name|| +ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name|| +ERROR: There was a problem with your search terms|| +Phone and Post Code Time Zone Mismatch|| +Last Local Call Time|| +Called Count|| +Unidentified Hangup Cause Code|| ############################################################ MANAGER Manual diff --git a/www/agc/images/agc_live_call_DEAD_jp.gif b/www/agc/images/agc_live_call_DEAD_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f5d46a358b865787b1ea64f243caf7e6da56e53 GIT binary patch literal 2569 zcmd5-X+Tp~7JhlzLu404P+x*#K$E+QO92rj3lXAZF^Ld_pfis3FzM!cI;SveSK|hZFhHfTU%RKS65S0Q%y~c*=%lYZHuxF2M4F6rJ>R2Y15{)x3_~J=;!B`l9Ezg zUCrn76g>cDsGqvSp2pjSUSAFbpdciqOzdwOUgqTgPHb!}fj|ff3Su&uV}NT64Gq0n|1T!em|I4I7!pbi zQs){y�BkS1AmTOp&Wp$B>_#=q5wToEUO?L;{?k6)5tQ3)bosDQgo`j z5{4ofG)7psGj($yCd`28Fq6(;QW-2x7?T6T(7Qo)qUmy0aFT_hcUaC{3^~tW&~oVX z!oosYVHi!L%cV2eY_>}WlSy@QQ1wM>gVab>>x0HM2o-v{PN_90HEPJEQ7Y4{F~pFa zmcDgCrAW;p*Qn@5sg};5!E}|%<<}c-y&+lgZ!kBEuQ%IG7<4M2+kCkgO<7z-EN;1Ok}NWH90wY!Ocw2eTP`ClMux6OPNq ztMvw{TCNz!RXTCs$@2eDmLt$9qy~*HRinutuK;nL#-P#XX|#|aB?3xUs&h1jdRKDZ z`YKfDlm&_$kxrw6-b9z9`~W&XE{eg5jN`GH|IO>SvN``t#OO|A=&sWEk5U;wa@L=V zd|&v^&HL6-sGa?yb2bKI?Dg-z{rc+VFF(Kd>G`wKrz21P`S>3{{_yDG-yht+clXY1 z$M?gxZvO4BH?Cj1`j!U|H zzOo)Z^yL@rpC3H%S=;{BeS2G)_w3%)w6pQk9Sz&-w{5N4VyWF+vuR`X2J`x=b(Iz6 zWu{L`|5Q@Ew#Zmmu*RU*t=4MPs{B1iM~GGUY;KA6NqjEJPwONqmUp107x%U&N&H~<9h2{FFt@BGbNQ*RIaO9Z{AS7 zaZ}CaTFaKYt=sCiH|+Sdu?7L4-9gYD4Iq+s?P=M!zw$uy-qtn?f(3BU9DvoaWfyh= z28Tr9`%j~gI5(;n)y>{_n!t~mPT{emz0fT5%(!?01L^5E(|QcV#1IHE7!WX@vR%Xz zyuAr{PcQe;I(4AgcDDyJ5t^)Z*ti&+*WB1jGY=A(J?08c8TK;FMt3p)s$@g}f++7& z6TmF5^zaWAr$Sc9w-P%m{LF|%!1pM|TS(6Th>Io@lTX5Bhzh))Pa*}@a+6I+%nT#o z-O+x{LK7{{U`i`D9?lcgbxQ8p%}2#!X&0}PdQ4?l-(mhEM}=xB#wVC^36KxqCkDc{ zb)$A90#OGXJ+oTcf9G7oo@l(Xyf6KHc3Ja7hOGimX%@(=n+p0b4~g?q&CnyRw-+hm z$KmrQWXw6Nn|63+`DZ z&n%R^^E(`6C52D!cd0+=HqI@4`qO%!5c?08K*Hedfxvd0LV^I&4LSC##%#0LD(MA* zh|4zQd=sv56KZYLzT#^)SU1N?ZmsJxfgiJV07@vyow_BGxum&nM){fB#>M#;Z9xDI zu9QvMojY@D_LLAw)dboSN4amt$bwmnhxL+%mnzDvs^tle-km1z#v4ZF9M7{r2=pzf zE=Y~fO^?Vo@%Op8`{!;P#vdr#Yk6+TYFoYi^Q=12g(4xEFV?1M4!jC(HHBWsQ`x1np_8>I2>7d>Oa6l{xv##vsydO5T*zW-gjpQuKv|#B8wx zNwK5yuT-z_?FVOzO-Q0c_A7vjtF$3L+f~rqN8HhNquvc(;K{2^=6iy~tA`$~SOulR zHsmc@q#ch8*P6!A9_A5n#S9}<2?n6>>DbUd2@eqxnfw4mmB2{Pyvz;T-Dn1rkN{Vj zxcI^(u^=;8JYqtig$OPld7WG4O*{|SQ6W|vhz#(Q0K7=pQ=cCDn?;DHEWN)0>BZ%8 zakFe%1P&U~mfc1iUc(Nq zTQp^a>;CE<+=mU29C?P|oen;*sq}UrIJ)m2L( KUX}sC+>cXkcWhudhFI=8WQh?g-xi1((Eh+i z#(Mch>H3D2mX;thjEr=FDs+o0^GXscbn}XpVJ5hw7AF^F7L;V>=P7_pOiaozEwNPs zx)kDt+yY-;xWReFdSDOfCFkerS0onb8|oS8=jMX^1y)^L5|oN?23FO@A(aKG`a!A1 z`K3k4sX*n*FwMZQ!*3BtA<#8e{zaLQ# zzd*q`*i<1rGcP5-yciTY5Wl*l7G;*DrnnX5=PH0h*D4d6?G}W54bhuIPKfCP9itCQ z8c0b6CIn1>ASOKF13B=llbQ$2FGawN!TA5*-#@>9{rvI$+t)9jKYjf0{@vR*uV1}< z@%-7-CyyUJd~pBX-8;8$-Mn%A+SMzUFI~KF{@mF!r%#aDv3%LmC5sm=Trhv$+&Qyn&73iP+SDnNCrzBt-`CsI z-PPIA-qzaE+|<}mUsqdGT~%38URGLCTvS+)pO>4Hot2r9o|c-DoRpXl9~T=F9Tgc7 z9u^uB926Mf@8|2|?d9p=?&j*^?BwWRZ)a;`ZDna;Zf0s?Yy`}ddb&E=TACW_YN{&A zN{R~danZ8R_KYR8UYrCX@aB{oUN$KoATL4o*!??djjE;`t zt2EJ!$EQDMKq^HvV|8c}oTL+>O4W+ZdNh4= za)x|!p`52+ERTVrOnj4Cr$#XuWKtJt417~GL#EK?qkMdB*=94Kmk_Klnh|R`fGnCK ztsaF!Suj%$hrv)7!a}$q;o;%I5C=wJHq2oo93~RZ=W_Tk4E_2sa5cT6fS)Fo{Hleo zq8UmI)A8Bt;^JafF_)#)uV*7X9?xQf!(rkGrlCZG$xKX*!FR!e7&XZCDjlZMY9Nb6 zS-#eYMKf?uUxlF7B_+K!tTC`&2E>wU)ohbY$3|E%TdlUl^%8Bs($N37@kX>EqeO?Y z(@=xfsF$NS+;@SD-`#HuS%A1V{I~Tg{83~@Vy)b$Mm1Q1IGTZ$(9xjTA zi-1LN9D*Q1F;^mzgoPlyI2e(LA{K1Ci5nUcfe3{noXLX`Bo5(mxI76G%R_`bNtiG! zbb*_oF<>%{99_^=;kvK5LdkD(`64|k!?gMgt+r?(15%V)OlweTb&x1M6k4s)D73`} z%j3L?RgCIYn^1*BuT?`YZ0%fEj9>BaMBKmPFa$v@|2XCD9K(ZlZ_Oy9rv-Q7F4Z+-jC&A5xo&NJ@y{CFk{^`>bf9yWq z^~tf1JCAmJbmVaRhaa@H{^8KU_gmg;e)mAr{(X(+hP`|0ch}X{ytAu%XVs3%it@7U z+qRZ&*<4~O-eklK`i(lRMqO06L8V+@fGXtqvb@}!b=hmP)<{?XJ~JadEj8usLVXRh+~zg8+@35W=!4)n}L=J(Aix|B#YX56Im^tfqwdKZ)*K+`(=l-ZeA_= zc2=2ArB)Gy{wo}9h}MK;hL@ccy{5L-%5K9_fM5+;ft6JO1gc9NjpzUrrGwI}Y+Dk= zg;v)^bD=moeoS+xc{m^Is;Rg2BY=HfAfaK)xvB2YZ~JSc>t zp!?agWq0}}Xym;N2b;@Z&(6|q90JXYYA5I*Y1h5W?Mpp@CF7p~j#R(K^C>>QJ1==A z+s~Bkh%~uOPX>X*<*{{iZ(E`}{7uzHXZrjyGgW;p#@uz}Oh$WKnR6hOwYTqF+zvl$ z`zM*{*!01noh)ulRL!E>ebrrzh-b$8^ikrTD6FmNs@I#)lU_BFI0eT$AR( zbsD_pc;i-{;KaUKx6&YZ&U;PUPrrOIaWACx>;dXQ&gHeUx2~1AcHS7C3Ub)DecO7+ z`reS4tdnqPWZLa#v;AMzxH6$T6U{B4XNBJF`pHd+%~h^#o2HivDswl2cKv6X1pzcO z#c^?8Hh0uMmPX6L$}5tbs$&8k)tPPruI3kE)mcraFA=k=xHZ|W#umVnF_OIU^bbF7 zA^DNxzf?PEx$Th@Dz zDuMXxqo>wbQ{CYKLhrE%uc}WFvXo5-8A#f2u-q+g*MzM!4e7xM;T`2zB-0Ei>+w zVR!CM-fh~@G*bpEWqIFiWVpj?EBt;=2mqU&w~y^Eamn;01?nC)qPr9p`1f`eB=|euH?u%W$iRipymeD?VGeP_ OJU8NZ;C&Gpi2OI~KL$+z literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_customxfer_OFF_jp.gif b/www/agc/images/vdc_LB_customxfer_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..8d1c522dfa8a95246631e25d5843e40d82379151 GIT binary patch literal 2033 zcmb_cdstIt7#}jZnWdDK7li zWiUkU2ws4^Us9+Hav~yQf^tb9CZ>5ot?E>Unzl{`ju%@ArG(?|a`bAW+KV z%W_E5NM;ggaB#4_y*(u*rMI^if}pOhu8xily*VNS1-QC^U*?Il?^{A+* zii(P?tSqrutWv4^`ub{XYa=2ebUIyse?Obe&dki@a5(k#^*%m6zP`Q<4Gk8H#cVbw zCnxvx^q5R05{cB-)<*RIV{;puvLYx1kjQWuG5Rjlsbx?sj04ed41x+NcTUw)07NdN zM6iRvAhj4)B8w6=a9Cn+IFuL*@#U0-3jkl8K&MixU|a_1RBKVKKqsWg z1_c;5!DEFKk@WzuYKk!p46x}S4FWkJz+uvvUfx_T*ArlYOppPx7)%z8$rX691Rw}J zYZO9FBUcDQCDLbF#7am};<#GCV8qAA)8oD9m?nn7SkSZyC@#~{P_6p} zg9O$>8bpmF7z$V!WzpC=Tu322eHwyF9TfDO7}e6p1ENEiilLLK8B99JP^qkOjazH+ zQ1~x5UTCciPf){*P*{tt(?Bp`?mht~?(Uz3tcHX)f~6XScof-M2?niG!6+Um5mJZ~ zx*U-UL~IF{E9Uw0Kr!ggWHS9EUQ)4?q>P15ohRxWM(LWwP8u|UVUmrfWKYZ`*o!h_My7}{sq3f2xp9cE- zuKn2C)7^FTN@vGqbGxbSQtQQ*3(e<^=YD8v{Qm5B-+t3jf9CYpr%s+Ye(dOx!-o!j zRaaYcVE?|o)m3{cE6U4CONxtj7w#%B49+(yXbf0d`TxBi$UyRnANcg5ss3rPdh zPlU6!2M&cAG8U8sLr0a%6sNloFBj?NLW_6gJf~G2rK!r`+OC_!KEm3j-|i$Otxwq) zN7Zh!-IDfsW=h6n8%N4yJHW;UFcj=6%qu7=)En}t`Nd_WyYlm><$HEfEBD&e?B89Z zKXIh0dT;sZ>XPDDoTt2GGsozDzS(&3VvBoo%bfPhokptZ($#}MQd>K^I!yzEX46k| zuARSi+kEL>_we9d%LS8@BYEe!{)Y!IowsY?-s!DQi^G)nx}@mMHoiRW1DP?#`QGZZp;njEV@2Glex57*L_a`d zap|@O=c15Up?TzwnXgtJ&kxypW=ceuVadLs%16xsIABa3T~tFYsJmfIus=jQi^QGv z-y;0VOtn9>y5#`PG4ZuqaeD$`Wx$iPW9=&F_#I00jw6?APNl?W%Z=`N$ zu$x_+SDHTi@bS`Zo@X2e?7WSglx=e_5A|mWhO448y(c9=**>o)K6jxwcVJN>;7 z5!qFJZBLQwgDdaYr#=~pDc&;9>@>Ho2L$G#l?(p%WOd)n^*PyheF_dnDnv?I6U z^2*C;L1{CqW;UcXENNbHcjMjv=l{Rm_jXmss#ves|2O~tfBc^TXwDfBi3t?{b4U0F zD7Yk+Bm!w0`-+0ZI4yi0i)elN7&Mz%WP6aAghG_g9{)&z?Sc{OI9>`}gkNxqa*AjqBI0Ub%ef z;)V0)&Yn4a>g0*z$BrI3eCXhT{rmRr*}ZG$j_upFZrQwPBVy z|C z3OugFHXL6xiJgN-i@`C)Yi-o}8#zxFy$#!Wi(A54E%V9$dY4&9t`Z=a+9fQF3g_wT-7P zoSAv<{N<*{hu2)ab-i!fi+y(lo8i-l?zG&C}@^Jrw;J+*c9_4Nsd UyJWq$t+}~5W2c&j026~X00P-~9RL6T literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_dialnextnumber_OFF_jp.gif b/www/agc/images/vdc_LB_dialnextnumber_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..9861d19bc7729db526fbf1e06b36e86f5c325a64 GIT binary patch literal 1867 zcmbVMdt6Lu7@kOk*hMaBIZd+Kt(kLXnr1p?sLnKmE}KXcrkTTxY39tHnVPATnvkwk zN{UKIlrAbX$X%9PH<^f%JF9z%W!p26-9P;7@3-F{-}QOk=Y7BLeZP6GJeC7LnKX`c zfkf)5U__R5Z#W+ zWZD2U5CW+njSA6hAtp?x!5|2HZe&6Y7p{T5xV+C=#EL@}DV1`VN>!;;6cwF<;cKao zgM)+K290J*AZ!&OG9_PaD^pkwTHvAz0WOv+#h47xTjU2|K}rsp@bps%Qn{Pk7sE0I zWgsAm0FzSHd^r`OfK;heAJ+g{q4YxkapS9Kg?ES?rFx+XEC?5%1l)3vOx)eKh4ete z8`uLE6OY0VBa-VSnb0U;j3 z8np2>F2kNnhd_vhfGmRP0y)rG2+sus84M<3PopyjxvnyWk}ngWgSuiu_cNFIO)iY! zC|`-;-WV1*m;s(5Oo=H(m>fVBGXNj4Oo*uz`p5YcD;LGZ!KjdjV^Uz?c46^X)Sc}9 zE9y^N;s3cYD&Y)OpBn#4mBB3{|Mb%@iBBxPlnyE*>IEkX!=V4Kk01Vg|E}+CZ%=nu zXGeQm>zhAbzk2!N`Lm}_9=AMdZhH8j@&3IA-QD^-b-&-fb@RscYqeLe{C2tK(!~qs z&z(JUy86_~6WXfd$BtH3lpiT8Eh#=+RCwrM!GZk!`}XGT$<4{$y(=qoXU2~7wC$-W z$=kLjB__nj#cqk&ylG>!CMt46MELr!&=9pMI7q3$f0bi0X`p1CShRKxDij3pSFc*> z@3&&P?=qjIOS~6*{o?82?zU**0@wNTcrIMT*~xM491eRn?7(8$GwkRzq9`f0Hb4Jl zJ?qDrRx>Qg7QpmrKbTK7n=*OQMAHf5$9@0Z*fA!fM~yTdG2CdF;m{!lB$CBD!+~$c zM&IjyG}5qsV0CPZX!i@({Cv3BX2lfyP3I06E)R5YRksx_^9Yj z=2Me5C&j15CC8=5q;A`to*0vvo4G4fvp+vUV?1ocy2O;t1$&~)_NJJXA1F&nPp#5s z?>$tx>15fyydCGa)ub66o+3%RbTawKwVLDAnZ_o? z&l|H!8~WZ{&N@{7Fn4R6l_2%X_-gm(I!3@mo9rQsmgs3x!%aO5#v8w^*9J}szcz#0VOEg0y*Aw3@Y485hQ&)=z_Vzv09*<`<09{X2Yv2BZ0RV`+YC+d7lwMU+* z5viN#qx!AK*$rNnM~kfuOpIrF=jKLm!rq#;ly7LtuKv*b_VMeSl8EXLJ^iPKPmeV0 zWadVU81kZNU6fJ%^CpeqxwSdbri)5RL(SQxXNDR0o#Dq!+pM$LVv)X#96KX3BQI{| z(HD8~mUv%FEEt**kU+nZAxIeQD7P@2Y-mj~LX5;ulAUM9K1o?X6AP2wdDd2`p0MxJ SWS^Nktq*6Z>A#~rIWZvMZ?z`$_k{}~{O6)67aj_?go za7ipl1kyJ46$OdO*{LN8NvY|XdA3ULckfqH$V{ z%1*XSQL?vFu&J=B$SufCElE_U$j!+swyLmIN=(U5O0@#ALBje<3ScEA*|tiKAPEJK zozD41sS2ig2D-@xW(EpohI)p^Cg$emItoSxh6efuM*4KL?fq0y6ST@{2R_3lyA#O%=j3^HTE5i$ReC@vBQ}QD#|cid#{B zt^zo8tunFL?r1{D*ATra?I;nZU{89wW7>xh_ z{r&U%*Uul{zkU7k`P0V_@87+B^ZM1x7tfzPee(Fx!w2{8-Mw@B*3BE&uU)-z`O?J; z=g*xzbNbZD6UUDoJ#zTa!2|pE?cK9`*UlZ=w{6|BdDF%X>({MavwGFa70Z_`U9x!5 z!Ugl^&7CuQ*322xr%jzQdD6rQ{e8VX-Cdm>?QN|s%}tFB^>wv1)m4=h1nAc$w`R`@o}*+(NU2R;bEa6!9jrm{(inb-d>&_?ryFw&Q6XF_I9>5 z)>f7l=4PfQ#zw$Qsi&)>t);1EF>tv&&SKd&Be*V z&c@2Z%*4pRp!kyoT=*$+Kpc1<7ea-v-2No1~ z=t%WjGb#jR3MgGzQR1~WYW7VKZXech2&r*h^U zTXT8CxyrMvZ$G}Z;&{fj&Wq0`T_}HkY|pxHdsjWZyW!Kz2|X-ZtJ`#>w@2)`a5j2H zzUyzXc^}-~D z4pZw%M`jw!E@<2tX2;D@6y~ycfliS1iY@m|78o+>T{X#Eak%~TGB=;j&?v7JTr0a| zy|=Bo>9|zNMS@}B+S}U;9-o@)y?x!?-4&l--F^M7v5{F^L}G!%jtvhFcL;08o!PPR q@$m`D-exrk2k)~A8D-x)vvc$F^9!82<$QN-d3kxZqyYybgEau>4w@DK literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_grabivrparkcall_OFF_jp.gif b/www/agc/images/vdc_LB_grabivrparkcall_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..424d9b1a47063c9fc7ca2b21bd3a4221d5cc6fe0 GIT binary patch literal 2073 zcmb_cX;f3!77jHd?6qZt_#Z-`)xLZHZ?@IrEd2+55}AYn*Eo=QQq z6%+y@gMk`?HYk;ctC{k^0t5w_D8x-IB;p$tftM|vbXZXJT?Y+<5 zXI(Id!Q>x6IidPcD67?KHk(IAMl>4D@bIueAkb>H{r&xIZEfxC?Ik580|Nu&(nGYp9|T5h&QZFG7)kq{1i4UNEJg8MKIeB zKu+*Nk&qQYV$D;tJZ-eNWaLC#;|+-`)|KKd-~*;$B%yg>BomZeE;D7cT@K!znvH# zv)=vY&gku1BbJ-PLxThTH~P%IJ>6ZM*ROS4{ramb?QN}>|8uFu)O_*6`7h6%J@ZA= z>CYQaooq0EcH(%wp-zA7)7l!{(dw$oiX-KR%SyE+#fJ_S6(0EHxm| z*|d?n;e++TLF+hyY;bMBn$`Y(zCJ7_gHEHaqL7iM#Cv;-O0T}+(S&uZ2kT((=oIN>I&xmqS<#)`Uob)y-MDXw(c;~Fa~)6a zY|Pz`t<#L_e`qX*7k>p`pSQeb%;=JnJ!|g$#$!Cog+otVw_PoL82!cb!k)|O4NNA%Lj2>Fmts{1!v-Ah9}7zK+SN4e*lldohjtsd@& zcml9!gBpJ#Q);}L{q~%vF)s7(^YWDYF8Q2y-WqC*2Q%1{;yXcmv6j|-`J04sow0Vj zkTfkkDo@<4LD%22ykF_Eh|Z4rxO{XE_!7`jDRo!Kw+|fAz@Y((qgQx4FGJBs~bN%(y!^?p6Be%3z z)n|3O!kAsu!19PKC&Nnuc%jQB~h}o%e2w{!3kP!Y+h|?f~F2Cjn5yfDO?bA+cd{H2z99< z>(RF>DrZf(BvtKrBYL88*S!3R>inFpiE6dKqo}%&GpVoM9eaBXdSQy8<=B!eL%{6n zLY6`QY4Ns6y`gY&vc92W@x9}&;36(@7R~aU;bbE-&@$*k=ybA>HqDMwqIU(`TxED zp)R3mL1{~xm&~l1xqI5~yBqKRKmY&jzPGD7R>gY7{(t=c|IPmlKy%K3NKBykpF6@g zK*1%kBoRp4*jE%JCTFLXC?ut(XXe=|z2CiGNg*@ERw>-n*TA>HIW;5GqpB!1xXLdi zxhgx^GDXSWPQj+asv@@_H?<^Dp&~aYuh^=>Rw*$hKPlA;$OZ}PD=C1Llw{i~If5h< zKz2Ik7o{qg>KW)J8<-g=m>KFB8k?A#o9ieT85kPq8yM*u8tEFETNxW!85k%)ffCTR zqLehNAQv~NT|l0#QbtKhft9{~d3m{Bxv^e;QM$gNrKKgv3?n05pbFjM%Dj@q3f;V7 zWta&rsl~}fnFS@8`FRQ;6BCp2OG|8(fG&l2A-BNS7jAG~u^!k%ddc~@`W1-<`i6Q2 z`nkCve}PpOmjtCEoPkw!aY$uBs(w&vaeir0aw<@{GE6ft?C@IzQV4X7m48ttFj5k8 zT=J7kb5rw5JY8&+fHHb1nJHF|hA!sj&K9l~2F?bqhK7btF2-)oZe}KimaYbdZq61k zGqCA3FmW|?$S+WE4mMQ?&&*57FE0i~4#cl6sYRJ(sVQzn z`MC<<(6!3MV!NXeAzwrErjQe2`as9%gOUbPQh^Bp(;tWlPxwF%JnN+90rN`{Fk>+O z|M&OL?_WQEeE;_K%jZuYKfHhU_RZ^8FJC-=_Vmf)M-Ly|zjyb}?OQi*T)%ep%H>NJ zFPuMj_RQ&1Cr=zdcJ#>MLkAD+-?w+q?p-@~Y~QwZ%jQiRH>_W`cFpQlD_1OEwsgtj zMGF_qpEq~T>{&BsOrJJ&%H&BCC-nFA_H=i3cC@#(wlp_2Hq_VE)>KzjR+N{OmJ}Bi z7UbvU=45AOW~8U3rX(jNCd9|Z#zaR&Mudljh6D!%2Kf8=`gnVJdbqo}x;Q&II@sIU z+E`mzT9})eniv}aGo_xcj<%MjhPs-nin5ZTg1nrpjI@-bgt(Zfh_H~L06!lu4>uPl z2Rj=p3o{cV1B2pE7I2ZH10q2s8UyS92Z~`Sne#GMt;>16uRv#Z*aD5Pb?B;7rp(Bew(6?d@{aD#uG-A5n!28eQzy)nU}j=1nKij@+M@o3?kQ7xdY80T zPF>MhHDle9LA>Egpz%XVGa_wdN0qt8yPOFX^d+p-z=FC1L|dfVFD+Y7EcIV3PRGqDJNdUf~o_VxGoH!yR{`Rv&6@Nkv1M8byz g!`9;yl)dNq?A-M9^bF(dduMhQKVju|VqmZa08v|+Gynhq literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_grabparkedcall_OFF_jp.gif b/www/agc/images/vdc_LB_grabparkedcall_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..87a837a4fb7cf8d67f2128137de313fc6b8c7e67 GIT binary patch literal 2046 zcmb_cdstIt7~hnONU0f`l9$7#p()!rV|O5ev&}}~6(LQ)u^rfi?X2zKCIV&U6m@uM zzy^xw##Ie8k&Fmb7$Abmn4nyYkc$`8G%K^BGZgC&pL(92zCXU}@Av-R_xs-WTOt&& zIikIUDFi!#(BI$R*4CDqn%dLTBNmH0J3H&^>y1WZM@L6jS65b6R(pH9)oM*kOY80J zjgF3nVR&$GP%f7<7>uZ>D2v6yWHN__hVt|COG`_utE>I|{Ay}y{QdpycKg72)mjgTzCc;PmK&?_Fjz=&c28oj?0!a5Nt4V-N5jtWZ-%1EPpgIaMoCQXvXRmCGG*jiS}q zO5`s$UWitQZBioCm53TmREZHBP97uUclXai4j}FgcbQ6tKZ+=Uhl&&BhyoMx0!a7? zMIw`MIRYMw1+)2V5C-`W1O@Ya1+aighd6u?62R;+8!zJWXgFBFWWpdDgdje|=0IRD z4dyc-P7sqF95luiD%6-rAx6e@Ww`D$F5@4$Tv&yOFjN(Wq6uReuw05_s9K6D0eBSy zh>$5Hs7CF0oTst!5S45rA`z%iIWT&=T-giMgTQ}_`YBiPUv7+wJ41D(#@|w9Yzxmn z$MkvPO&=}kSD}%kV)fW5s5fPv_3j2a@_}O*SsGQzB+8x$`#9(Ee(C| z-4NkBO9Xr#931p^;9CLyeq0Wl#bnTZX?Rgmd=@WybKwH-H|EbHle~brb7s$a-E-!Q z*QQVNcy;P4QzlP(`6c&>ZWCNxoSnvxBN7N+kDW%ptHqAq@naHPMrs=7KOlMpHi%od z)5jSb4?n!RYi;rBBHHbvg7S5@!>>ltn%b$a#m{n@l^!HrTH4vKs*E~#{mGNfA7kX? zRNc1iA0>X`;uV24Zf5Tp1+t*{e z(|fnM_x?++PHq#X@!(J7!lP_02 ztY0?QU+*#`oN7IKu=4Y^v%*EjA4GK;KWm9Hn!EvwJQk_qF zh7Rnl$fj+5&|LTn+0A9c7U!bm@V*X17@}+G%+N%YVIt3#MSEh;sH-9~le2T6;kw}H zosyk5c-u!{6#iQJH?!`&*v90u+*7-x`6Zs!>=Y6%%(>$ zXB_DF#Pn%5wh%p)fO(f^?F_P>eT7ZdL+LeJ^yDsW-)`nzqd6UJSzy`wuIFj9UN~uu zc@O`4>HOW{;lg=_ne_Vvw;6Q8S)(L#;oBzZzJ)a=po~+HBP(!=+mBi~g$J#EDLhoLAkcToc_l7A&Y_Zb&)0W&61mzH15P=iy?KQEdNmE b`QoDNjUl%R^K`dvn)OK=&Nu}T2!4M8;qf!; literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_grabparkedcall_jp.gif b/www/agc/images/vdc_LB_grabparkedcall_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed4acdd29f29c318affed874a7d74fef07a11534 GIT binary patch literal 1620 zcmZ?wbhEHboX8-+aD;*3|Mma>&;36(@7R~aU;bbE-&@$bebV-h+>ZZG|A)GSrUj+_ zzxV(Dt^b!-UY=Ps^X|sG|Ihz_yYKD)oBw0IV*fw>zp7&u1JIB&|A8b{p!lCV!Z$#{ zC9xzCNZZ&~6eK2RrKPiFn46pHC>R+S8t5As=^Gm98k$=f8(A3`C_sS{(6*wK zG^-#NH>h1eo~=?wNlAf~zJ7Umxn8-kUVc%!zM-Y1CCCgTBVC{h-Qvo;lEez#ykcdT z2`;I{$wiq3C7Jno3Lp~`lk!VTY?Xj6g?J&iz}FXUa9*(<*h6~B`MLTPi3R$GdItKr zxgdXmRTq~8r6QbxRdsPlWkITbP-=00X;E@2P`NTpGcfG%TLe-Fbd8mNQ6?}_5_4Sg zlS^|`^GZBjY?XjAdMTMHR+erq=H|{8t`-K)2CjyNhE6WVZq9CICWe--28M3V7BDlg z>2!juZ^GgvhV=(^z z_xI25Uq63*|MvCE=T9F$ynpxh&Ffb$Up#;I^vUB#4%#K*am(xzQ~C}~+O_b)(bdPU9_-)SbLGsG zQ`_#=TzY(9#qQpTSBEZq+ds`~YdpVt&7>!-&kk2D6i(OY-`lhy?x)m_ z4-s~Oy^DTM5?g=YrA3@CDMv%_zIExXpx6|Pw~2?kIZTW5Oul+9F{^)EVfi>*F#2?h zlKHA5961Zz?XGwT1#^6q*xmcth_S&yq3QDSfW=;Ovlz3ku8i26b@$ZP)z{Yt%1c-j zENpD#%DB8L_Vl*3x3?EOJ~h{S`?}bz>>@p(1`F5U-`~K@E$6di!^6WJ!rF0v%pIEq G7_0#!5sBIW literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_hangupcustomer_OFF_jp.gif b/www/agc/images/vdc_LB_hangupcustomer_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..08c253bfcd2c989249a9fb96dae8e55d7bb1c7f7 GIT binary patch literal 1957 zcmbVMX+TVC7@n3vgzP(~sa$H7b0)LaM9rdT%B_@;+bk!|ZD!6iGigeatc_ABjkHi{ zMIl8B*Vaa%5|vAq?21d0>)!5}$h|*YKb#-m`Ih&2pZ9&g=lvGD@aPOdBE}4J6NAy| zbV8x9uCA`6q$EE-zr4IWJw08c(VRYg+TGn9f}nzeg3!>=w6rugH@BrrmzI{6;_>)~ zhK91TGFMmEpr9ZsmDg^8nB3f4bo_zOd|=cH{xX0gPz%t%{X&gGAPR!j zfDm3Qk+X0;mFIAPM9jkZQ1~EU!G;4R&f!YfGu+Kf6dojEh;a)Y0DBEnBU8v=wE)n_ zq;eHg!@>!~h!AF?bNx062Mn61gIG96{Q;ooWFtx#pb$ZV2&94l6(T~m3urVN9w37d zNCL?uh)jTJOj|M&1c5If4rNn{1DGBh-WM)(#li)u)e0twgch0@YD+|vYe^7;!O;64 zlL@E=K@}!f3p50|%3{a^2Udxc5`|iV$N{}afe;B%vv6pnpHq-2`24Sqg?*gQ7b$&o_l*;3i;A*_pBr54CV@DQ&A<^6)CeHY7QD`9~e zQFwFj!rt-kU2RSE zbYlHwzW4;2*_el$C-^CGum|2NRtu6hhdG43=J?C^M2#O zHwmvF^)Du7*ubKgN6}6u+S;6P6=LQdZh>ma9*>gS1ufxsyi4y{syNrB^uiP24RVY2 z*Qe}zGdsF^?J_dr`})_*u*RnI&5SIqVyt4dJ1rC9@JUHl$w>)`cx`MT7GIq%8|n2k|S}M>AOzk#Ggtx#?8i>8xw2@)ipJjt8MCQYw*`}O;@U~UrK6h zYHqvI&_ZbKti@lx+}hCosHN*}V|Vqi;bX8yqk8%t>TGm3Iy&2XY9;JG(^Oi(t)p?P zcDVbIh28C}EmKJbX9V?@()j7*i?2iuwpo3mQ;$QwTWu8+$5IQ8+TgU;mx*5(_Otw2E`+DXaOM5#n=WPCDMQu6ZjCJp)vb^r7 z<-xkh4p&jI#+Sr<=VxZ?bdHzd;62Ny_`bM`-#l#nhTfN{Z-k;xyX>UP&W!N&w&A}b zSs_hhL}zF2qxK)7n!D-#B34?7wLQZYqE=HKZTdjQ!Z>A3bq8y))X_ z%{gnEAumuYh@N7t0XEI?TI4ti@K-otY%)6^>@+y~;Xy39>2`J;*jVr|j?%p&C!Try zc1|2+OzOjUhw7)Md1{k}40CPeHJpcdz literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_hangupcustomer_jp.gif b/www/agc/images/vdc_LB_hangupcustomer_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..de7d2644e451e5fa53b3f653baf0e18837b908a7 GIT binary patch literal 1616 zcmZ?wbhEHboX8-+aD;*3|C~8rCQbUkY}xyMR}_lAc4KYh9*C@9U=c3W=l|JAEQ zjg9ZNw*KF{_y4wSXR4}Z#>DI{DEL2r{@cF3SPP3)X=(qDAOF93GXv15nKOYT8c_Vt z9pM|G;F4I92&8T7D+&^mvr|hHl2X$%^K6yg@7}MZkeOnu6mIHk;9KCFnvv;IRg@ZB zBbrg&Y3=Q-RjPwnSbPdg|jE$@e3>2V1 z320kUN}5%WiyPD~AkS7Qqokz3N?*Ucyj-u`STDaQUEk2s(h_8bk&!M?g>G?WUP)qw zZeFo6%mkOz;^d;tf|AVqJOz-6iAnjTCALaHmqNUdTj1*pH#o0Y59}emIIAz^b}9q_QAYKPa_0zqBYh6{uVprWqJ^_$>k{1iHq`zbF$J zDTz5Q`N^fZsd*)yF1AWQ8NHOu6e~wF3qw~IGb3|1X9HJ5LqjJQV>f3vGZRBgR|7*g zXA77a*z{VO7@HfqxL7zFSQr=@x*9rJI9obd8X1^dIGa0JSh&FSdgc|EB<3Zj!tBii z+6&cdj#sahb5UwyNq$jCetr%t1q5W|m*f{`{v& zbyD+y`K1V$F&O{<`}^njub)4@fBX97^QVs=-oJbM=Jl(WFP=Yp`sDGWhY#-GyL;#M zt(!NlU%Ptc@}-Lx&YwGb=JctPCypOGdgSn-g9rBS+q-A?uAMu!Z`-%OrteG>WPn$Yr@}!9q`ulo&y1P0%+S^)NnwuIM>g#H2 zs;eq1%F9Yiii-*h^7C?Yva>QX($i8?l9Lh>;^SgtqN5@s!oxyCf`bAB{QZ1=yuCa< z+}&JVoShsU?CorAtgS39%*{+qjE#VqQcqV$TT4?zT}@R*SxHerUQSjo%#Q3D;g!kYZ@Y|nybs2yZSmCx+hIyWMM5Xo!njD($O<<{+!Oa z(M@%;7S=4A)U{&8)afPb7SCV4Wb2md*8XiRyB6(SvUcC*%^PMMZR(iQdwAvI+66sz zOJ|>IpMCXY_wh})k6eB@_x!etr}wot_O3g(=hUkERd;9Jes<{PnX~(MJv!HR_~H@H z7}59V_EcQDa`Do2y({bL)^JSwT%MhL}xLhs_!$U(u8jU7BJ$-n17)8gu|>x}cz-(a}+h#WFTFR$pHq92`6_ zFp!j#)X~ua06=?tJKq1j&1=$ilW+sb6Juh03|^^Gh$XQI21X-0q$ry(ey)xHN?|r( zW1tWcD!53DbhTEAL}=GVO0=;OCQMkl0u0u$G%|$@!Nj0O7Kf@>8a6=;%cBt%KDTX? z3E&h2i)9l+YzLrClPgyuU?2(dlRz{Gq)|u|{{T9jz8s`N6o?E_$rP#|h0gM)vLFcj ztr2iFCHx*s#1s6cg|FCz7z|Ue$YixzO;Y=l?&ffEGYu@*#?V%b2$DGA=EI9zf&KAuhy#C=@=0 z0SRbKI#<95<7s0tIK5@cFeit9e-(s0#3;Ig<%M2yLmk#c$5bOvmQkz;aI zj9dY7BLcyVQWTb}Rkp`@9xD$~N8IeUbS1;zj8oC|)m0yfEx0fBE^@(xHo?H&h1+_Z(O&I zjgDL!9{T?3;6Q(0Z%=nur^VdS{@s+J;GE=GXxS`~;;-bQWWBEt(j^yTKA3k*OQ+-xuMta(TPxk9R-nVy8 z>VHx`+Py0|>BF7cM2-4`1WcujSIALWTusSuq0ai@9o>RzWdIW&6_qxy&V}L zdTYb_b;7l4!oyat67YH4&=Ahb73|<37L!4z1qS$2@uDR8E&tcDrM^qv^zkMVyuih8 zyzaTkW8rHH=DWMid-avMb7ueZAFeL5oShsU>}Srf0|2kb_EX>0a$9fvF#*R(&fXIp zJ+JA$7E)T?rKU9-^`!?y#umw;OIy)T-maL}TN`S;zNEdz@mvV-jXiIUJ?9ZCscrn) zL}KEu^r;6E8~{hq*~#-*0Z>r<8BlcW`0>I5Vnt;|VHHs2 zY49YTtg0?1o;r2fSX*3FS8FmgTqtX-Z#K?d;NS!h%oc*Tx4EaMtGjccyWi4XQ)8|f zBKD7X-yFKrQ#n!9J8|dxN0q%@561fjt^zaM_NDFq$nHC!;)gFT=LPPXvq-zhEA(}K zlzYeLT5Hu2zV5EsuEe?Ro%8YT{!!Qh((rlpv-*}e-xN-YowJ*7T#tV7<;kR<*3SO% zjEs059bLT*D;1e)58U!S4y(sK))cum=Z>_v9}PLmN_4@_v>JQ%xPH3r&_1)Zsl+;x za9eY?pSROz$IU&uhdvh^oaPmehChsHE4pzn^k;gTB`ldxNsVh3Zk4Z~d}! zSy*{y;0hy)e)_g)L;TZU4xIGAsBLsj9oRBI=6<8qa@ft3`~Jg&m?ba2d@Jo@3!ITX zx~8$vzQOdBn}@_Vi>`-fFMV*Bc}^UVheS3+WQ04P-I&XR7Sh1I4i0aAo2F(z*mE?h zPKM-#KZ5yQkwPE$Vr51AlGaU6gr#1yb`M>&vwH)+axG(p7A(nJX#e&;36(@7R~aU;bbE-&@$*k=ybA>HqDMwqIU(`TxED zp)R3mL1{~xm&~l1xqI5~yBqKRKmY&jzPGD7R>gY7{(t=c|IPmlKy%K3NKBykpF6@g zK*1%kBoRp4*jE%JCTFLXC?ut(XXe=|z2CiGNg*@ERw>-n*TA>HIW;5GqpB!1xXLdi zxhgx^GDXSWPQj+asv@@_H?<^Dp&~aYuh^=>Rw*$hKPlA;$OZ}PD=C1Llw{i~If5h< zKz2Ik7o{qg>KW)J8<-g=m>KFB8k?A#o9ieT85kPq8yM*u8tEFETNxW!85k%)ffCTR zqLehNAQv~NT|l0#QbtKhft9{~d3m{Bxv^e;QM$gNrKKgv3?n05pbFjM%Dj@q3f;V7 zWta&rsl~}fnFS@8`FRQ;6BCp2OG|8(fG&l2A-BNS7jAG~u^!k%ddc~@`W1-<`i6Q2 z`nkCve}PpOmjtCEoPkw!aY$uBs(w&vaeir0aw<@{GE6ft?C@IzQV4X7m48ttFj5k8 zT=J7kb5rw5JY8&+fHHb1nJHF|CKiUSE@npNZq5d-hK7btF2-)oZe}KimaYbdZq61k zGqCA3GcHn1=-G;}qzFgJB}G%z)Cb_T|WqoFBGuV-FyNn&1dD$L$YpuJGN zhIsW_ITxiSmgEo>*T>t-)5G1()y3J#(ZSx% z*2db((!$)#)Wp~bm?`yib+olKHPqEqRg{$!73Ae)Wu&DfCB(%6gDt$Ok7dowKi(~#O|`ybBi`d>(8iOIBnyLEmg6+Dl+F8()`xne*eQ} zrp@#3Z^b1VOPix>V;Y(|+bVne`k0wm3;U-|Yn;(Ev%R^#rEC6zlGg5}v!<=+oj94L zXyy9yxlz5K? z|L*pU7v@~saAn=&>8Eeq*)*&AOh;$^o14!opMIUb@A&<_zcw%Y?4&vCIq&_s)oiko z)!+Q*@5y_~VkQ!5@KB~j>|?@V)6;YJ`0#G5ynVet&aFo>GwR^t74DC$Q#4<5b{jY} zot>$zpc#l@D23I+{|j7^*Yi@oN0ZC!PBb;RbZyQj9UzP^H& k$Dl%CTGP$V8JAbZp5C_h_V$9ur{;Q#zinbwWMHrc09w(2P5=M^ literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_parkcall_OFF_jp.gif b/www/agc/images/vdc_LB_parkcall_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..2484cc60f48c09d3316aa20bd7845fb335f6148b GIT binary patch literal 2041 zcmb_cX;>528XiSO#EY$4#abLDO08FtnMAUYpdph$(6oxQ0=A`DMiL>JG&3{-3U#R> z2#8h%l^qFN0c&mbQY}bZ5J4<^Wb>jW1lwwFudP^IIzh4h;nVv(_v!g@*7yD1?>p!F zPJm3xgwu|k&)Wk+Tr10UteE=Kwz`k>gwvcy1E7i z1`-kyIyyQ40BCP-r~1FWc|LLtm2Uu11*xD$!5Xtcp^CytP>Drq^+M?O7qt+mRSTib zK5|%Y5Mvr`V4M-#6!&U~DlSUJQ$uU~K!KTW)){mdsQ}HoXg$F<3n7IXS7Ll>?$~BP z-~@z>5<()!0qD>a<32x&;tz-KT_CKKJnqT|L$2Eya<95$FtZwlc}#Og_f*;`N0CM}>C zp)zU>q!!nM4vPvU9zzNt%G1Xo=nQiCQ^R_KJ`oUIh3gn*g@J+4VTMlUh-(5(kipm= zZafoBgv1&!MleR;F-8?e!D*9Z>hAtp$N{9h;lF0oQjemDMsZb)4%3q|R0vTgbhTE^ z7cser1Z6WhQZXz+5X2v4NySq3YJ?|&5viCvY2#U3mOm=-7fHlomWRC6_NYVhR#BhTwSgWCm=|;3Q6Ha04jbeaZ3a6HcASW(QVeGgMhjkpe+xLv;X8R{a||BCuCSN;Fo7=v<#;Yf`?rOMqGy( zHaO7V*L&64)7{nC(cbp$mDbBG&6k=kHa2|o^;h*5>T16{f9{K#f1N$^`Ddp;J@v`S z>Z;0*E6U4CODx4FiV6$z^Kx^tj~_dlm3idwp^pw8$k?Brmbxz`d2iC5-5>7SxnuhW zi3#t=$HkgW@5PXW@m&M1*F{Hd(`q8OVrrFA@lM3sZ@sxCJS=qc8?T3K3f{QkwO8fq z*9FM}1EdmE>@Qlo#!o2l<@2~4w$Ex7lPXHO_o{!cd}YPUUdxx!AWv|q$4g6ITIE<;PX!6(_3ligQcO z78RU1T~l=We7z-q&H|U|fTt&|rTH?gt-bw9M_UW+)TyiGJy2`gwQC*FP-$~tx99L> zYfJBN*UvrH?#^FswzkZeIn}A@*E`-{ndC3|y!(Ck;c*N6HaF_J9g8nz4EmePX1Qet zRt}twy_LVCITbWxI#Jc5PNfqs?+Qn`i_*TE(#TM^wyva;_xDb{9HrLWu zv*c=8WrcU2b%*GIhffkCy3I8EeAkvsA*Hg+vH2&KfToid4j^UFE!RV|n#k+t*y{s6 zCj*ieC(}Llx-Z$%(lP(ec**(|Q9F+P_z*kGskWX}Z%k0Xz!+){*_UQ?%H@5h>$&TJ zlR@M9wf4Zbl#+|`c;7v)({ZoLbKD56Z*fh`We?ks#!yl5&6%3giv@n8X_D61!k_ky zxsQbTBug6Gj3-C8=8K|4wBtd9w!ykHL$CQEj7_f<=d`Iv0vcua8J z_G$C(mtC0gq6W4X?428K&)-ciUs13JTC6R~Sh>w!n9A%ewH$pTTx&^Aj4Lb23*WZ# TL{e@_d2tcDcde5M0DON3X+JJ` literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_parkcall_jp.gif b/www/agc/images/vdc_LB_parkcall_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..39f17bd25e4564b3a025b7f27add30b3f2828b12 GIT binary patch literal 1598 zcmZ?wbhEHboX8-+aD;*3|Mma>&;36(@7R~aU;bbE-&@$*k=ybA>HqDMwqIU(`TxED zp)R3mL1{~xm&~l1xqI5~yBqKRKmY&jzPGD7R>gY7{(t=c|IPmlKy%K3NKBykpF6@g zK*1%kBoRp4*jE%JCTFLXC?ut(XXe=|z2CiGNg*@ERw>-n*TA>HIW;5GqpB!1xXLdi zxhgx^GDXSWPQj+asv@@_H?<^Dp&~aYuh^=>Rw*$hKPlA;$OZ}PD=C1Llw{i~If5h< zKz2Ik7o{qg>KW)J8<-g=m>KFB8k?A#o9ieT85kPq8yM*u8tEFETNxW!85k%)ffCTR zqLehNAQv~NT|l0#QbtKhft9{~d3m{Bxv^e;QM$gNrKKgv3?n05pbFjM%Dj@q3f;V7 zWta&rsl~}fnFS@8`FRQ;6BCp2OG|8(fG&l2A-BNS7jAG~u^!k%ddc~@`W1-<`i6Q2 z`nkCve}PpOmjtCEoPkw!aY$uBs(w&vaeir0aw<@{GE6ft?C@IzQV4X7m48ttFj5k8 zT=J7kb5rw5JY8&+fHHb1nJHF|Miz#yE@npNZq5d-hK7btF2-)oZe}KimaYbdZq61k zGqCA3HnMOwvNSMqHn1=-G;}qzFm`frHgt0}bpu9>ktJNOXI^nhVqS78%-&3(y->Y| zc=cL27o{eau&F|LW?o8uc`+z*Abxd8Ey^rQO>ryA z&s6}2u2m)$+Z~Mw`5K}(g`5!62RcR{lr)f%3QP!?{yHM z;rzL?XHK6wdE)r7qel)OI(T6JzP)>P@7lRz`?jrHHgDRvVg0(bYgVsXxnlXUrArns zTDV~Tyt#8`&zd=7`n0K2CQq6;p}()Ur@O1OqrI)QrMaoGp}wxRrn;)KqP(oMq`0WC zAU`iRCp#-MBRwrOB{?ZEAwDiPCORrIB0MZKBseHAz~9f;$J@)(!`;o*#o5Wx!QRf+ z#@fo#!raW%#MlU!DfM)9w6!!f)YVi~l$8_}GaX)sd}Hl}(*BRlR-vCCp5$MH8mAG|imZUe;AQdv3$R=9>D7dDB<+O`5_| zylUmVw(j}`^A~mPY~0+tV#EHjHB%4tFWt1KdH$@e9h(-P+;ZZ`szd88_w8D=J9^3a z3v>6KTmJC+hO6tJKJJ;b;@q+JWw-X-zxQ(W1` zMxmltcTR3zety0~bKDI}lNA>idra0k%gNZt$ipe%GsA1^s;jFbHfP;EwRQFN^$CZA lauXU3Hg6KSv?})Wwzapn7d$>S*L(ZAySuZ+bvPIqtN|*-g5dxF literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_pause_OFF_jp.gif b/www/agc/images/vdc_LB_pause_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..fbe58b9571a2dcd51bedaf02744c315bab6f0b96 GIT binary patch literal 1606 zcmZ?wbhEHbbYl==IKsg2?c2A94%1*XSQL?vFu&J=B$SufCElE_U$j!+swyLmIN=(U5 zO0@#ALBje<3ScEA*|tiKAPEJKozD41sS2ig2D-@xW(EpohI)p^Cg$emItoSxh6efu zM*4KL?fq0y6ST@{2R_3lyA#O%=j3 z^HTE5i$ReC@vBQ}QD#|cid#{Bt^zo8tunFL?r2EJ*ATra?I;nZU{89wW7>xh_{r&U%*Uul{zkU7k`P0V_@87+B^ZM1x7tfzPee(Fx z!w2{8-Mw@B*3BE&uU)-z`O?J;=g*xzbNbZD6UUDoJ#zTa!2|pE?cK9`*UlZ=w{6|B zdDF%X>({MavwGFa70Z_`U9x!5!Ugl^&7CuQ*322xr%jzQdD6rQ{e8VX-Cdm>?QN|s z%}tFB^>wv1)m4=h1nAc$w`R`@o}*+(NU2R;bEa6!9jrm z{(inb-d>&_?ryFw&Q6XF_I9>5)>f7l=4PfQ#zw$Qsi&)>t);1EF>tv&&SKd&Be*V&c@2Z%)|&RU4F6v%NPa*9S{L3(HL0&D=2i`=$NbC zuuk*zstwwwRaWKA5tO`r?EC(C1s*z5wZ~NqcYG8uV`WVDS{t?gDqq>Er+J&>wOls| zR-AkB#iaJ#4(m*d-De$7Uo8Dr8^^E0ms*+AR9sY$-%%mg-qG1w+{MVk9$1sr(p_3z zU6$KBr(jn4jEqSQL0J>zn%W9m*RET)Xz@xpein|#)uq|1_q8nSncsaxX8wY*-Yw~M z9D!?&pXywad*ou?+^dyK&a#G7%$U)3?D*WM3FR-hEa9);wW|5*k*cir?n{-grk&Yw zuVwGn7ZKf0xo0kl{9GrP6~=aNlSRJGTB8}cv-h;D^4ZHQt}ksBFYYX4^L@jWCF!!| zsZ&`ZCj>j?tY3G~F4L#6n^@%a`FoQ`A!p`@ko`dys$`A%;y6` zqGKDQ_Lpm$&dp632PdUINMMZSEqHutuJ`tJY^;SJZ%tht{{G$$ KUa1xa25SIazI*}z literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_pause_jp.gif b/www/agc/images/vdc_LB_pause_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..1bd4e01768068009d271f6afd469f1e7a8099f45 GIT binary patch literal 1496 zcmZ?wbhEHbbYl==IKsei{r~lI|Ic0ef9dd-!}E^KE9@-G5mv4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7` zWhYyvDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1 zGr=XbIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mdpZ!qC;l%*fo$*}&D%(9p@n*v;9^%*4>r)xglr*#c$; zHob1fPHvVKX3owA=5B_Du7*yQhQ?0jE@sXy&Q4Cw=1wrZo_WP3iFwJXFncqB_CobK z;ni#9T$Gwvl3x^(pPvIu0Rb8LCHch}`2`Bj!KMn~nRzMs<;9@Lf%w%WwJ5VJHN~wc zKUV=9x>lK3Yyv z|Nj2@{p;tC@87({PcxqRv3 zh4bgmo;iK$#u35cm<%;FYmM&Sm zXyJnS^XAT(J!|HS>C>i8nLKIYg#NzXp6;&Bj`p_Jmgc6$hWfhNn(C^`it@73lH#Jm zg8aPPob0U3jP$hBl;otug!s7FnCPg;i14t`kl>)e0DnJUA8#*D4|g|LVAMN0*xT9K zSX)_In46iJ7#jgIrJk;iww9)bx|*trvXY{Lyqv6zw3MWTxR|Jju#lhtKOZj-Hy0-d zI~ywtGZP~NgW^vXaH*pMB0(h@1M7DMCBKx+c^RwL>C9&7niNoyd%t4c`#*dvEL;u@ zno|8Io?Kj{V>I_{>K2Izo3_U8veR#~bQ8G4-|U^R|LHqRTLqB~FD)Wv)~!BUy1P6! zZ$E2fAuuO5$5+;**TmHoG*xFrcPC7oR6aE)udlx~t)gRI@q)SY6MJSgOzK!rm07ZM z@w^$eD;noaTex~!_tdWb-j&;TOfD~}+;n13%z8f~JGb9Ku>LCpIi} dZfBQb$x&Fi=xDcuan_v^8hG$ z(HVkV+#H+WR?(QBO986736$*tnZrtea@7L*cSFT(!o6XJ5&3SowJv}{C zDwWM@?$1iNpM)Tl^ZCyV%ap{afQUjw3aSNi5F(O5 zsniFBAm$Boy+VRLiXfhY2vt&8 zh6Zt11nh(;l8BfLE*;`>sAL+CP2xfj6u_bI*gUEa#Nd)39-BUG<9S>*iB08^eaUPR zjR!$oh|Z-^7(UQyD1c1i2GD$`xj`}|Dv$}`XS?RzstX>pYVc0x=^vCbN{W|&Zm!E%n@Z-e&AI87`?%ua| z?^wo0M~1%{x_#^B;DEWmueayMbyIhj@$1fx_O@%SS6jZi(tP>Lrp7NC>OZfmy>#(H z&1co0eo}S*+*!lNl@(`Bm+McJm6n_=K2cOyaQxWOBl&r{!-ozY*q{4RPIlJ5%#07U zAEdwkUfSM0yWdUKq`Z@yq)tpwp-RQuazrMLkBgOvcg4UWVYFc9j_uptii(Wb8op(7 z*rw2p8`g*L*R2f>3S7hEa@YZ@SFK#Z^7msh=rpRY4~2{sCDGe!`Ld;+OFZ1&TnR3~ zn~N7MTrmHQ*I%3W>MJkLeQC~Y=UFel;N&=ShJ(GGE#3x)bD6Z8`l!6Dz4gb$IXqq! z#GP0=KNB~+BxxNpCvf+JmWuhMtzMKf!vU3B#EF+ov8}-hUDV|ayIgIcPhS7{!xUD> z*!cLnyESOq9<|EWU7MbfkgmyjZ?CQG4E#*O3MILR z8ctQX>yLd}U4ySFuc|&Q%t-2y&fFBX{Ajvs8q;YT6PnzZ==|pp9+X3v0ihK(@~A=LuZ z!|nA({33Pd7a5B`$&1b;o!1lg`7~RGGJP+Kh5MG5X-{TT+C5!ATK(v&;(e?ky(pJP zo-EE?e_Cr}_gdcBJ@&352HqwzrUlmROm!^N2@eOARFO8H^Wl8KQ>rg UR3LM*=!-&Q^|sD-HaNdO0aTPQKmY&$ literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_quickxfer_jp.gif b/www/agc/images/vdc_LB_quickxfer_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..dd261bd3586e0cd4b0f793694ed76dafc27e7cd1 GIT binary patch literal 1569 zcmZ?wbhEHboX8-+aD;*3|Mma>&;9>@>Ho2L$G#l?(p%WOd)n^*PyheF_dnDnv?I6U z^2*C;L1{CqW;UcXENNbHcjMjv=l{Rm_jXmss#ves|2O~tfBc^TXwDfBi3t?{b4U0F zD7Yk+Bm!w0`-+0ZI4yi0i)elN7&Mz%WP6aAghG_y`Fi+C5d^-sW5vpf%Zc6 zn&Q=K=F@2z8^g&4jDXGAOfawp!geQC;2cC6O^MLuK2$(S# z|Nr~@=l8FlKfZta`sMSdk00K@d;8|~tCugHKYRM*@uPti4*$!dV9LNIy>6iT3ec%8XM~CYHO;iDl5v%N=u51 z3Jdb{a&xk?GBeWCQd5$X5)DCA|t}XLPLUs0t5X0e0{vVJU!gqTwR=<93AZK zY;CNqEG^8`h8|5qc?Sk=;6%EHW=+tyRjP+#3#FsY=!aoWTgy|W8Dx|s6j%xRu7xwvM@^1|u; zZA%yR%Vcgr_MV@-c2@bch7)ba7GB?a z@bJ#veS5CldvfS@%gyKOEzt%#g(?)mCF`ZAhEmE)q2CO?gWdwKYaRQpPe7ye3$nXl? z=UW#j;c%r#2rh&^0%2leqOY&7x3_n6baZHFC?g{ShT(yMf%f+H!otGA!NHD>j-sNX z;o)HxixnLmZ8RD!7E5k!u23k{YPDvwStgT3L_|zYP37d|jE|2i6pFF2vF7GxA0HoI zU*DFNmdVM| zeDb|Z&166>lp3Cn zPnOEi7=(w6D^Tum*D<%NnQziHtsJ~!d0= zL<8vxg)Ocbv<3@B{^Q0Q(VDPS6+#b1G-$FKMsWDDSu&ox-xsn0ac_9RYB_!>(j*ZI zCo2#o7AWGA@e`U%F5^iA0-?V@1hK_JPz*tkzsO4>l(4)Zt{8+QLe8v>H*q;!FRnM+ z8x(?U2?U8Dfdphp#1fIe7n{uyaD=nmK&1wgDq&<+SB~qx;^JDr$K?sth!jKBVJMn3 zTLB^QD28g{Q57KE%mgCjN*Suv*e>T)tRh4$PeEi7HL3t+vdfddL7gk)Kw=S#!N&F9 z9Q7-%?0?A^9e0LqD~@w+^Dj`$dg6hTY2-|N8a$^s}c=9zXi! z;e&tPzxVS${{GWlt7U3(;?Cd3$A0|l=*aNU?OTHb{e8VX-9LQ)UDwUO+~~aiZAW|C zwX3aHTAG_Ke{-qvVnco1h1&C9pF3-=IrG)&Q>N;wN~7VVzM{PB%hHk)#m9>Zj};uv z&pUGXi`<+;2eS|C|8v&9y?g$&JM;65^j$mCQgzytWK5&pp+c34q{IYyd|WIdgJY!I zqoY3iblWG9TO-1^gl!J}I3##e(8dkx0|VAc#3G@;VC@<|zON6D%VD#a-d+s6DQTXo zS9z>lvD}?XSw>z8eB`#|L)XQB{NVjXe|YcRg$rEfzw@@UljFR%<~rDu<`C@&gr(0& zGY{2j+h}_+2@Wq?0!Z(AWDy83WJ+3`A5#6$B3o}7SpKkKB%v&bqP9+Cn=GbAo{P#` z->}QCXh{4>_o8d+-V;onnYK55pLS2`ob3HtYF0XlIFC$nw6h};i%Lq5mr&d*C>475 zN@~?9>Q`r~3?{wFU^JS)HlM7mY}6a7>*^_IuAM(ybL~`9E9FF4v5PBdF7a}0b8TB& z#qI0E&F<9U)16J{D#to53|#EIb+x@}M|Z|)0U0y;T&*F@^K#OH9NajY6io<{H#V9^vebl zu>H#3`lqow57dE|TMyoJpvuE{1ZH_RPuv*3Nk4rxT>Or^F3+^Ny1u*XIj1o!AgcIY zw!6H~l@rw@Anr`KUmw*3f9|!eCgDMCCd)o{)P4iA#&mJc)KTWIPkSvNz5RSqe<3C6 zcy_e;{X^RdLWhp6bI%B@{r~?<|BuZ(_T})G-ooD9({}%V`adlw?fI4yi0i)elN7&Mz%WP6aAghG_}N7EVSmy`Fi+C5d^-sW5vpf%Zc6 z8spV#g9{)&z?Sc{OI9>`}gkNxqa*A zjqBI0Ub%ef;)V0)&Yn4a>g0*z$BrI3eCXhT{rmRr*}ZG$j_upFZrQwPBVyo`k~uG9)w-P5`wDbshb_|C3OsbAil;Aj6;RM&Z&*>{H8pA74V`a`_EzkVd>6V#H~GY~lJLK|i*KiI z_!Y%#pw#4;AXj$yaa~+=Vsdk8Mr&bBW=vCUV^UsQcN8lNTV?f>miF%a&h+H^MT=)Q z^kw&Ur4%h#CNXVB)v^iATbHa_xNBa2{@OV?(H(pDcW<1zWx<+L2X;=JJ+Wi|;eAIg zuh_l*_~r|ZZIjlWd)Tvn-L4y*r_<`5-kvq({F!?Ti$1=3eV};$ug^A3uIvvu4fb&!1PXUY(zxUr<14Xczb)>*w}pe@};JxX7}#h$B!T1wQE;aR@Tj%H+y?~zkdDd?CkvM z)2H|E-!m{UynFW!NGks4j_?goa7ipl1kyJ46$OdO*{LN8NvY|XdA3ULckfqH$V{%1*XSQL?vFu&J=B$SufCElE_U$j!+swyLmIN=(U5 zO0@#ALBje<3ScEA*|tiKAPEJKozD41sS2ig2D-@xW(EpohI)p^Cg$emItoSxh6efu zM*4;jet7M-3$#~4V|3b9373F4V(;|%nh6k z3}AXa^NLFn^O93x_GSX@h3a*|tJli8C^fMpzbGU>KL?fq0y6ST@{2R_3lyA#O%=j3 z^HTE5i$ReC@vBQ}QD#|cid#{Bt^zo8tunFL?q*5I*ATra?I;nZU{89wW7>xh_{r&U%*Uul{zkU7k`P0V_@87+B^ZM1x7tfzPee(Fx z!w2{8-Mw@B*3BE&uU)-z`O?J;=g*xzbNbZD6UUDoJ#zTa!2|pE?cK9`*UlZ=w{6|B zdDF%X>({MavwGFa70Z_`U9x!5!Ugl^&7CuQ*322xr%jzQdD6rQ{e8VX-Cdm>?QN|s z%}tFB^>wv1)m4=h1nAc$w`R`@o}*+(NU2R;bEa6!9jrm z{(inb-d>&_?ryFw&Q6XF_I9>5)>f7l=4PfQ#zw$Qsi&)>t);1EF>tv&&SKd&Be*V&c@2Z%)|&RU4F6v%NPa*9S{L3(HL0&Cn%()IHaXT zE=zwsPjmID0-JqrAG#jDmVaPD!3$-nZub!NV@=uVw^8bocpD#U zR-brg6jiHNe(%GN+p^zJSikvVb@n@t0B2HlO>=s7N=8LnW>;BXnrv(B37s+%*Uny@#>~b!W7gJ|-rl~H#pTT_CvR^INo!xV zdfvkHigW#QTCQgBad0(lX=&ZJZq38{yHBm=+j0BM>MQ*R9`>EvxM%h8T~DTDpDTac zwdwNFC3%_30js1m>udI%SBi72PL#Zw)foGSn`T%o9C40lG-*I zO^JVJU4Jgp&M3}sVvob-v@4Kf}qWMbwCU`?37 zRho5mb?8dBqgJ7-Ll~oWw)J|I>V$CfPqVwQAd&I*_WZlYT5nI&i``lF`P|jj;!G_9 G4AuZmWPKq3 literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_resume_jp.gif b/www/agc/images/vdc_LB_resume_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..0a7bce44cf88120f98102c2382a6effbcb2f4f14 GIT binary patch literal 1471 zcmZ?wbhEHb^kxuZIKsei{r~lI|Ic0ef9dd-!}E^KE9@v4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7` zWhYyvDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1 zGr=XbIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mddX(b>t#(9qn~*}&D%(9p@n*v;9^%*4>r)xglr*#c$; zHoZp1#;)dujwa3q=5B_Du7(yCPL57St|pGIP9~0yZsst(o_WP3iFwJXFncqB_Coa< zlK3Yyv z|Nj2@{p;tC@87({PcxqRv3 zh4bgmo;iK$#u35cm<%;FYmM&Sm zXyJnS^XAT(J!|HS>C>i8nLKIYg#NzXp6;&Bj`p_Jmgc6$hWfhNn(C^`it@73lH#Jm zg8aPPob0U3jP$hBl;otug!s7FnCPg;i14t`kl>)e0DnJUA8#*D4|g|L7iT9&2YWkP z8*3{|3v)A56JsM_rqt8b(bm$`P*+n`QC3n^ke8E{k(QE_5El~_5f%~@;OFDz;pXDx zU}s}xVP;}vU{L(Y0xorQKqRO{V_?0fpyZX3IWJ??x}0pa#ziW@x%Vs9y{~zHyMZB* zNg$-}#FCXa4<4h F0{}p1HO~M5 literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_senddtmf_OFF_jp.gif b/www/agc/images/vdc_LB_senddtmf_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..91c24e4468b9587c25868fbd344d2d278c3dc322 GIT binary patch literal 1882 zcmZ?wbhEHbjAamFxXQq=fB*icPoG}7a^>E=d)KdDPfkuge*E~IJ9lQxm{C_(clGMk z>C>m*zJ2@Hv19S^@z0+>@9phPNl9^bcD`}r#?qxrZ{50OW@h&A;loFd9&OmLp{J*( zyu3U&H`m(Q+Q!D_z<~qLo;|yJ_ik-%?d8jt85kHYUAhD$sR$JRb4U0FD7Yk+Bm!w0 z`-+0Zry1t>Mr6tG=BO_g)3fZE`@j@x4_pIZg5_)9@s;A$@#hZ6^RAz*Q}aqZ zU2K(rGI}YQDOPS~j?PX_hKA;@&IYcAhK5cq#%|7TW+sM~t_Fr~&K58;u<3PmGIKRB zadLDvFb8UNHFR>ebaizyGI9l)XklsU0@Lf6S6q^qmz)Z-Hxpe6^lgE!9KDdAH?w#AWZr-?l?dp}wmo8p7f9~v=)2B|J zIDYKtk;8`$9@xKc@1EVecJA1|ZR?iJn>KD(zi#cC)vH#nSiWrOlEsS_E|@=W?wr}P zX3m&CZR(WClO|5+@9XX9?&|DlZ){(7*5yEBmqTX?HGmJ->7N#`UYuFTC8<^Z9J|tLOc5+t|1t zJz2P|anrPps4b!Ft7WrV{G&CZf7rb|)UKVdqj1%X$kWp@=b80$-PPpgd?~zP!U3Um ztG@CEHYXl6Qfdj~TjJa*Jo#kt3~t#a|0`wkO;bW&D_Pbu74!Z%xo*Ls+`C?0za^$> zxh~utap=|e_Yta%&$5=C{&ppCZ;m;C8Pls^t&q~E6`oZ$MJ11KOv;@&H%efpS(SXY zXR`YYP18+J_pyC$_quA=?7*q+%P}n~CfnibF6|D6;{@%gK_Wg1WY#e-U0T&b&?W_IG>GEX%`S|+(|G%nkkZ)jN zi+E7ad~16nv(N!`M|RnY2aYYmVG@chLP-^gZ6a|Vk_%g8l4c~fDmcAZ*rA-Iv8Ype N630STF&0J!YXC}I*x3L8 literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_senddtmf_jp.gif b/www/agc/images/vdc_LB_senddtmf_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..06417979b669384bd5e83b9f0d85b72d2aa0b0e3 GIT binary patch literal 1539 zcmZ?wbhEHbjAamFIKsg2|J?uo*Z&`zckKVA|6dM&=`HO2fByfjsk{C^{oj$>krtHp z|LXt$_x@jAc{$W2bY|7edz?;Zqle1Gx6p~WYGxKbf-tXS8q>!0ns}yePYv5bpoSKp8QB{;0T;&&% zT$P<{nWAKGr(jcIRgqhen_7~nP?4LHS8P>btCX0MpOk6^WP^nDl@!2AO0sR096=Ha zAUmD&i&7O#^$c{A4a^J_%nbDmjZMtW&2GK4 zGRy>*)Z*l#%z~24{5%DaiHS-1r6smXK$k+ikXzvE3pY5gSP$$Wz2y8{{ffi_eM3D1 z{oGuTzrd=COM+4n&cLd=IHa;5RX-@TIKQ+gITff}8KxN+cK9s79CqqMXS7!rPLqkI+7h^YPH!~AMOIHI!H)ji& z8QAo?xH?*zI6FBz8<+#Nx*9qfnHad4ni(2dx*C}oIvK+Bdgc|EB<3Zj!tBii+6&d| zgjcVXb5UwyNq$jCetr%t1q5W|m*f{`1N{AbeZ0LqJ>1<~U7Vd99qjFF zZLF;KyY=Ddtm>vCRi5<6fJmV3Wq-TRvN|MxOD zBt-J?u=Nz3%(0q(VMU2otkT4WW6A~$A^RV^aFyv3Vqsmk{Y+ilF+U48z4*TSKVDhh zEq(m5KEJrotI@Z?r!=XtGN?K$ud}_ZtEsuYC!nXaU}kWCZOf#xB_-3l7Kf~uma`yx z^2+JW%jV8nGiA=?@_Bt36BaEwxOr)7@4?;EPPCQhO01i>aoOSJg&iA?w#*JWe_&JV z@hkT>HLZRyY3l8L3$Jf~eB=J3Lr?FmIkPd~&WyJo-hEi{=jJjE<21LstJBW%e7x=Q zI_e-3H;=#shmDJlc1sv%-8r#w@$p^(K9vI(9von5aR?9U8wmg; z;Sj>Tf+#_99vB0CoPvO1DZ$&sDRE+!gs{mE@Kv&vQn?gFMSxNoFH^9U9D+y!M}cf? zZrLUifH@O1jzjRb8~_$g9*ls17m4B_rZ6Y~gG!>(J(*1AMu0}4QpgkE_c~HtK6qKO> zd=3FSAxR(!Tj=S}+q{`dWeRu{0hLPK%%=-^LWU=mC7@7+Jnwmqw_#a4zPBfhjv<*C zRDfZ5RDp$!M)#+)X#9C>fJ}jkWMXh$7s7O3WBI>{W%CeFgu=)+7>=LMfRGp%g%vTd z9N>j{0pXBL0w*ghkMk;4K8Qd`phSqkQef_O+0a|mgQ`9F|8iqw%o(yJHU1-2 z=C`o?vrOM4KDKyMI-m@z7X&K|{Omvf@$$v8Z&H^Z3}E z+oL15ZVnF(nr;kS@9*pFF?M%#cC@#(witf8*4%XU%HMzdLEm_};Zptg7yowQ{9nI2 zclO)A)SWqf>ZDFvd!j~DU3I*&qP(p1SV?hFq55b+{*l9n@^W*s4}O!Cnep|3ufF_Z z|Gq!(O;6jCnxaxBCncf^BtZ_#r15dFP)zi0P$G^J{V8(SA3xt2vE#Gw?VoN73;jdL zC&58me;*j|@fM+g&)e+J-Q>sd^;cU|W~Bsc?3AAaDt z_IK~Ed2jW*4y#tKSiWrOJ4+TXvR`Poz}Cjv3Xj7%KeL(pt~OeF%a4g$Fv~s2A9b_B zU9C>g^4UkWxOOY{xT`xR@>QB7ZNvt2>J+2lCRvqg`=!;ACV*epF|B<0GT3Z>k)%pa zPv3js>x|5-z1Cl4W+yMiFS53?!8;W?l^iQAD<@VGosL(QR+U%O78O@(&eW8gtS&iS zjIYI?E;@FhzFu4YeHnhmy9?DWhL%_YAgl&GbL+ntotdY`@?r{>h`7pq=4a1LxysbceoqnzK_Ywe8qJ9HB&Ukw?{I z^yaRzONlR*05783#Q}TTNGolgh79>9IfR`xu0HK3%(}H}^pdMPv2|9pig`9wO$Gy2 z+B$fynY=48=7zj?H0*l2BNG}rv%_P}&m|1qony8F`=c8I3#`oR?y2uiHdOlA*2FFP zHo7g>9JTt&`|x0Ru6?v&NwZPQ*87p!AL%=8in1Z+Wn+P`>-Ma^%fVOTDdWL)s)qZT z1r9SU7be`xx1Nd^j%b!mUqlz@KV}vdEjzpQovufm%tiFstEzCvk#mL3_j)p(KQ#8a ztlqGE;7Nl1W~tZnZ0OVDPg{eal%IpL}C^Z&n&nF~aZC__hy_SBi ze&+H;o+)zT&blt-A^63R;KDDSrX5?{njAx4QUvOB1hO00HIiR-&6N1lfJ>o|&6I0F zMnj@!TTDS4)A>LPrB9D{a;WgP^Ny_$+cAeT#5q1QzuwN{F4b1$^2ckd^EQ20B+2{W zV5cPCC#RE`AK;f+eS~8*Nj&U(|GFl}f%_0=zk-YVu{i#`8@EJ$+1^}?G_lO3K+ojv zvXtRxHMq3Vi|b4FjoQ~%>^HdStyg`Xx6gJh-|$2A+O4r}c89iSK{dsJH?*3=QSQ2$ ns@-f|ZEa|vPNyylbUUd-3{xjG`(tBu-xWt_t(V&1aX$Y7!2v;l literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_startrecording_jp.gif b/www/agc/images/vdc_LB_startrecording_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..acb178915c5d52c076aa62a0d38dcfb690b9ae63 GIT binary patch literal 1620 zcmZ?wbhEHboX8-+aD;*3|Mma>&;9>@>Ho2L$G#l?(p%WOd)n^*Pycu1cKpBh|MJSq zp)R3Geo1#X-fhloo>?_BEhz2(`TuYCy^ZyX{r~v?s*Y9vZ~kWhnsWw3Vgkkg+!4M3 z3NDEyi9p)MzM>#8IXksPAt^OIGtXA({qFrr3YjUkO5vuy2EGN(sTr9bRYj@6RemAK zRoTgwDN6Qs3N{s16}bhusU?XD6}dTi#a0!zN{K1?NvT#qHb_`sNdc^+B->WW5hS4i zveP-gC{@8!&po2Tt~skz|cV7z)0WFNY~KZ%Gk)tz(4^Clz_Gs zrKDK}xwt{?0`hE?GD=Dctn~HE%ggo3jrH=2()A53EiFN27#ZmTRp=I1=9MH?=;jqG z!%T2VElw`VEGWs$&r<-In3$AbT4JjNbScCOxdpzyaD(%T^}rs|OU}>LuShJ=H`FuG z&&>t-3#_`hBq$Z(46Le)Ln;eW^@CE2^Gl18Q-R8rVVZ$qhu9> zlAm0fo0?bR>0+w{l+jDcOtEq^addWaGBh-IbvAG{G&FQ_F?MryGcz%?bTu$^bGCq) zflaTap{1Ltfu*yvfjLmCtD%LVvoX*Z15;-cH#bLf6PRAlyyB9?yyR4vy_rCJp?aP0 z>a}t%N=+=uFAB-e&w-_YfQBj{OXcglv$RV;#QQO zs{jsNt4u7myO|R5HAHU;IU%MGbc{YIX&@yPm=G}iftc`w59GkJPHG-7zZ3y82IK#K zfB*dc_4CK~Z(qNB{`B#~`*&~Oyngla#q(!RpFDo_@WK6ickkT3b@RscYgeyazI5@z z`EzH_oIZ8(#PMTCj~qU9@WB3kd-v?#wR6YzZCkf&-n4PU`gLp9tX{Qp#qwoKmn>ei zaKZd}bLY&SHFL)FX;Y_6o-}bne_wA;cUNaeds}Nub5mnOeO+x$bya0Wd0A;maZzDG zeqL@)c2;IadRl5qa#CVKd|YfybW~(Scvxsia8O`?zn`ygnoeYiVkztEs9eD=8|-%gM?}OG!$Ii;0Q|3keGF^YQX%owu>OCb7?hGZFJslZoY(sbbY_Q5PzhW2zUKY^0}Bc~ zbfo&N9TE~4Ig~D}DDj#aw{AMex2&~6JFn)JNuQmzH^8{+Y@Rc7SG#e;%G>XM?1}B! z|Hd#WqPDuOzBIh8wXLe5r?IPN;v@+cX4c}#GuxZWyC&2$G*01FxxMM_gMHWQJD$FN^ZfGOi&yX8zxwEArFy`vJu&Qpk(;-B zU9qiwaiB6-B2dAx@wwgG&!q(mEoyiFx#)d;^@F+H9~Ttsc5?_O>~+zv+^DR1@ri@? zv7m2?GU44BWFOR~3 z1qU2jH)mX46?=Ny+S}U;9-o@)y*)3AMS#a5!C>L~`}-T1x#fIzY>;nwRB?*w+G`YMRv=(AV zO{`)eAU-e&U|PXZbfik5=zvwg8bE?Ps=TGzYN?OfR(peD`@_{)YgW&X^ZdU3?S0PP zXH^6o#1iZV+<FMk1%g@gj3Wa*TzO}WrzrVkwrKO~##A>yQM4}rv zZa@$;F)^XlY8ebhQc{x1WU8&LO-xK2A0O9fG%}fNbab?_u`xI}I3y&bsi|pfY^=Mx zdthKdtyXt-b^-uku~_i_?`_^soD=v_AWwh^@G)d%wn89GLohHI5liJ9!VhN}37}NO zA;bsrDSQQlNTjQCl}Jo(WUMeZO~?`vR;~a;vf0@(g$%(2V74q>u3~3%2m%qBjIi;! zZJSI0ry*DxhrqQRfHqACRU%*@iQ+G$Feo5{N}>kPnM~$#kVc_W$P^lxO7o{O*#R^* zg#tcn1YAuiN?}Ly;AdL+ibIfKn1W3vXJuuPvI0n`QcR|@SS*_j8qFU^_^Wc{m>}C< zt|HD@;2|oZQmVkDs2sFe6eOb=7>9s+`ZNTYg3o_$Sgs;X2SgI0GIF*+L8g)@WSPts z*ECv%MI(Q>@j|pJHb;SwqY)LFp%fxGoH#?q@9wXKY(U%__By2$e-uGF4;5y}5IGjX z;}Gx@l1M6I!!#}w7DlBq!y!sIl}Zic1;7x@pi^1l6edX@&l4YCJTDzYj@OG4FN|4F9{=|1FOPnH_~8D%pQe7id*_GmZ{PZE^5(?& z*yzac(2eWg4i5D9UF)^>T^{4-H z>SW!C44AMWvzq z=zhb=W9GyAP6G!|*PU$!<}I*y1{M<*x3yhrzuew&#ZpcDW^oUp=c=jWV&7$>rEg%+ z+H-Mol5qQ`rFY;v>zymNZ{KoydA7YB@X&gTZ+PJ1Wk!bd+K*HC`|HJXE>%3bANdAP z<@72e&#A`qysoQjiM5C9zFOiIIMjLC6+EeMao^+oKs(f2I21S3=IEAq_DSKbG3jTk z>aKsCLUac2jNe@nRP4>n-4QWW#Vjy=zrH^uqaWTjuWG}bW%tY%b?|!ltxa3LiY^)n zWvka*Mi_N2uOE-C)V>oZfA554WDUKac4$$nlrKg{+j81n7esAuTYBx%`q_~V=1(bW zn?}!j*Ju)|!o(gM;*2d151c9Ux^gYUr}t=MgTJ^%mp8vMN}u2!KT>%wE&hOp13liD zFw}6B6VI-RKO+(!Z_nGh*6D5U>-)a++d91S*ra5*K@EFMxW1WmuQ;uvsIB&Ry0t#% zMDRnM&v56>4S@rK>X)#RL`)X%L2uqoyN=9q;n}ItLQzG*k81kfEZ58nr}pQ!nhH8K z9?5kvA?`G+L+)39s-O1g&J@>fA+~8)yQoV)tPPyh8yrLLPZ+e&{R@WOp^t+`bSp^p zL|vq3>B!!7VG$!m5pg*t-Nwff;%v8Au-RdL!KSfNN#&8TvUE-8mNN8|pSV2T;1C4^lHY literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_stoprecording_jp.gif b/www/agc/images/vdc_LB_stoprecording_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..4ab720fcfdbb54249734a674ccca3bcc47a1ec8e GIT binary patch literal 1604 zcmZ?wbhEHboX8-+aD;*3|Mma>&;9>@>Ho2L$G#l?(p%Wuk=ybA>Hq)t{_mc)JJcog z^2*C;L1{5wF?ToK-Q2%I4yi0i)elN7&Mz%WP6aAghG_Zmy25j;2P=2IfGmu7*w~PHwK2CYC0y#+F7FCN40&o_WP3iFwJXFncqB_Coa< z;?-;AT$Gwvl3x^(pPvIu0Rb8LCHch}`2`Bj!KMn~nRzMs<;9@Lf%w%WwJ5VJHN~wc zKUV=9x>lK3Yyv z|Nj2@{p;tC@87({PcxqRv3 zh4bgmo;iK$#u35cm<%;FYmM&Sm zXyJnS^XAT(J!|HS>C>i8nLKIYg#NzXp6;&Bj`p_Jmgc6$hWfhNn(C^`it@73lH#Jm zg8aPPob0U3jP$hBl;otug!s7FnCPg;i14t`kl>)e0DnJUA8#*D4|g|L7iT9&2YWkP z8*3{|3v)A56JsM_rqt8b(bm$`P*+n`QC3n^ke8E{k(QE_5El~_5f%~@;OFDz;pXDx zU}s}xVP;}vU{L(Y0xoiNKqRO{V_^ONKrtvKb6&=(bvdv173j!g3fTcx`9{CEhLF zcmDa;h_c%Hnuf@xijwB8hR(in7G~Ch{;B0LHAUT3#ck8;XUtvH+Sb@HZNLch;RF zbxZF&od4+L%BWJSLdvx>l z@%8bx$t^jaChUa|c65nre)IgXYN4|m%i&bz_@pWdNaxF;dy50~0OF>)Z79t=43kn3PBDJ-xmC^}{-5);P=hF@8)$;mO9OxfAlI-RbywRLQ4 zjKN@_C|XidvUl&^*x1hFR zY+`QNrb6H>L>=V=aV-a+MH9u980blX-9<111{nwi@t`xAOgE4QBQO=FQ4yLu!eo2U z*f0z}{~$t5DVDHi^a0opwZk3gu5zEt`=(C zyux8{^{|LKRo(=>fz*r`}e+^7&niN zj@-R7JoN4D!2whMt-ju#o5pTKS7%3i+l}kre0}X|Ys**7UtVcyY`9#1sqW&1^XJa~ z`^>+-sQtX=bamBdl@;Y>r6s5I#YKhxEXY5ZcOo|@`}jYyj%8+~|6O-9?MQ0M;ZKtf z9sK0uq>mC4;y?UA8>fjq5TjNp_bYI@EIKMu8WAqR#G)|azP)>P|83X%J9mU`-xjhp z_&vdvpul%GZwlDBf$z^l{kXpC-|^vivsqqDh9}*FMl>bG-R-aI)~A2$6zbtpKU$%6~D~lH`v|C_nV?BSK6#%&WVm)MUli45Rc2LO04mO0x&$p-SpYy}a$8#m)YWbz-R$dVGPSp74R&|6nVN>k zBc{%ddxH;#?{z}hb|~#e#&W6OUmFPGO#9He>u*XyNcx z>+$2}qI>5ubDOfAHZPxENZ;dq5{-$x8@GR8Tjo=ac6w*#a#s4X8^NTtjs=`Vw>;$F z35UGCc$=OHr7M@d9L(E2HAl`4~-cPaZu#COD-9NWA)lcx;-o3bM2NLKN3`OO*JLYua9439DU`q z)k0;>_9_iM^8DrdjZNg(E!vHFx65vjPd-}JtG~L+wI(O~;NA1r>z%rzr;GR9e%Na> z?bSf#Pnm}tcc7*VhEOzur6;6kS*1Y4mGRL$ zWoqtNzP61ev9|Xr1ZlsaCL{Kk{=vfTG? djhAIPZ(3Jgu<4exLeIWfS&`4^@U;iLe+RySI}`u_ literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_transferconf_jp.gif b/www/agc/images/vdc_LB_transferconf_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..eb6c7f6375bed14c4a80205390f991e62e6e3c49 GIT binary patch literal 1584 zcmZ?wbhEHboX8-+aD;*3|Mma>&;9>@>Ho2L$G#l?(p%WOd)n^*PyheF_dnDnv?I6U z^2*C;L1{CqW;UcXENNbHcjMjv=l{Rm_xAtI|EoGy#d^j5fBc^TXwDfBi3t?{b4U0F zD7Yk+Bm!w0`-+0ZI4yi0i)elN7&Mz%WP6aAghG_NUly z*UGslHL)bWC?r2W2bKZ?GV)9Ei!<^I6r6)i6~Z&~Qu51-L6HOTt4nH8W?5>ATTyQsQUuHxjQ{`r z{qy_R&mZ5vef{$J)5j0*-@SeF`qj%9&!0Vg^7zri2lwyYy>t84%^TORUA=Po(!~qs z&z(JU`qar2$B!L7a`@1}1N-;w-Lrew&K=vgZQZhY)5ZeMTG_V zdAT{+S(zE>X{jm6Nr?&Zaj`McQIQehVWA>a~ULI~PP7Zc9 zRu*O^Mg|7OpDf@aM+ZcLN;C%6{|^+SQZnadtXh}zdS8Lg?BE84;C1h7-v2+apuj`t zo!&w2OEZ{R*n}GtoYqFIzs6m5`fb(z2Oq*aL$fwN@<_Nifz9B<}irT4|((|WJ?5xv{TuiJN`er9UPiYPd7+DHOF)Fva_=- zieJsCOnmOk!6uRrk}aNUtgbaxJ%Z1 U+nSr3GcK=+{cY;lB*0(|02Qx&5C8xG literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_webform_OFF_jp.gif b/www/agc/images/vdc_LB_webform_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..1dd7a9edff4b1143746523f792858b63b92352a4 GIT binary patch literal 1472 zcmZ?wbhEHboX8-+aD;)OprByx+_?u29$dbBxwEtLp+kpqa&l5rQ-gwnnwpv>PoA8W zmDShRS6NxPVZ(-b^XB>a`AwQMslB~@&z?PAUS13g45v<=0+P6Z;(zW4-v9-d#F9iH zZDU_ikeHmETB4AYnx2_wtMq>NekFy>6kDZmQ(pt$0_W6>OpmIf)Zi+=kmRcDWXlvK zdpiZ23ag6Tg51=SM1_jnoV;SI3R|Vbl>DSrDrlU}Ruupl@KLZ)l`zXl`X}WMyEW00l}w+lo@stb$zJ zpmqUywn`Z#B?VUc`sL;2dgaD?`9* z7iAWdWaj57fJ{tG$}cUkRRX#c;)UD-UthSvdBu8Q59uZ6=jvA^7U&!58R+Ncg8T(m zU0f2Bif{&2)x{x|1*!T$sm1xFMaii^<;pP4z_7z_5lA7>HCFybnZQU%%yG$2F3nBN zEAe!(RRYTBrDUd9xmvhbnz&iInwvWtxEdN7I=L9TIlGye7+Sg-7`i!Iz|6p=*VN6~ z)X2iX+1bF{(a_M<(9zk<#lq3i*uv4m*xba$9H!SZuec;JFF6%vZzj-Qs9q<$daay` zQWHz^i$e1Ab6_bTAS1sdzc?emK*2fKR3SVwFD1Xc7!)}Wzq+IrWtOF;xE1B+Du6@R zDie$Cu8xF!4bhuIPKfCP9itCQ8c0b6CIn1>ASOKF13B=llbQ$2FGawN!TA5*-#@>9 z{rvI$+t)9jKYjf0{@vR*uV1}<@%-7-CyyUJd~pBX-8;8$-Mn%A+SMzUFI~KF{@mF! zr%#aDv3%LmC5sm=Trhv$ z+&Qyn&73iP+SDnNCrzBt-`CsI-PPIA-qzaE+|<}mUsqdGT~%38URGLCTvS+)pO>4H zot2r9o|c-DoRpXl9~T=F9Tgc79u^uB926Mf@8|2|?d9p=?&j*^?BwWRZ)a;`ZDna; zZf0s?Yy`}ddb&E=TACW_YN{&AN{R~dakF^%7zY==_V5ZxN)4{^3rViZ zPPR-@vbR&Psj#ZZEyztRNmQuF&B-gas<2f`Ovz75wF0t1!um=IU?nBlwn~m52?day z&iO^D3Z{Any2%D+1`1||dWOa(=H}))3PuKo2Koj@`i4fjhUQkrMpgy}3Q(W~w5=#5 z%__*n4QdyVXRDM^Qc_^0uU}qXu2*iXmtT~wZ)j<02{OaTNEfI=x41H|B(Xv_uUHvo zf=g;~a#3bMNoIbY0?5R~r2NtnTP2`NAzsKW@b!fooL8&|_K;q3ey)B+Vu8M)o`HUD zF34YC)x{-2sR(CaRb3oXS&*t9lvGqEL;pMVR}9Dic1pnl2c*!W`gX6=mpw} zN3WH0QEFmIeo;t%ehw@J1Z3ow6A$n8D2{C=3WAs5u11YJ%gn;P}#Dph&AP1gxQuBcMr3jcY82|tK z`{(zspFh5T`}*bcr;i`rzkB=U^{baJoVgsyL#pFrHdEN zpF4Zz^r@34jvqUEVojbN~+qz}*ri~lcuUorj^{SOCmM>enWbvYf z3+B(8J7@N+nKPzOn>uCkq=^&y`+9r2yE;4C+ge+in;IMH>uPJNt12tX%Sua%iwXi?qaq{1!$L!Xg8~Em{d|4Ay*xeK-CSLqog5wP?QCtV ztt>6f%}h;V~xOjJZzNKk;EkC%s=i<5($ zjg^I&iIIUp@h1zo)X@Qvpc0LN_5K6ZzLd;)8LQUiyxv!!bADav&60Je&&_*eCw(DY zS}3^r$io;%Tz5np>i6A!%D;t;Suitj-Q?t0!$3n E0Q^ib#sB~S literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_webform_two_OFF_jp.gif b/www/agc/images/vdc_LB_webform_two_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed77049c940cb88d05f2e9df32ce2668d4215bfb GIT binary patch literal 1479 zcmZ?wbhEHboX8-+aD;)OprByx+_?u29$dbBxwEtLp+kpqa&l5rQ-gwnnwpv>PoA8W zmDShRS6NxPVZ(-b^XB>a`AwQMslB~@&z?PAUS13g45v<=0+P6Z;(zW4-v9-d#F9iH zZDU_ikeHmETB4AYnx2_wtMq>NekFy>6kDZmQ(pt$0_W6>OpmIf)Zi+=kmRcDWXlvK zdpiZ23ag6Tg51=SM1_jnoV;SI3R|Vbl>DSrDrlU}Ruupl@KLZ)l`zXl`X}WMyEW00l}w+lo@stb$zJ zpmqUywn`Z#B?VUc`sL;2dgaD?`9* z7iAWdWaj57fJ{tG$}cUkRRX#c;)UD-UthSvdBu8Q59uZ6=jvA^7U&!58R+Ncg8T(m zU0f2Bif{&2)x{x|1*!T$sm1xFMaii^<;pP4z_7z_5lA7>HCFybnZQU%%yG$2F3nBN zEAe!(RRYTBrDUd9xmvhbnz&iInwvWtxEdN7I=L9TIlGye7+Sg-7`i!Iz|6p=*VMqm z*u~k{z}dju(a_M<(9z7u*wW3?+0n(s!o|(d1*X?Cuec;JFF6%vZzj-Qh+ZQ%yn3yi zi&7Iy@{2<9^K)P+ARr^ZB)>Q#zd*q`*i<1rGcP5-yciTY5Wl*l7G;*DrnnX5=PH0h z*D4c>?XH%Dd=1f?LQaV310ACeN*YK>1ttVce;_72;R8AFtdp7t%r8a2jKTQ--`_vK zfBpRN{oB_spFe&4@c!M~H?Lp4eDVC*(TITuzuazHLF*xT(NxF(j|)*EnF~v z-rPB}XU&{3ecIG1lP67_(BIeF)7{nC(caeD(%jV8P+wPDQ(aYAQC?PBQe0G6ke`>E zlbw~Bk)D>ClAM&75FZyC6CD*95gryA5*!p5;P2<_Vr&G=lzO^4+FF_#>T0Sg%1Vj~@^Z2=(o&KV;$osA!a{-q{CvDT++3U->};$o z%uI|742nNlzy*&Ehy;~r46M%` z2Pamlw3JrodDj6;r?i6RB=f2Y>)iPInSHbC+j`p5?559XRWDz@aI#VN{Ej74X04nW zxxv6WVB@+alM|V^&0Dwc+`V`I!DT){ zZZT#ap_i{-zj^!a{fCdAK7aZ8?fWZEHV!U!0TBjfE*Xyv3l27O2y4Zh*s##Kk%gm$ Hfx#L8qk$#M literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_LB_webform_two_jp.gif b/www/agc/images/vdc_LB_webform_two_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..a06decedb824036e43f8a1301ff1311634be97ef GIT binary patch literal 1479 zcmZ?wbhEHboX8-+aD;)Ox3~A$v14Dpe7Su2a(a6D&Ye3O8XE51ySI7s=9x2RCM6|x zbad?4v7@c6?Zk-_p`oE)zkXe^WJyR!$f{MV-oAYs8ym~O!0`Y7e;|n!DE{Y;@C{IK zNi0bO(l+)L1&PVosU-?Ysp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZ zPPR-@vbR&Psj#ZZEyztRNmQuF&B-gas<2f`Ovz75wF0t1!um=IU?nBlwn~m52?day z&iO^D3Z{Any2%D+1`1||dWOa(=H}))3PuKo2Koj@`i4fjhUQkrMpgy}3Q(W~w5=#5 z%__*n4QdyVXRDM^Qc_^0uU}qXu2*iXmtT~wZ)j<02{OaTNEfI=x41H|B(Xv_uUHvo zf=g;~a#3bMNoIbY0?5R~r2NtnTP2`NAzsKW@b!fooL8&|_K;q3ey)B+Vu8M)o`HUD zF34YC)x{-2sR(CaRb3oXS&*t9lvnOEes7^4J}+PU0h9#K+wg_$ifV!*E6rUBrz{J6=rWH&|ausW4wB; zoQqNuOY)0C^7C_GDIg#tza+mnBfmhwIoMPoJTosPzq}X}IS{|Pq!wkCrKY$Q<>xAZ zL)R)3i|s&%67V%dZwfgfrVn(CJ}7A*B^8(uF#Um;@PrTKz_U(j9x%TY0W${U|9^k~ z{QmXx$MeX-RQWVL^Ug zZccVqW=48iYD#iaVnTdeY)o`iWJGvaXh?8SV1U1$uaCEvr-!?ntBbRfql3Mjt&O#n zrG>efsfn=>FjMO3>S$|eYN)HJswgWdD#**p%1BE|N{EYziUOd!X8vk~uG9)w-P5`wDc}{4uQYT)c;K$u`*cke%Z{Pg+D*Kgln339WrvT=zrFmuUxY*=uxnL}7B=ER1D&W%EH IEes6S04#4XApigX literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_blindtransfer_OFF_jp.gif b/www/agc/images/vdc_XB_blindtransfer_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..8a6e08b824a68f56bb747e720437a08adc882878 GIT binary patch literal 1832 zcmZ?wbhEHb>|_vNIKsei?AWp8%a`Zp=Pz5f%-r03&YU^3XV12v4q}24xJX@vryZ0+8WTx0E zg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyvDB0U7*i=|mOF1ees}><76{9OHt!~%UoJp=vRT#&!Os*6j4QW4I;s=7F&vLIDID784hv?w_hs9YJQ z85nl>EdnV7y2i@CC=(bdi8(I$$)&lec_p4Mwn{)5y_C!pD^nv!OJf5A3v)AP16M;s zLnjwwH)l696GKZ^14B1w3z!+$^cp!D8@d=-Iy)Pfn;ROs8d?}ynp!v-nY*|cI=h*h znZfjW<`tJD<|U`X?9Bw)3)Sm{SFe?GQEFmIeo;t%ehw@J1Z3ow{v&byD+y`K1V$F&O{<`}^njub)4@fBX97^QVs=-oJbM=Jl(WFP=Yp`sDGW zhY#-GyL;#Mt(!NlU%Ptc@}-Lx&YwGb=JctPCypOGdgSn-g9rBS+q-A?uAMu!Z`-%OrteG>WPn$Yr@}!9q`ulo&y1P0%+S^)N znwuIM>g#H2s;eq1%F9Yiii-*h^7C?Yva>QX($i8?l9Lh>;^SgtqN5@s!oxyCf`bAB z{QZ1=yuCa<+}&JVoShsU?CorAtgS48iOST(*a(;@^>lT#wKO%<)l^lKl@t}^(aHRH_X|lRdsl`_wRL)dTiRi%Jf577J3xSYg}I9wKi(~jqE8>9aWp}yb7~^ zHsxTN_E95)ntO8R-T9WEe*F1Qwg3F@Pi1B6D(VWV+pEe7Ydbrto9bKo%6q%ZDyL6p zVqs>THm$9ut$ay+>-6HrRZZ%_XTWZ>_QgUmPnF zAJ>1LD07}i3z`a^1#T+t7FF?FrjquiG*eVRbFYS!4eO;_i%Rn1_C;&RRgj?TeT1mHWr@{?3*OTF-xJZYX|r8ukE+Z3`i9<|HHJ$Tq5 qIm<(-U2fTrg`HYmH|_vNIKseCS9fXS#{cf_<;$1_IpxZg|LN(gjf{d19r}On-2dF%t(!OhS66prU|^Uz^FNTp1r+~tNB9OPxFnV& z0%;rjih{)C?9>v4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyv zDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1Gr=Xb zIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mdyk(bCw!z{1?j*}&D%(9p@n*v;9^%*4>r)xglr*#c$;Hob;! zmM&(-#?HlK3Y&SI~yv|Nj2@ z{p;tC@87({PcxqRv3h4bgm zo;iK$#u35cm<%;FYmM&SmXyJnS z^XAT(J!|HS>C>i8nLKIYg#NzXp6;&Bj`p_Jmgc6$hWfhNn(C^`it@73lH#Jmg8aPP zob0U3jP$hBl;otug!s7FnCPg;i14t`kl>)e0DnJUA8#*D4|g|L7iT9&2YWkP8*3{| zV4^ZLF*X8bNqwaWPR5VIe^Qem-6vZZ1v^b~aWP zW+p}k2F0H&;DSd7M1o2*2G;)zF1e&+&dXS}F6Z^WfRs~mhcjlya6h-?NM7L$t^!j(tj4P-qX`RqMd3s&ioPgOYs@F8Hi|m*d zQd_uX#_Cn8gBOKNT)#Y^xS_6b-mZkCp5q7CF4?{4!j}Cld#ZMx-h1Fo`_+rtE$a{M zx_)}Wo!tko?!SFx-K*XwyI#Go+H>gsyzO&7-uV0Pzt|y}2!(|U4mNWLYsH+{u<&rZ kfU;N135LdIb`hhjJ0~_SKHjh3+$H0=X^H1#MFs|I0G{ebD*ylh literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_channel_jp.gif b/www/agc/images/vdc_XB_channel_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..316336bc1231b482b79e45de8643e4fe5ba16b06 GIT binary patch literal 1250 zcmZ?wbhEHbbYb9QXkY+=GiUxQ{^ySH4N!1NEJ*~?Hue<-iOJciB??KY>6v-9O7C~? zS5nAKu~iB;^)>JFRfC7_I6N@j|csez-Vv4Mew zxtX(ptD&KxlZ&yNvzwWTp{1*Vp_{V>%nWRLUCqqhj9d&Ioej**3=Lfk9Stl@oXs4a z-7JkwES)SZVR}9Dic1pnl2c*!W&-Vn>b1nH*UGslHL)bWC?r2W2bKZ?GV)9Ei!<^I z6r6)i6~Z&~Qu51-L6HOTt4nH8W?5>ATTyQsQUuHxjQ{`r{qy_R&mZ5vef{$J)5j0*-@SeF`qj%9 z&!0Vg^7zri2lwyYy>t84%^TORUA=Po(!~qs&z(JU`qar2$B!L7a`@1}1N-;w-Lrew z&K=vgZQZhY)5ZeMTG_VdAT{+S(zE>X{jm6Nr?&Zaj`McQIQeh zVWAn=9kd5;dw{bz04icWgm3SU9?c=)Dth>d+V-o1*Tan w7U0}lS|mT6-EFa!teBYLV`;bDYO!CwdalZTX0jx6v-9O7C~? zS5nAKu~iB;^)>JFRfC7_I6N@j|ciL0Zfv4Mew zxtX(ptD&KxlZ&yNvzwWTp{1*Vp_{V>%nWRL9nIYwjf@QqoDIy)3=LfkEnM7OT^*gw zT}{kP%#2-)VR}9Dic1pnl2c*!W&-Vn=rwS|tJli8C^fMpzbGU>KL?fq0y6ST@{2R_ z3lyA#O%=j3^HTE5i$ReC@vBQ}QD#|cid#{Bt^zo8tunFLZsJDB*ATra?I;nZU{89wW7>xh_{r&U%*Uul{zkU7k`P0V_@87+B^ZM1x z7tfzPee(Fx!w2{8-Mw@B*3BE&uU)-z`O?J;=g*xzbNbZD6UUDoJ#zTa!2|pE?cK9` z*UlZ=w{6|BdDF%X>({MavwGFa70Z_`U9x!5!Ugl^&7CuQ*322xr%jzQdD6rQ{e8VX z-Cdm>?QN|s%}tFB^>wv1)m4=h1nAc$w`R`@o}*+(NU2R z;bEa6!9jrm{(inb-d>&_?ryFw&Q6XF_I9>5)>f9lL}hAXYy`}ddb&E=TACW_YN{&A zN{R~daXkqt&FNH?0uQ{R(iSN;`X0~zuy*VD0DxQ{^ww< j%5z-APJCC;ms44%V!Y&6Ssl%_jq3W@_IpxZg|LN(gjf{d19r}On-2dF%t(!OhS66prU|^Uz^FNTp1r+~tNB9OPxFnV& z0%;rjih{)C?9>v4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyv zDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1Gr=Xb zIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mdCl(bCw!z{1?j*}&D%(9p@n*v;9^%*4>r)xglr*#c$;R=qB! z28L#qj?M<=W`>5YhL$Dg9{)&z?Sc{OI9>`}gkNxqa*AjqBI0Ub%ef;)V0)&Yn4a z>g0*z$BrI3eCXhT{rmRr*}ZG$j_upFZrQwP9c?X54RtkD6=fww1$jAH8EGj=32`w|5n&-g0e(JS9&Rp94t6$H7G@?! z1_s5SEZ~Ai2SkEOGzQk~3of~&WX{W2wJwKS(9`g2N$&lMb?FBPTuGvm>>#wYj%@N<(DK)Ctwi-5n)aG4-_*+j@#8cgmSFT)cGo%2gf?K7NtgckbT1|KQ=H$4_o6 HGFSru+CCJ0 literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_dialwithcustomer_OFF_jp.gif b/www/agc/images/vdc_XB_dialwithcustomer_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..44e2d4960b428c865a476d06a838b0611c58705e GIT binary patch literal 1891 zcmZ?wbhEHboWLN!aD;*3*s){FmoJ|)XU?)^%kuN{&CSg%EG+W!@|G@LI(zo)DO09| zhligzb4Ei$W7DQh=gytmx^?U1$&<^<%69D75gZ)s;o+gGsu~j$6B`>VD=RA_BXjiV z(G@FJFfcIm_V)Jm^(p@6j_?goa7ipl1kyJ46$OdO*{LN8NvY|XdA3ULckfqH$V{%1*XSQL?vFu&J=B$SufCElE_U$j!+swyLmIN=(U5 zO0@#ALBje<3ScEA*|tiKAPEJKozD41sS2ig2D-@xW(EpohI)p^CP4q`C>R+S8t5As z=^Gm98k$=f8(A3`C_sS{(6*wKG^-#NH>h1eo~=?wNlAf~zJ7Umxn8-kUVc%!zM-Y1 zCCCgTBVC{h-Qvo;lEez#ykcdT2`;I{$wiq3C7Jno3Lp~`lk!VTY?Xj6g?J&iz}FXU za9*(<*h6~B`MLTPi3R$GdItKrxgdXmRTq~8r6QbxRdsPlWkITbP-=00X;E@2P`NTp zGcfG%TLe-Fbd8mNQ6?}_5_4SglS^|`^GZBjY?XjAdMTMHRwj;)mc|AK7UpKo2CjyN zhE6WVZq9CICWe--28M3V7BDlg={0n;a5XWr1nM+5GcP;d@5RS3__ zOUW-U21O3UuP&)YnPsUdZbkXI3gFPS%EV&3i4!4TL-eMQ6Jq*6$LNES22xUi2?5g| zhzU>lKn^_Xq~-zhOA#<*F#iAd_s{QNKYx7x_Vvr>Pai+LfA{vy>sK#dJb(7|$>T>4 zAKbrp_s;EGH*Z|OcJ<2TOBXMkKX>-b=~E|996xsS$l*f=5A5H!chBx!J9li~wsp(q zO&d3?U$=J6>QyUOEMK;C$>K!|7tEhGch2ltGiOYnHg(G6NfRgZ_x1L4cXf8Ox3#u3 zH#IiY*VWckS5;P&mz9FQ`}X=h0;wtZJ(di&FXGMwE+9IZFZ?<-wEn9v+Lt>3? z_t`6jQLCP5XfQWEf4uVY%d$PT_5Z&-Zzye&ZK$hjYAmjjZIkUQudZmXYHOX+)z&W8 zQ`IFt|K?rgaJa@X?>Yg_7fZJ8x^zVPhgY10<> ztb70d_Q|4;+*ds=uL=GC!LjOlue@o|Vzt6WD!To;{OmkOCNAF~bli8thS=&Yok=IN z8`=Ip%39_-Un}NV%t7fdr#t^13OF#&$^Qz+I+ONIVf$Sk*6{{?KYw*wzyc0l zANF8bpLRBPuU{NfrW|9rBp0^&#EWoqSCwoj>l`TudF1T4k$HP6f1uSQap5YP8^;yZQ>U+%H5OYVFyG0>|KXEer>-ZiEa)w| zx2$-kWt-FLIGdfNNjF2=e>ZKZ?%%L5NZQ`MxO`y3Mw6JnoQtWs%&kxGutxnLA>FBb$`W%7c@s;J>M9|t}|I^b~8yN*3I`seCx&OJjTQ_h1udeRMz`!tb=6@iG3n>2Qj_?goa7ipl z1kyJ46$OdO*{LN8NvY|XdA3ULckfqH$V{%1*XS zQL?vFu&J=B$SufCElE_U$j!+swyLmIN=(U5O0@#ALBje<3ScEA*|tiKAPEJKozD41 zsS2ig2D-@xW(EpohI)p^Cg$emItoSxh6efuM*4BYKH-(%K(+4_6ACxqZk_t=+nEpUac)|yA;8`a%513zyfEk1F|G&R~e*gOU zo>*T>t-)5G1()y3J#(ZSx%*2db(5}2q= zO^l6znNm+zM_Wr%LtRZ(MOjHvL0(Q)Mp{ZzLR?H#L|8~rfS-?-hntI&gPo0)g_((w zfkE*n3%KCX0g<2*je+(5f=ezbne#GMt;>16uRv$Ez(kSYb?-?~ZB zV1vc{3oA;zTEkXFoW2_QGHw5Z=Vm_J7+B62Z9RQ$+v4QR7`boLo|jnMUT3y=c5P8^ zbxd_jSVUWBVOx7tOjB=7Qlnpb=G2bX2}xZA-LonqlcOuyG5j4%>PC*5Tky$99yI-3+~W zsrT}v4GH1r?=OFU_V}s0wNF>RX|DPFF8k)4MQ?U(y&d+x-!k^gj9%&XH+R=G{^>HD zlk{F(wf6aj%B&T~uDN9YRj6C3v3AMHN%F=9b1gSGG@YJqkbG*6=jLT+XIm7%x^q%k hjhTf{EEe<~7uAOCvgxXp{YGi`kDm5<_Wk3%p5OVMbKY~#Dp#f*g`JF= zg*uNyb#!#_`TWw-QU?czh=_>D$jGv?GDk;8l}c4yThpDV0iOM#kcCeLoK`z=bVi zBkM{BxtPrjgk%5*+R7KvFwg26FaV!N!}!{I;6222D1g5@Oagg_t?}W81#&4ojDtO} zQcjf%#X?BN2IRsZk(4T@Vc0yF15uH^<{F0qCPZX`G>ntx0nl*LVF?7-V)52oJP8kw zKrCoOB$LTj009r;ad-j_Bv^xFsttjP$0LSM3=G01;ccO^T$rD@kP{6PAd`uyI9y0b z2sXq93rn`*KnjJT(Lo?sBNEoqP?3x+w-!m4Oloj}q+AJKEaSr>K%y>GyoO@bZ=Y0moMVMAyUofeDu`?lJK`f zJf;K|0u#}t^1r}t>-1kf8p@P72&+c&RYy&QS*=ksSzpZqaAH2C=UM-Lwi+`o7CPXFy&H~Vh%_H=h$zjpOX zXGeS6<Z-~U73IgvN{<~aIZ|A7_)wwpU_pM~ zZ@D=K_V4>OdvDgB%#8H3-Ki zP{0q^x&`8KIc)!*H~+M0QzjJ3*Fht(ZQa!as`!Q zM<&@4Z3swFVy&&dUv6n(zRYat63k*?(Lz%b;|24L=FK&n^PR!$Su?+#FVA_tVwnr;R;I@= zSX@?=pH+6N4K>U8Nbhjg=q)$prgEdc+ZpwDOAOo0BGl`T$~WfT&nvUB(ELu=2|D$K|<&M7;jFsW84 z6Jx6DGU9XU50*z&nVMurB<8iK8WlPvT2-Ar>WjN0Y)-N{wgU(PS@Dedi7 zs?*{c(l1qAC@(_m9?cxNd~xVX!t&FHMRY~8E*_c?%Maz-FS6|#l|p}y1nc44$G8;1@k-2O1-GTGw9ph`pXL% zQ7@7W#XewO_gMNU!z!yq>6SG_B*`AvubWvKC27HJRu}6};e_wA+(H$i(@Cd$)a>pw zjQQ*7!!MffCrt-E1UnFKo=WCONpfz((+>BtImZKY^L^gsjJ6Yp4c})r4`y98IVP_gzL9_pw{_^O(wVK3 zb~aLHZh-$(t%Vl;G=;9g1wetGnwB3kd%0dg>@0h~g6IXTUjG>VZ;K0d=`AZpp$+Wv d&n8-_9^X&Gw^$4$6T1TjQtTepa`aFu{st`P<3|7h literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_hangupbothlines_jp.gif b/www/agc/images/vdc_XB_hangupbothlines_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..05c3a164ca5b7b044d1d79cc9d7c13f686b3a021 GIT binary patch literal 1572 zcmZ?wbhEHb>|qdKIKsg2cjLw~clQgmwSSf^`*-EapLz2pMMV7FzyHtt`G5E9x!K$t zWN5fDE$#22LrYUqB1}#Hojdn;)27WiIS%UT3=9l^X3PMRc!1)6?g-xi1((Eh+i#(Mch>H3D2mX;thjEr=FDs+o0^GXscbn}XpVJ5hw7AF^F z7L;V>=P7_pOiaozEwNPsx)kDt+yY-;xWReFdSDOfCFkerS0onb8|oS8=jMX^1y)^L z5|oN?23FO@A(aKG`a!A1`K3k4sX*n*FwMZQ!*3BtA<#8e{zaL>U%h}$>=IY|?yNW6f_=_C`=4G` zSCyKU*3=N&&=Q&B(->InU*lcg-W?NE)H<;=ZvLds{>2rG+Llc7n-VyqFm}bv?xh)P z%5oPhsbAle4%q4|3}{x*WQW8`sXM(TYWA+dB?!za?~oRV9ljxXIm7%+M~qQ z$i(T;%q8o!WyQtC9+S0VPiBq805nJ)%2-!wDsxnCyPMJ!T^ zMHq#mTyhDqySgk|ccyelTSB#|E&Gkq?jJqv^X&V_dp*DNJLkOT92;AvDVddsQbDz$ zP+Tszv$M0jygV{8($dn>!os4ux;iQ%nYHMqKeSN#Sx&QzuEG$H!Pz41A$c&8jbIaWwod5<)%tBT( zi(mnZ?FWegFUXtAr=ln8FQWl2hl+M1IN}`zbjXLhB~%FQ2;J(!4)tS`IcN)Wz$};& z%oFe+F$)Oh`SV4TU@Dr$fxRFKvX@`u(7?Qi*pG^)$sYhYCmj|-00E1~u<=AZKm@U% zu?dMpG6an9ARdP|!huE@kVG*yqTum};qwEHun9Q_D9#M#2QK79Mf-@w0tyZn6cmIF zGRDF}ZyZP_ljS;$j4+4zITBq zaCH2rm@mT4JA`G!JX|nKfCI639FHgWYhGF;c82~j1UsB#@4`20_q@Va%j6 zi6$V~8V@q*rVBbgg*9a|=?prZM#qzkK+qbbS>Xw$)_7|I!-Pp=;=u*1Eng&N@!8M< zFBjqcfF*wxOQ8!PmKYYgz_9;91~~b^Vp!w@3jq2K0^r8wbKoG6{Bz#>%7BF2K#0Q> z!aQI;x)kmw*a@cp<@I|k=l?_uhZuvCr^dfhW#J0RKl%1!;v;$nenMK!0Cv&+j+8yE=cn zasArWj$eQIxxMX5YfJOxrpAW)OLet1)fX>RRh~arQC@cTOsTY_xaf3YLH6Y^>Y&#H-+rU5rKzF5Zmrsy)vBw$R{3h>3gzX?zFfLw@ggO~ zFBFjOGOIM-WenxByrZEO&E+v5jylIXF|B31vh;ZQ!I7b=UBl01lg7EqFYIJ7my~r| zO5Cw)ug$2RwkmLX9I&z7waTU3eRG*z=LpXIjUIgd5pOW;#?WMDTPra3YA!-kGb%1B zHeM2!m=Kc`9j&Q#_()o!`M;N^MhAQd?S-+fdigEN#l{&uQ#U&h5C`KiZLc_C!O`nX$3l zq=_tP{-M^#843Mu?O9bxb$u^;h_)IeKkdAOca(>Q<14xpyu%G=&k&!k-4r+BDO1(Q zvIwqfgVFXGTV%Aj8jm^kRo1@F%v7}FD#bqght)nW&^ucRDtl-SIm@ijHY;2TQ`+;X zx_Y3j^wfPzJH_4^w*sll-r2B@s{A@uQ>B{5Qq_~#^pxXM+m(dt2BpWQcWLjo&mipV zxs|O~V=QarM&HsVcz1WpES4<0KJ$RMw>y^BZBCp33-?J;#R|O}Li)+|@#=&y=J=>* z{fO)Ou=~kVGS8MSt3b1hxW3AP!kdjg&po_u4z(`6y;{Y46D*KfuX(+)pt7ujqvywQ zD423msgiPrQ#j-&*9Q38Jlqb^r)f1;bb1_UiptOKU0H&%YgTWf H0=4;XSRCN0 literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_hangupxferline_jp.gif b/www/agc/images/vdc_XB_hangupxferline_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..d725413422fe159c8a7f4e9e77001a406ecfc977 GIT binary patch literal 1561 zcmZ?wbhEHb>|_vNIKsg2cjLw~clQgmwSSf^`*-EapLz2pMMV7FzyHtt`G5E9x!K$t zWN5fDE$#22LrYUqB1}#Hojdn;)27WiIS%UT3=9l^X3PMRc!1)6?g-xi1((Eh+i#(Mch>H3D2mX;thjEr=FDs+o0^GXscbn}XpVJ5hw7AF^F z7L;V>=P7_pOiaozEwNPsx)kDt+yY-;xWReFdSDOfCFkerS0onb8|oS8=jMX^1y)^L z5|oN?23FO@A(aKG`a!A1`K3k4sX*n*FwMZQ!*3BtA<#8e{zaL>U%h}$>=IY|?IT3c{Bx+}^zwSH@!dQF#F^2OJtrZ(GVZ!V1w zD{5@046AG}3N7xAED5dguIp{e?dbDut?x|l_n%uhYjN|$q{%4-3m1nkOs$Gtzi8Il znX5J|$ecT~dUQ@plw$# zPt6aUwDjcCH^&xK^f#WW>TNxE=R;k<%PB{G-TBYKJK6n|prc!l&BD*D6E1IV+S10k zN5$~g&bIwV*Cri0FXY-^E@D{yyz9xD^os=+x=YwLEj>NmAUTYq*`cvzwng!)J0~|U qKR@50nM>9yWJM!8kC;!ysVyrnFArGkHP>tFs;jFbHnuS^SOWmTiCfbE literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_header_jp.gif b/www/agc/images/vdc_XB_header_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..face2f093bf91123bcb4e22f7d310d61d1b67c6c GIT binary patch literal 1451 zcmZ?wbhEHbe96Ga(7*r!XU_ar{LdZX8=&BlSds{&ZR{%w5|gu2OB9k)(=+pImEP~( zucVNfVyhHx>TBRz;GCL~=}}db8eHWUl3bOYY?-2DZ>L~WVO5b^kegbPs8ErclUHn2 zVXKswlAn}n1!RMS^_3LBN=mYAl^j753Lrb3^NUgyO!W+OlMT!a6wD0u42@09&CPWb zj0_A7^bL&k4UKdS&8>`$tPBhkpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$uiRKK zzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`kBtHuUHT4A-&}MT>Xl~0)0b01O41wkiWpHi%Wu15zfG>x;Uh=AXPsowK%`D zC^;3VTp6Yr7&4a6BsFpIWGChrManjC7v#}NQ&UqnGYeyL zb3JmgnwU5mnK_y`I~$lA85+78T3DJJx|$ie zIhi||yO>#;!t{FP6_+IDC8xsd%>>#D)$4>;ua$FAYGO%#QAmD%4lD%(WaO9R7iZ)b zC^!e3Duid|rR0|vgCYmwSC`bH%(B!Jx1#)91#swEWn!`2)Qpg?A$n8D2{C=3WAs5u z11YJ%gn;P}#Dph&AP1gxQuBcMr3jcY82|tK`{(zspFh5T`}*bcr;i`rzkB=U^{baJ zoVgsyL#pFrHdENpF4Zz^r@34jvqUEV zojbN~+qz}*ri~lcuUorj^{SOCmM>enWbvYf3+B(8J7@N+nKPzOn>uCkq=^&y`+9r2 zyE;4C+ge+in;IMH>uPJNt12tX%Sua%iwXi?qaq{1 z!$L!Xg8~Em{d|4Ay*xeK-CSLqog5wP?QCtVtt>6f%}h;V~xOjJZzNKk;EkC%s=i<5($jg^I&iIIUp@h1zopwR)5pmK+S>3>iE z%F}N-<}nr?3JE{gW4BILp~Lf8=dxF)lAb)#yd&n4l3M@BI=E1m%PP*`{`yuQt*I8B z7c(@O(ycS!R^D-xcF`@9j_Nv|qPOJv?uzx7&zi4(XEQf`^X8uO-IXzG3b;%{K3x~Q zq57GzeZ}z`6+*_x%S<0Bv6{I{F0q*TO+zB%`b!J1Q=gtqoa&sx%$BUU>J-=1Z)O~; z7^7F6uK1z<3$`x?n^6W+erJ=%d>ES&Ea`-nVCs|sp7|E!sb!5RQHR~*3r literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_hotkeysactive_OFF_jp.gif b/www/agc/images/vdc_XB_hotkeysactive_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..def345cfe612da447eeb3c2d59e3001646b9bf21 GIT binary patch literal 1915 zcmbVMX;>3i6de>>x8jCcN~=RqKnqDGB!rAc2nmt2f^02_)G{Q4gpf>}3??850tQh) z2?7#DSw!4GMMV)sQCmeVn+l?UA|kk=)S|R1ouJtM@U!37_v5YS+;i`H_r8T9p(6)L z20-9E09adF+t}D7B_(-!dgkZnH#ax8wY7D3cQ-XPb#!#(<>f_3M|*jBIXO9%l$0O{ zqSb19dU{%0TkGrV0RU)dXdwGfG>gG;{_dWj03i@^obRMjB4QazfWhc;se()CtvpQu zr4la1kL6BxSMt$Nsaq6|`b2s7ilby=j)da00GzLZHFBjKB@j>}4_ByQ4VQvQuwWD> z=Z0+>1ssA9GA@N@H~)cfwLKNXm(w5)hhwn8VAzoeJ5{8DKs0s= zmF2Jn0jd(?QY9h96rjN(5{yL53q!O6LU~`5XY4c3Hgr0Ha^A`GMOx<1CPh2vq`2a zA_Ru}Vp#Za26%>I1f~kb zlpx=S1^P)95=^Z!JkGmV1t>0EiAsbxCI^RZ7nXiRoyGjGsNZoV|L4YNq%$-_YWyoz zhPTN4GfY1uKDqc%I;euI7o02%qrtatUjOyyz^j-2f4um;@AwwsUAcUz=Hi84e>s2dZ1tJbRi{o?o~Sr}to-Pa z!)1pK9w;r@zi;oJ-Nn0#b`}=o=k3^@yKSpJXG?Zg=H?7t`lgL(sVN)QC$CG=u1!pc zUlSL*IwpEmRHR0|GJ;UyE0mZ*9xe-$hAt05CE{Qt=;viW1uhL(;_vt4557L$UY?6R z+!uZSoycvW&{e>9;W;}k;Le{1a~# z%)XpHZK~;%$&)5dF!^HqxUpkKfBxAh zE=7zbmA9WAkM=lFcT4tqDc0NjCdPQAG;VD~v^I9-y7h__?M5O#F(y4ZdrOW!YemLr zmMJ#{Gs%_fGBK({-g)R@tmesOYO2=zG{%UHj%{Ts0%J z)YDlLaq`Jkzcm&ISNA>y9;?I5_QpInb_h%obyP%}m`^iJe!k6eMY_qLE^rR5C^xy> z^hPHe3KXThePMgJ!Y0T(c2YuF1|ORWYfaQTf@d@YQwZn%d!4-MTuJ)(i&0&Y95>% zR~~jaJ$lcHOxyHlHfvw>i`puEbG!2fgS~_|UUnU<5FP3;f*tObmK0h$c@*LOHaRut zcXi!@0~YMq)X=h8v^W4cXCK?Q{!$e4LWo}{WybDD1N$4Vv1Zmi4Jm!LD5u3=pVi~_ zO3;36lI&#^#^#lAtZZPeQCwD~Ws-U3bP+|{`2*v!E2=hm{aWcPDxYyLjjzoIuaA<(L;B>2{jmd(?0{=GWqV5a`} z{w4;XvMV!yBoHY6=Z^3VP;f~sNd(e1_7w$*$=RtT3Q4KynR&KK?|1K4QpilPRSGxt zHSjHPPR+>ls47YguJQ{>uF6ifOi{A8Q?RM9s>m(KO)W`OsL0L9E4HezRZ2|BPfE1{ zvO&W7N(x{lCE2!0jvxsIke$x?MX3s=dIq}524)5dW`=r(#wOnqF1_laHpait7C?(A*$i)q67m#PGlu=SrV5P5LUS6(OZmgGIl&)`RX=w>E z!^lV%s6w~6GOr}DLN~8i8D@e@YH@N=W^9o z<`tJD<|U`X?9Bw)3)O3kSFe?GQEFmIeo;t%ehw@J1Z3ow{v&byD+y`K1V$F&O{<`}^njub)4@fBX97^QVs=-oJbM=Jl(WFP=Yp`sDGWhY#-G zyL;#Mt(!NlU%Ptc@}-Lx&YwGb=JctPCypOGdgSn-g9rBS+q-A?uAMu!Z`-%OrteG>WPn$Yr@}!9q`ulo&y1P0%+S^)NnwuIM z>g#H2s;eq1%F9Yiii-*h^7C?Yva>QX($i8?l9Lh>;^SgtqN5@s!oxyCf`bAB{QZ1= zyuCa<+}&JVoShsU?CorAtgS39%*{+qjE#VqQcqV$TT4?zT}@R*SxHerUQSj!Glu>3bT>A8BZ#p|=X|KGpB zb2w>U#;SEWulE(`oG*0NaajDm=KcQz3kp1Rr21VQ8QOEK=3iJ5a&k)4`WreEXI-w^ zpP+8;qc^)eS)qByyRG%_H~*RW?P&9Nx4P}}--MbO%fdIVo4$A3 zo=r6~>UM8C+qCxJqP*(kRoAZHxVia6$JxfoJy|OsWL#QsfLX&qs5D)M0<+_+B3m_cW)vPPI*mntJJz=WeK3r);%6 zGdR(2vDaV5(p8}=L)T|bom{&5xZxN)4{^3rViZPPR-@vbR&Psj#ZZEyztRNmQuF&B-ga zs<2f`Ovz75wF0t1!um=IU?nBlwn~m52?day&iO^D3Z{Any2%D+1`1||dWOa(z<|_I zFfuSS&^IvBH#E{UG`BJ~vNAAGfC43;ZAB?*RzWUqP`iLUTcwPWk^(Dz{qpj1y>er{ z{GxPyLrY6bkQqisxf(^ff>iyW)Z+Zo zqU2Pda%GriVA$ce2&53`8Y};zOkkuW=D6f1m*%GCm3X??DgkBmQZiGlObtxk%q)z} z%?+ImTn!Bkom`CFoZZY!3@u#^4Beb9U}j*~>u79b=w#+>U=GyjYG`3>;Ot`RYVP9f zVqk1&e6^ zlgE!9KDdAH?w#AWZr-?l?dp}wmo8p7f9~v=)2B|JIDYKtk;8`$9@xKc@1EVecJA1| zZR?iJn>KD(zi#cC)vH#nSiWrOlEsS_E|@=W?wr}PX3m&CZR(WClO|5+@9XX9?&|Dl zZ)rVs;tJzX7bElmw|HB}X5B}D~! zIawKLDM<-&F;Nj=AwdCtK3*PfE=~@1HdYp9CPoGZ#h)zTqDu!vf=WyVw*Lo?wm9oB zS-2+`a(d{^Kc8~hGbe0)z>;lVtzMhs)xK5xIH^qaNI#pmo%x-qjoYh1u@zMqTa=pFN=dPW; zcp3{QGuwoYXQg zF3ga7{CMw^L(BH=oWK0ioU7+19{POk&C(+i*>864IrDGwbEZYj+fK|}AOGycTA_${ z!iSRgM#;up=f9@yvsvIPvs+e_OXaK!o{Q9trfqH#auxL{zbJIL;kJwAl$|`Y-F#(2 ze;G^YB{}?`Z>3(x;;uW-s9RflYRS{yN4f$x1VnCBtj_W%xG16(&T{V_{ zS5K~CJsD+lN+WAg!2M~W(i;BRw>Ew3VKTP5veY?$$-ZBUR5oXx3pM-saQ3mRSz0Ag z_I!Hnn8MaVOYXd-%?4%QkoeE_VkGiz_Dv~<%=e=0ep?YaWQn$sS U9}9a75A9Iuw_kK3QGmf30Ko3l`v3p{ literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_internalcloser_jp.gif b/www/agc/images/vdc_XB_internalcloser_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..4304b699bff324b28748b3a30b1cd33be7afd125 GIT binary patch literal 1497 zcmZ?wbhEHbtYHvfIKseCS9fXS#{cf_<;$1_IpxZg|LN(gjf{d19r}On-2dF%t(!OhS66prU|^Uz^FNTp1r+~tNB9OPxFnV& z0%;rjih{)C?9>v4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyv zDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1Gr=Xb zIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mdyc)XmJo*xcOE*}&D%(9p@n*v;9^%*4>r)xglr*#c$;HoYds zjz-R|uCC4o=0KgUh89kSrjCy0#x72-re{6dBr7(dC93TdozLdLiM`f)obNk zl$uzQUlfv`p94z)0U7xv`NbLe1q#l=rV8Pic`5nj#h}Q6_|+w~D6=dz#jPkmR{WYlz+yazacW=oo!a(m+ZoFd<<212N$VAIO1cozy&FeklTG495Te{{H#> z>*tT}-@bnN{ORL|_wU}mdHw3;i|5atK6(7;;e-44?%uh5>*kH?*REcZ;0$^0LyB;-bQW{Jh+p z?5xa;^t9BJ|cQ;oTXD3GodplbjYb#3& zb2C#DVL0`71Y}p7_0%QbUK~@ literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_leave3waycall_OFF_jp.gif b/www/agc/images/vdc_XB_leave3waycall_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..6f0a2f4dca7738e1c935b888f14cdfe9e250fb0a GIT binary patch literal 1976 zcmZ?wbhEHb>|_vNxXQqA?AWpV{QPChmd&0$d-?L^=H})W78Y~n%qcA`-Lz@b*|TSN z?AVc)m#3kjp{lAH92~rK>C!W2&UkouOqntzEG%sDZxN)4{^3rViZPPR-@vbR&Psj#ZZEyztRNmQuF&B-ga zs<2f`Ovz75wF0t1!um=IU?nBlwn~m52?day&iO^D3Z{Any2%D+1`1||dWOa(!0^*i zFfuSS&^IvBH#E{UG`BJ~vNAAGfC43;ZAB?*RzWUqP`iLUTcwPWk^(Dz{qpj1y>er{ z{GxPyLrY6bkQqisxf(^ff>iyW)Z+Zo zqU2Pda%GriVA$ce2&53`8Y};zOkkuW=D6f1m*%GCm3X??DgkBmQZiGl91Wd}U7cOb z&0L)gTn!Bkom`CFoZZY!3@u#^4Beb9U}j*`>t^Zb;^t!H>}+6eU})%S=;&(he6^lgE!9KDdAH?w#AWZr-?l?dp}wmo8p7f9~v=)2B|JIDYKtk;8`$9@xKc@1EVe zcJA1|ZR?iJn>KD(zi#cC)vH#nSiWrOlEsS_E|@=W?wr}PX3m&CZR(WClO|5+@9XX9 z?&|DlZ)qs;ci+!ts*ziM`~8nS zb@tO=|IKeGl@;b^VpdR)@9L57?(XXE>Fk@>IeFTQDbwdnm@s>K-=rzsa{nrnS12y#KmW>o!>d<{N6=-J_c_ULLmxyEY?G)47+fEA`C4G&`3(0sH zZ(ODKSU3Abcf88~`Ui_NZ>hhH3J7OWd@xCb`_jJf-!Xnu)P--`*D8oJz4rVR;)fsr0>XRzI{oBMcxH+FY+-CaK1;!s<19cyFve zwcaXI_wL!Z;aPW73i(twR-f{@6}?^J>p$J8ue4X3n!oF&Q^*a8h$6AKPFtjTW?QcQ zR&;slYq1$`?nGR?H6^oHV@2Hcpyq%(+aB8#9}btg>$zw7#@pPvw~mR=DDZvy*^T+T zcI7jDwrvF`cOAdFJHGSgGrP7(x%nkeQq`yR-`r@MvG(M|(kq@Fe=dpW@b7f(jg;sW zoo$tP@^Ey?vAZFcQe&oWj*F8>yHPIUD5kKWkxeqi;ZcYBq>M*hTC+M9bsJ2xSk$9& zElKSkPX*{0b@-5?WkHNNxM_rO07Z_Oi5;inW3Cc@QWebU0`E*KH xS?AL!5p_3Jr$+`wKAn*|_vNIKseCS9fXS#{cf_<;$1_IpxZg|LN(gjf{d19r}On-2dF%t(!OhS66prU|^Uz^FNTp1r+~tNB9OPxFnV& z0%;rjih{)C?9>v4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyv zDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1Gr=Xb zIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mdpp$=KD|#oWx**}&D%(9p@n*v;9^%*4>r)xglr*#c$;HodMc z7B0@_<_69N<_3m_u7*yg&TeiN1}27PMh50)PUbMZo_WP3iFwJXFncqB_CoZUx#87o zg9{)&z?Sc{OI9>`}gkNxqa*AjqBI0Ub%ef;)V0) z&Yn4a>g0*z$BrI3eCXhT{rmRr*}ZG$j_upFZrQwPBVyea45%W{)H7KUTed&udOM|X5^T1rAtCv)&FeF>5AUC)yMryBbqxT<@a}@s%UX&UF=^ zIA7WM;O@0Uj}Fc+IKHvy{=4Jr{P*sAb@Ii%Mb}SV|MVxR^e}6_n4a3VGlg6oC$6c~ z9Q~zx=lS|MX7#^bIYyVgm}Xs5{XjOx$>vesrS G4AuaA8)$d{ literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_localcloser_OFF_jp.gif b/www/agc/images/vdc_XB_localcloser_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..f8a8e474ef1650120c252d33600ef1dd0b0cfebc GIT binary patch literal 1722 zcmZ?wbhEHb%w`Z^IKsei?AWpV{QPChmYJKI&zUo4_Uzdf78c8wFP}Vl^4YUzr%s)^ zW5*5+4GmRQ)$s7}O`A5Am6dsTcx>IeH8?o<%$YMXGBUBTu`w|*va+&Aj~-pIVg&;O zLvL?yUtb@P0R)Qwxg&f76kHNZ5`naheMLcHa&~HoLQ-maW}dCm``!DM6f#q6mBLMZ z4SWlnQ!_F>s)|yBtNcQetFn_VQ=?Nk^)#sNw%$$BS=C4WT$g}QL2Keo`G(%fti7VnW3Jcu?f(ZItoSxh6efuM*4oE zJ@bl767!N%VfJPM?S<;K#H-iJxhOTUB)=#mKR*YS0s=DfOY(~|@(UE4gH08}GxJjN z%Zovg1M#a%YEfocYKmJ?ey##IbgeS6*=|6{*ATra?I;nZU{89wW7>xh_{r&U%*Uul{zkU7k`P0V_@87+B^ZM1x7tfzPee(Fx!w2{8 z-Mw@B*3BE&uU)-z`O?J;=g*xzbNbZD6UUDoJ#zTa!2|pE?cK9`*UlZ=w{6|BdDF%X z>({MavwGFa70Z_`U9x!5!Ugl^&7CuQ*322xr%jzQdD6rQ{e8VX-Cdm>?QN|s%}tFB z^>wv1)m4=h1nAc$w`R`@o}*+(NU2R;bEa6!9jrm{(inb z-d>&_?ryFw&Q6XF_I9>5)>f7l=4PfQ#zw$Qsi&)>t);1EF>tv&&SKd&Be*V&c@2Z%)|&RU4F8FOBo#y2`bSTSpO$Dr8>CHO3hrSzI)ZX z)2keM4}G5ddgI>1b|Gnv6KqUQEGar^qcQi)3K6ZfQR}a0B`Il?SjiMf_~;d%dsy-- zT5R#%{7=8E!>^yuwTk1pm-8tnnURf&C9Sc#s4AmJMmoPDtG~Nsa#mGCXZOVV^!lRY z=?RR?t+jP4R^;R^OrE-~YVzF9#JMw8?wB#Lu{N`Q+uGGKOJe60#P@Hgp0i`c!jmVn zGj^URmA%-$?rdGl#Gt=@M`8_ypR5wXY&Fl>MStkLNR`@JoO)0~*5L>#-es%fFo&1*&5 zbuJkt{Y~?HwS)VbX>N_nFKP1&Hw2R{D7iQG zKp(5DTgQQ2VQit7T+|Kk%GpnN!eF}NjPlZLPaI5-u;@L$-P@q1IJ-1>T~OXLsoX=+ zTds%A(tItaeP+kqYnFA6m$*-@x)EP8rzy>)xu XT_IpxZg|LN(gjf{d19r}On-2dF%t(!OhS66prU|^Uz^FNTp1r+~tNB9OPxFnV& z0%;rjih{)C?9>v4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyv zDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1Gr=Xb zIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mdsn$=KD|#oWx**}&D%(9p@n*v;9^%*4>r)xglr*#c$;R=vhX zE{?{o2F?cN28M>NhEA>qmX6LQF0RIoPNptqCNRC8dBr7(dC93Tdow}yg7vz%;ni#9 zT$Gwvl3x^(pPvIu0Rb8LCHch}`2`Bj!KMn~nRzMs<;9@Lf%w%WwJ5VJHN~wcKUV=9 zx>lK3Yyv|Nj2@ z{p;tC@87({PcxqRv3h4bgm zo;iK$#u35cm<%;FYmM&SmXyJnS z^XAT(J!|HS>C>i8nLKIYg#NzXp6;&Bj`p_Jmgc6$hWfhNn(C^`it@73lH#Jmg8aPP zob0U3jP$hBl;otug!s7FnCPg;i14t`kl>)e0DnJUA8#*D4|g|L7iT9&2YWkP8*3{| z3v)A56JsM_rqt8b(bm$`P*+n`QC3n^ke8E{k(QE_5El~_5f%~@;OFDz;pXDxU}s}x zVP;}vU{L(Y0xo!TKqRO{V_;F3#9=Ddtm>vCT2({oWdnsUEl-TRvN{|_ikNZ{bn zIkBYZWRBJR3oA^bR(dcpJud0q;gkDoq&`TFhqkDtGO|Kj1`6v-9O7C~? zS5nAKu~iB;^)>JFRfC7_I6N@j|crHhlXtFw!_ znX9vbtD&KxlZ&yNvzwWTp{1*Vp_{V>%nWRLO-zg(T}>T`skpuCoOKMSOS!#+~QGTuhICQNtvDj|uO32p`y(#2`m_E=k`kj`|#S7=pojr5<)X5Xaj~zX7_|U-v`}ghLvwPRh z9ox5U-LiSp#trM&tzENv)yfsimn~hgc+tWI^XJW-Gkey|8PlgtoicgS#0mXjScm6wKdgMl@;Y>r6t8hg$4O}xjETcnHlM6sVT`xi3#y>u`$t6krClx zp&`LRfdT%0zCPYwo*wRQt}f0_jt=&Awl>yQmKNq_rY6Qlz)Y#9tD~)@siCf>s-mo< zs30#VDDIqQIz+0(!B z^jrSLbG8H}Y`!P-Bsnz=1iR-<6PIsqSm2s-~Kfm|&b-hTKxXMxU auk2!vK21(fvDj{YqVa1)=E`6O25SKS8qWm) literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_parkcustomerdial_OFF_jp.gif b/www/agc/images/vdc_XB_parkcustomerdial_OFF_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..cbeb0485dd13ee530b18c8f0494aa56539fb6c5b GIT binary patch literal 1915 zcmbVMXIN8b6b^!D!8&lD6>JEyRI-39h)5D5s5l5ML$HSAB0+L*y!Vm;s4Uq*(J&;b zqDY90Dj*1gT2ZhnRE$+|v~}P@>!R)|y-~6K;bWht_s4g?@xJFh=X~dU^8@(|rf>^x zJnk3{*VWZkRaK?e>mdlD)9E^$j=^APwOSAaH5yGzOG`jNfIuMV>FKGgtnBXYZfa@@ z4GnE{I!>QHkf`S5vA?vW9rFfnY z6=HuMU!_baS`DE1Xke8DWD_2?9VXxmg4bJI47fPV);SF;IzrUSf5lMBHB-it_f7m;aX zJdHx6cz9wV&cRd36f%iSB~hsE6gta;$|95TA3g%628&}@!94y4Eo{Xm#GHl#wVzGD#{m#q|!2puxaDZhR7rgs5ZyDHuSY1Xu)MaK~XX zmb=djnShu#tR=7nyA)wO4-zFv0T2!3u?g4-Q7jR&m>iCWKbJ?R`E$ws6bgmI^Wby& zG*1fCpG@I%8N)U{#r5DbI8-`?!6no96pBAap>dg1I+e-iQ2aa@{9$e&h@e7H1Ptp+ zFx?Ma`e(T;E({1!2o8au_~8mz8VjKi5(~-jT!9xpR04`21!B6K_p$N-SRx0+d>E4A z-({C2`Gh)?`(IJN=ZgPN#z>emBvWbpt5k-!u=+DiKNdc=_}DrCi1iDMHHO*H+c$r` ze)aOj^Jh>09DMTl(ZdIS+`l()_s;EGH~Vi~zjpQa-+sMv`O?L{3+K=Ma@KgJ_w>&_ z-KS2T`0038=dq(5M}9nf=wN%>f!3D&%}x6n8|wG&`Jt}1rh2!bN?*CFV&{(X?c2WB zY0I{jmJ}Chwrnokw6Q>)pO>4Hot3#EBRwrOW&OIf$w`SSr9z&7BJdg+1WMyq$4O#W z#Ql^F?y8cNDK23 zW;mR~OAG9!!QtkZ2Gfg%8#%OcFn;>H;$2&-V-u?%wHDXT(bh|Ec>A`IY>8PHq!Nv;S-wkssH)K1a?MU%r!wPEQEE@&j)R4UbWL`9vvF@` zX?=TMcjKY8S-H2{s%znaiU*m4#3RA9K%2e1DxbBEqsV7wr|D-j4VsTD?-X5Ir)qfa z7R?wp`q>7fr6HWlzTP{;HkVrg9g3t52h^o;%kl8R7e4pU2fCw~lak&TpPHq5t;^4z z5RzkzVS!e*BQg@k2u=m+-##{8d@$fza3hlm+iuh^;M7Do3G`XpF4u9>Y3_iex-V^V z(yL<&AeTDzkPXrQT<_vb=4q0bt%lyP2B{4@NIf7hio+)=y2L7*CmiuHRmw=7<~)ei0}^R&u2dv#tzj?MP?Wd}7;3AUF6B?w(rV!f<5S?LgA5ws;J>M9|t}|I^b~8yN*3I`n_@=Ktr;{m;$as;=(Hz`!tb=6@iG3n>2Qj_?goa7ipl z1kyJ46$OdO*{LN8NvY|XdA3ULckfqH$V{%1*XS zQL?vFu&J=B$SufCElE_U$j!+swyLmIN=(U5O0@#ALBje<3ScEA*|tiKAPEJKozD41 zsS2ig2D-@xW(EpohI)p^Cg$emItoSxh6efuM*4@{(ZdJ#@7=v~`_|1H*RNf@a{1E53+K6ZM9qnzcEzM1h4fS=kHPuy>73F26CB;RB1^Ico zIoVm68R==MDalER3Gs2UG0{A;Cd`0selzKHgrQ9`0_gF3wJl4)%7oHr7^_ z7UpKACdNjp{}N?qO7E-ATK8?BP}H?8V4_Iiy7x8j|L@`|@X(R! zKe41QfrCdUAS2akYryKj>@w}%uq}5sRQwT5K73!hG+M6wZb8EV&id%9;d#6N9ee&Y zC9XQEIW@byJtwUqv8W`cvc6+dWL80XV_Ea$&Z!A;Wwmp9GLrlJyMl7tB4#XDpH@@7 zdgjK~MG39z8kQBWn3_Fp_3VX5R^_#=oIl}MXx*xF8|ELI)4OlatfmX|?lfF!xv_bD z=E2jCs+2H^cgcEhTXS=B o#^qJ9r^|GhS@`4vW_WL3cXxNi=T~=6Z(o0Ze*^PtUPcCM0C~N0_5c6? literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_XB_presetsbutton_jp.gif b/www/agc/images/vdc_XB_presetsbutton_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..53d28b814989527bfd0a200e28dd1c0bdc016bc3 GIT binary patch literal 1428 zcmZ?wbhEHbbYl=;IKseCS9fXS#{cf_<;$1_IpxZg|LN(gjf{d19r}On-2dF%t(!OhS66prU|^Uz^FNTp1r+~tNB9OPxFnV& z0%;rjih{)C?9>v4q}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyv zDB0U7*i=|m)9WTXpJp<7&;SCUwvn^&w1Gr=Xb zIJqdZpd>RtPXT0NVp4u-iLDaQr4TRV7Wn$Y4bCgp1A9m>IX_pwBC$Z$_i>(q+MlU5Z#mdss$=KD|#oWx**}&D%(9p@n*v;9^%*4>r)xglr*#c$;HodMU zZe|v4&d$yTW z>*tT}-@bnN{ORL|_wU}mdHw3;i|5atK6(7;;e-44?%uh5>*kH?*REcZ;0$^0LyB;-bQW{Jh+p z?5xa;^t9BJ|cQ;oTXD3GodplbjYb#3& zb2C#DVkeOO)LrA&J9WbhuQNrh>A5ps@|x{TdtJRR=kj&8pF2(+|2;P# z&pW*^A*nK>BiJLcw6VOayQjW(QbcfOS##0Eu7c^4Gh$}VSvYM$Q0DU3{-r*vR;^gp z5TClSzNdQgZr3H9QQPwmZue*B7CLeA)af&4&z-+;k%xniU*!6Yo40P?xqI*agX@Y6 F)&N+r7P6v-9O7C~? zS5nAKu~iB;^)>J6!V;*iRMRQ;gT z;{4L0J^ z^2{qPNz6-5^>ndS0_xYx%uKN|H8nPKG&gf`HZXHFG;}p|GIBF_GH`P;c6Ku~cQJB= z>2=9ZF3nBND}m`vLFjeGsTY(GatnYqyQCInmZhe+73JqDfIV!LiQ6qsIL(9VO~LIJ zXPkQVfsWA!MJrM?!-Rlo2gHOYS|A6W>{IiAX}t)Ts2TtN`}^njub)4@fBX97^QVs= z-oJbM=Jl(WFP=Yp`sDGWhY#-GyL;#Mt(!NlU%Ptc@}-Lx&YwGb=JctPCypOGdgSn- zg9rBS+q-A?uAMu!Z`-%OrteG>WPn$Yr z@}!9q`ulo&y1P0%+S^)NnwuIM>g#H2s;eq1%F9Yiii-*h^7C?Yva>QX($i8?l9Lh> z;^SgtqN5@s!oxyCf`bAB{QZ1=yuCa<+}&JVoShsU?CorAtgS39%*{+qjE#U9N>5iu zTT4?zT}@R*SxHerUQSj!1(- literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_tab_form_jp.gif b/www/agc/images/vdc_tab_form_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b8654d237b61cfa04861ee1c7289d01eba89a3e GIT binary patch literal 1387 zcmZ?wbhEHbbY_ra*v!E2`Sa%=KYo1q^5yT}zrTO~{_x?$|Ns9P7#QBae-9)vf#QGe z2;Tq&m&B4pAZ=q`QIMFNom!%hl$xHIXRGvn_kJaX%oJOta8q9c-vZ~}1OnC3`ysn+mIn+=ATHl0=1y+?>2(s|s7C#FYG`R4X7GB&@Hb09I0xZL8!6 zl28EI>6~Abs$i;Tpqp%9W}skZsAp(wVs37(qhMrUXrOOkq;F`XYiMp|Y-D9%pa2C* zK--E^(yW49+@N*=dA3R!B_#z``ugSN<$C4Ddih1^`i7R4mLM~XjC6r2bc-wVN)jt{ z^NN*WCb*;)Cl_TFlw{`TDS%8&Ov*1Uu~h=P6yk;40$*Ra!Fk1cU=Qgf=jZBIBo^o! z>KW+g=7RhMR$W{Yl!|Z$R@KEJl?AE#L8-<0rA5i9K;_CX&A_n3ZxKi#&^1>6MVY`z zNz8G{PcF?(%`5SAu~h=f=%r+)Sh$jI2z%@L;8Gq1QLF)uk4W^X3Y zUWi@;H@teSoQqNuOY)0C^7C_GDIg#tza+mnBfmhwIoMPoJTosPzq}X}IS{|Pq!wkC zrKY$Q<>xAZL)R)3i|wvvgnSLrn?g>A=>r|34@w$HNd+bZOn)FIJmCX5@T`-X2h1-; zz>LB8|KHy~zkmJw@%`J^FP}es{P6zW+c&RYy?pWf+0!SFA3c0<|K8m@w{P9NasArW zE0-@_ym0>9*)yk4ojh^;*wG`04;?(Pf8X9cyLau}v3=XtEt@xO+^~M#+BK_Jtz5Bu z+0rG87cE>cf8N|VvuDkmF@4(9DU&BnoY3Fb+tc0E+0owC+S1(A*ic_rTT@+CSy5hA zT2fq8SdgEWo0FZDnUS8Bnv$H9m=GTq8xtKB84(^98WJ277~t>c>*MX^>EZ6?>f-F= z=wNSWYh!I?X<=?=YGP~z%#?b%I@(&A8tQ7QD#}WV3i5KYGSX6#65?W_BEmv~0{ncu zJltHI9PDhYEX+)d3=E1tS-?e(4u}MmPz)@)E}ZaOz1QNkuRDW>Mqf(iJdG%Zg8_n0 zTIWr41uhF*uQ|`H=X}6jXAzUoguoL^XGu z`8V%E=#R{5zmto<3*DWf{&jj@LY7fwZn96ka&=u}c3XLWyK+%&_vBvH)S8K{Ju1@_ zI~Q^+vaKy&u&7|EO?~gQ&RI)lxXn?j-ekOHSO3Di=t+Ba$L?>=UUoQQL0ahPGlA#M W`&_&fbnI&6l^b@qZifjnSOWlZEC93s literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_tab_script_jp.gif b/www/agc/images/vdc_tab_script_jp.gif new file mode 100644 index 0000000000000000000000000000000000000000..2236af8646489a12536b882e6fba913cc89e5173 GIT binary patch literal 1458 zcmZ?wbhEHbjAD>u*v!E2?%lh$Z{Pm;^XJQ#FF$|&eDUJN|Ns9P7#N;Cdj=#if#QGe z2;Tq&m&B4pAZ=q`QIMFNom!%hl$xHIXRGvn_kJaX%oJOta8q9c-vZ~}1OnC3`ysn+mIn+=ATHl0=1y+?>2(s|s7C#FYG`R4X7GB&@Hb09I0xZL8!6 zl28EI>6~Abs$i;Tpqp%9W}skZsAp(wVs37(qhMrUXrOOkq;F`XYiMp|Y-D9%pa2C* zK--E^(yW49+@N*=dA3R!B_#z``ugSN<$C4Ddih1^`i7R4mLM~XjC6r2bc-wVN)jt{ z^NN*WCb*;)Cl_TFlw{`TDS%8&Ov*1Uu~h=P6yk;40$*Ra!Fk1cU=Qgf=jZBIBo^o! z>KW+g=7RhMR$W{Yl!|Z$R@KEJl?AE#L8-<0rA5i9K;_CX&A_n3ZxKi#&^1>6MVY`z zNz8G{PcF?(%`5SAu~h=f=%r+)Sh*UzSem$5x|*9i8@L)88alZcyE(g=nHXBS8W_4c zTfoe~rq|fX(%9I{%)r^e+``b%)zH$^)XCY@!otQ#zd*q`*i<1rGcP5-yciTY5Wl*l7G;*D zrnnX5=PH0h*D4c>?XD(-d=1f?LQaV310ACeN*YK>1ttVce;_72;R8AFtdp7t%r8a2 zjKTQ--`_vKfBpRN{oB_spFe&4@c!M~H?Lp4eDVC*(TITuzuazHLF*xT(NxF z(j|)*EnF~v-rPB}XU&{3ecIG1lP67_(BIeF)7{nC(caeD(%jV8P+wPDQ(aYAQC?PB zQe0G6ke`>Elbw~Bk)D>ClAM&75FZyC6CD*95gryA5*!p5;P2<_Vr&G=lzO^4+FF_#>T0Sg%1Vj~@^Z2=(o&KV;$osA!a{-q{CvDT z++3U->};$o%uI|742nNlz(tM@hy;~T3@raIobX(|*W&fr-6GBnJt>*h7DQ+|bgI(=}~j z#=K6QIhr%edZ$lZ(x$b1(X<7d<}aSxtiG{vN#)jUQ_UvztXJ7xc~p1h{uO(d9ym5( z$N5v|4pz^a#j*S7$?~<=Cf`_gX>Bbrg&Y3=Q-R zjPwnSbPdg|jE$@e3>2V1320kUN}5%WiyPD~AkS7Qqokz3N?*Ucyj-u`STDaQUEk2s z(h_8bk&!M?g>G?WUP)qwZeFo6%mkOz;^d;tf|AVqJOz-6iAnjTCALaHmqNUdTj1*p zH#o0Y59}emIIAz^b}9q_QAYKPa_0zqBYh6{uVp zrWqJ^_$>k{1iHq`zbF$JDTz5Q`N^fZsd*)yF1AWQ8NHOu6f0Ll7fTa2OILGqX9HJ5 zLqjJQV>f3vGZRBgR|7*gXA77aSoNA)7#cac7&#l5n;ROs8iIJvP9TPbo13ArIZUr- zUU5lcUUDkT-b|3a5WR+Y^;$U>r6!i-7lq{K=fF}xKt_H^esM;Afr4|esX};WUP^v> zF(`5%esxJL$}CGwaVyHtRRD*sRVFsujR^S~qBn({5Yq=bMjwIxnujbty?y4+PGo; zy0vRouUffc`Ld-;7B5=3VE(+hb7s$)Ib-^?sZ%CTnmD1queYbWtFxoMt+l1Osj;EH zuC}JSsEZKEj1-MDKQ~FE;c4QDl#HGEHorIC@{d^&)3J> z%hSW%&DF)($C+1A|k1&sdw(&`Tzg_ty{NBOG}?UdsbXrymswc1_p+| zfBynWI8gl09pM|G;F4I92&8T7D+&^mvr|hHl2X$%^K6yg@7}MZkeOnu6mIHk;9KCF znvv;IRg@ZBBbrg&Y3=Q-RjPwnSbPdg| zjE$@e3>2V1320kUN}5%WiyPD~AkS7Qqokz3N?*Ucyj-u`STDaQUEk2s(h_8bk&!M? zg>G?WUP)qwZeFo6%mkOz;^d;tf|AVqJOz-6iAnjTCALaHmqNUdTj1*pH#o0Y59}em zIIAz^b}9q_QAYKPa_0zqBYh6{uVprWqJ^_$>k{ z1iHq`zbF$JDTz5Q`N^fZsd*)yF1AWQ8NHOu6f08`M@wS^0}FFAX9HJ5LqjJQV>f3v zGZRBgR|7*gXA77a*z`I&o4A=+m^eBcn423Kx*9r}IvcxKm>D@)xH`ERTbRJ~dgc|E zB<3Zj!tBii+6&cdiC3?cb5UwyNq$jCetr%t1q5W|m*f{` z1N{AbeZ0LqJ>1<~U7Vd99qjFFZLF;&60E#jF@5*5XPT`l zD$UtqKfiWm<{R88V`O0I=r}g%Sl08xqC_)cc6LerxSFi`nEb-L##mpDiCwkXc{xe( z7IUUGm`t74T^Bvcaz%6u`?TsAQFAAHuUfr`le2SrmT}C!g1NCpN&c+7T)QJ&_cd-> z;FZM7!^$XrVyUFW{;f^hq7Oq79   \n"; echo ""; echo "   Danish Agent Login"; +echo "\n"; +echo ""; +echo "   Japanese Agent Login"; echo "\n"; echo "\n"; diff --git a/www/vicidial/welcome_languages.php b/www/vicidial/welcome_languages.php index e00e310e..d94ba3e1 100644 --- a/www/vicidial/welcome_languages.php +++ b/www/vicidial/welcome_languages.php @@ -62,6 +62,9 @@ echo "   \n"; echo ""; echo "   Danish Agent Login"; +echo "\n"; +echo ""; +echo "   Japanese Agent Login"; echo "\n"; echo "\n";