From 911c4fa86ead16c14ec8eeae3c6964c56d6d4375 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 14 Dec 2015 02:12:07 +0000 Subject: [PATCH] Added Chat Messaging git-svn-id: svn://192.168.202.10@2428 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 3 + bin/ADMIN_keepalive_ALL.pl | 14 +- bin/AST_chat_timeout_cron.pl | 241 ++ docs/CHAT_MESSAGING.txt | 54 + install.pl | 83 +- www/agc/agc_agent_manager_chat_interface.php | 269 +++ www/agc/chat_db_query.php | 807 +++++++ www/agc/conf_exten_check.php | 80 +- www/agc/css/custom.css | 58 +- www/agc/css/simpletree.css | 132 + www/agc/images/vdc_mgr_chat.jpg | Bin 0 -> 1898 bytes www/agc/images/vdc_mgr_chat_red.jpg | Bin 0 -> 2004 bytes www/agc/images/vdc_tab_chat_customer.gif | Bin 0 -> 1628 bytes .../images/vdc_tab_chat_customer_blink.gif | Bin 0 -> 5324 bytes www/agc/images/vdc_tab_chat_customer_red.gif | Bin 0 -> 1633 bytes www/agc/images/vdc_tab_chat_internal.gif | Bin 0 -> 1493 bytes .../images/vdc_tab_chat_internal_blink.gif | Bin 0 -> 4706 bytes www/agc/images/vdc_tab_chat_internal_red.gif | Bin 0 -> 1497 bytes www/agc/images/vdc_tab_email.gif | Bin 795 -> 869 bytes www/agc/images/vdc_tab_form.gif | Bin 909 -> 905 bytes www/agc/images/vdc_tab_script.gif | Bin 664 -> 1437 bytes www/agc/vdc_chat_display.php | 719 ++++++ www/agc/vdc_db_query.php | 246 +- www/agc/vicidial.php | 459 +++- www/agc/vicidial_chat_agent.js | 396 +++ www/chat_customer/css/custom.css | 57 + www/chat_customer/css/simpletree.css | 121 + www/chat_customer/css/style.css | 69 + www/chat_customer/customer_chat_code.php | 26 + www/chat_customer/customer_chat_functions.php | 203 ++ www/chat_customer/dbconnect_mysqli.php | 88 + www/chat_customer/functions.php | 2127 +++++++++++++++++ .../images/messenger-blue-icon.png | Bin 0 -> 594 bytes www/chat_customer/sounds/chat_alert.mp3 | Bin 0 -> 3086 bytes .../vicidial_chat_customer_side.php | 499 ++++ www/vicidial/AST_chat_log_report.php | 4 +- www/vicidial/admin_header.php | 3 +- www/vicidial/images/default_icon.jpg | Bin 0 -> 1446 bytes www/vicidial/manager_chat_actions.php | 298 +++ www/vicidial/manager_chat_interface.php | 487 ++++ www/vicidial/new_manager_chat_form.php | 136 ++ www/vicidial/user_status.php | 36 +- www/vicidial/vicidial_chat.js | 292 +++ 43 files changed, 7847 insertions(+), 160 deletions(-) create mode 100644 bin/AST_chat_timeout_cron.pl create mode 100644 docs/CHAT_MESSAGING.txt create mode 100644 www/agc/agc_agent_manager_chat_interface.php create mode 100644 www/agc/chat_db_query.php create mode 100644 www/agc/css/simpletree.css create mode 100644 www/agc/images/vdc_mgr_chat.jpg create mode 100644 www/agc/images/vdc_mgr_chat_red.jpg create mode 100644 www/agc/images/vdc_tab_chat_customer.gif create mode 100644 www/agc/images/vdc_tab_chat_customer_blink.gif create mode 100644 www/agc/images/vdc_tab_chat_customer_red.gif create mode 100644 www/agc/images/vdc_tab_chat_internal.gif create mode 100644 www/agc/images/vdc_tab_chat_internal_blink.gif create mode 100644 www/agc/images/vdc_tab_chat_internal_red.gif create mode 100644 www/agc/vdc_chat_display.php create mode 100644 www/agc/vicidial_chat_agent.js create mode 100644 www/chat_customer/css/custom.css create mode 100644 www/chat_customer/css/simpletree.css create mode 100644 www/chat_customer/css/style.css create mode 100644 www/chat_customer/customer_chat_code.php create mode 100644 www/chat_customer/customer_chat_functions.php create mode 100644 www/chat_customer/dbconnect_mysqli.php create mode 100644 www/chat_customer/functions.php create mode 100644 www/chat_customer/images/messenger-blue-icon.png create mode 100644 www/chat_customer/sounds/chat_alert.mp3 create mode 100644 www/chat_customer/vicidial_chat_customer_side.php create mode 100644 www/vicidial/images/default_icon.jpg create mode 100644 www/vicidial/manager_chat_actions.php create mode 100644 www/vicidial/manager_chat_interface.php create mode 100644 www/vicidial/new_manager_chat_form.php create mode 100644 www/vicidial/vicidial_chat.js diff --git a/UPGRADE b/UPGRADE index 15b8979d..bef1f677 100644 --- a/UPGRADE +++ b/UPGRADE @@ -206,6 +206,9 @@ OTHER CHANGES: lead_id of the phone call and send a per-phone URL at the start of the phone call. +51. Added Chat Messaging to agent screen, with manager chat utlitity. For more + information, read the CHAT_MESSAGING.txt doc. + diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 4af99a41..0bbf6f56 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -103,9 +103,10 @@ # 150804-0919 - Added whisper extensions # 151031-0931 - Added usacan_phone_dialcode_fix feature at timeclock-end-of-day, added -lstn-buffer option # 151204-0639 - Added phones-unavail_dialplan_fwd_exten options +# 151211-1509 - Added launching of the AST_chat_timeout_cron.pl process on the voicemail server # -$build = '151204-0639'; +$build = '151211-1509'; $DB=0; # Debug flag @@ -1360,7 +1361,7 @@ if ($timeclock_end_of_day_NOW > 0) ################################################################################ ##### Get the settings from system_settings ##### -$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename FROM system_settings;"; +$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats FROM system_settings;"; # print "$stmtA\n"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1378,8 +1379,9 @@ if ($sthArows > 0) $SScall_menu_qualify_enabled = $aryA[7]; $SSallow_voicemail_greeting = $aryA[8]; $SSreload_timestamp = $aryA[9]; - $meetme_enter_login_filename = $aryA[10]; + $meetme_enter_login_filename = $aryA[10]; $meetme_enter_leave3way_filename = $aryA[11]; + $SSallow_chats = $aryA[12]; } $sthA->finish(); if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";} @@ -3643,6 +3645,12 @@ if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_se $upload_flag = '--upload'; } } + ### start the chat timeout process + if ($SSallow_chats > 0) + { + if ($DB) {print "running chat timeout process...\n";} + `/usr/bin/screen -d -m -S ChatTimeout $PATHhome/AST_chat_timeout_cron.pl 2>/dev/null 1>&2`; + } } if ( ($active_asterisk_server =~ /Y/) && ( ($sounds_update =~ /Y/) || ($upload_audio > 0) ) ) diff --git a/bin/AST_chat_timeout_cron.pl b/bin/AST_chat_timeout_cron.pl new file mode 100644 index 00000000..4281b94c --- /dev/null +++ b/bin/AST_chat_timeout_cron.pl @@ -0,0 +1,241 @@ +#!/usr/bin/perl + +# AST_chat_timeout_cron.pl +# +# This script is triggered by the ADMIN_keepalive_ALL.pl to run on the active voicemail server +# +# Copyright (C) 2015 Joe Johnson LICENSE: AGPLv2 +# +# CHANGES +# 150605-2135 - First build +# 150902-2209 - Slight SQL modifications for abandoned chats/notifying agents +# +# This script is designed to repeatedly check any customer-to-agent chats and close the customer side of the +# chat if it has not shown any activity for a period of time longer that what was set for the chat_timeout +# system setting. +# +# It will also close any manager-to-agent chats that do not show the agent(s) involved are still logged in. + + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n"; + print " [--help] = this screen"; + print " [--debug] = verbose debug messages\n"; + print "\n"; + exit; + } + else + { + if ($args =~ /--version/i) + { + print "version: $build\n"; + exit; + } + if ($args =~ /--debug/i) + { + $DB=1; # Debug flag + $debug=1; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- SUPER-DUPER DEBUGGING -----\n\n"; + } + } + } +else + { + # print "no command line options set\n"; + } +### end parsing run-time options ### + + + +# default path to astguiclient configuration file: + +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_custom_user/) && ($CLIDB_custom_user < 1) ) + {$VARDB_custom_user = $line; $VARDB_custom_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_custom_pass/) && ($CLIDB_custom_pass < 1) ) + {$VARDB_custom_pass = $line; $VARDB_custom_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP +$THISserver_voicemail=0; +$voicemail_server_id=''; +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; +$dbhA2 = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; +$dbhA3 = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +$timeout_stmt="select allow_chats, chat_timeout from system_settings"; +$timeout_rslt=$dbhA->prepare($timeout_stmt); +$timeout_rslt->execute(); +@trow=$timeout_rslt->fetchrow_array; +$allow_chats=$trow[0]; +$chat_timeout=$trow[1]; + + +## Kill agent-customer chats that are dead according to the system's chat timeout setting +if ($allow_chats==1 && $chat_timeout>0) { + $stmt="select distinct chat_id from vicidial_chat_participants where vd_agent='N' and ping_date<=now()-INTERVAL ".$chat_timeout." SECOND"; + if ($debug) {print $stmt."\n\n";} + $rslt=$dbhA->prepare($stmt); + $rslt->execute(); + if ($rslt->rows>0) { + $chat_id_str=""; + while (@row=$rslt->fetchrow_array) { + $chat_id_str.="$row[0],"; + } + $chat_id_str=~s/,$//; + + $archive_stmt="insert ignore into vicidial_chat_archive select chat_id, chat_start_time, 'DROP' as status, chat_creator, group_id, lead_id from vicidial_live_chats where chat_id in (".$chat_id_str.")"; + $dbhA->do($archive_stmt); + $archive_log_stmt="insert ignore into vicidial_chat_log_archive select * from vicidial_chat_log where chat_id in (".$chat_id_str.")"; + $dbhA->do($archive_log_stmt); + + $del_stmt="delete from vicidial_chat_participants where vd_agent='N' and ping_date<=now()-INTERVAL ".$chat_timeout." SECOND and chat_id in (".$chat_id_str.")"; + $del_rslt=$dbhA->do($del_stmt); + if ($debug) {print $del_stmt."\n\n";} + + ########### CLEAR OUT UN-ASSIGNED CHATS + # GET LEAD IDS TO UPDATE vicidial_list TO SHOW CDROP STATUS + $sel_stmt="select lead_id from vicidial_live_chats where chat_id in (".$chat_id_str.") and status='WAITING' and chat_creator='NONE'"; + $sel_rslt=$dbhA->prepare($sel_stmt); + $sel_rslt->execute(); + $lead_id_str=""; + while (@sel_row->$sel_rslt->fetchrow_array) { + $lead_id_str.="$sel_row[0],"; + } + $lead_id_str=~s/,$//; + $upd_stmt="update vicidial_list set status='CDROP' where lead_id in (".$lead_id_str.")"; + $upd_rslt=$dbhA->do($upd_stmt); + + $del_stmt="delete from vicidial_live_chats where chat_id in (".$chat_id_str.") and status='WAITING' and chat_creator='NONE'"; + $del_rslt=$dbhA->do($del_stmt); + if ($debug) {print $del_stmt."\n\n";} + $del_log_stmt="delete from vicidial_chat_log where chat_id in (".$chat_id_str.")"; + $del_log_rslt=$dbhA->do($del_log_stmt); + ####################################### + + ########### CLEAN ASSIGNED CHATS, NOTIFY AGENTS + $sel_stmt="select lead_id, chat_creator, chat_id from vicidial_live_chats where chat_id in (".$chat_id_str.") and status='LIVE' and chat_creator!='NONE'"; + $sel_rslt=$dbhA->prepare($sel_stmt); + $sel_rslt->execute(); + # DON'T UPDATE DISPO ON LEAD TO CDROP - NOTIFY AGENT AND LET THEM DO IT + while (@sel_row->$sel_rslt->fetchrow_array) { + $lead_id_str.="$sel_row[0],"; + $lead_id=$sel_row[0]; + $chat_creator=$sel_row[1]; + $chat_id=$sel_row[2]; + $ins_alert_stmt="insert into vicidial_chat_log(poster, chat_member_name, message_time, message, chat_id, chat_level) select '$chat_creator', full_name, now(), 'Customer seems to have abandoned chat', '$chat_id', '1' from vicidial_users where user='$chat_creator'"; + $ins_alert_rslt=$dbhA2->do($ins_alert_stmt); + } + $lead_id_str=~s/,$//; + + ####################################### + + } +} +## Kill manager-agent chats where the agent has logged out/is no longer live in the system +# $debug=1; +if ($allow_chats==1) { + $live_stmt="select user from vicidial_live_agents"; + if ($debug) {print "$live_stmt\n";} + $live_rslt=$dbhA->prepare($live_stmt); + $live_rslt->execute(); + $agent_str=""; + while (@live_row=$live_rslt->fetchrow_array) { + $agent_str.="$live_row[0],"; + } + $agent_str=~s/,$//; + + if ($live_rslt->rows>0) { + $archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log where user not in ($agent_str)"; + $dbhA2->do($archive_stmt); + if ($debug) {print $archive_stmt."\n\n";} + $del_stmt="delete from vicidial_manager_chat_log where user not in ($agent_str)"; + $del_rslt=$dbhA2->do($del_stmt); + if ($debug) {print $del_stmt."\n\n";} + + $chat_stmt="select distinct manager_chat_id from vicidial_manager_chat_log"; + $chat_rslt=$dbhA2->prepare($chat_stmt); + $chat_rslt->execute(); + if ($chat_rslt->rows==0) { + $ins_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats"; + $dbhA3->do($ins_stmt); + $del_stmt="delete from vicidial_manager_chats"; + $del_rslt=$dbhA3->do($del_stmt); + if ($debug) {print $del_stmt."\n\n";} + + } else { + $chat_str=""; + while (@chat_row=$chat_rslt->fetchrow_array) { + $chat_str.="$chat_row[0],"; + } + $chat_str=~s/,$//; + + $ins_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats where manager_chat_id not in ($chat_str)"; + $dbhA3->do($ins_stmt); + $del_stmt="delete from vicidial_manager_chats where manager_chat_id not in ($chat_str)"; + $del_rslt=$dbhA3->do($del_stmt); + } + } else { + # Clear all chats because no one is logged in + $archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log"; + $dbhA2->do($archive_stmt); + if ($debug) {print $archive_stmt."\n\n";} + $del_stmt="delete from vicidial_manager_chat_log"; + $del_rslt=$dbhA2->do($del_stmt); + if ($debug) {print $del_stmt."\n\n";} + + $ins_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats"; + $dbhA3->do($ins_stmt); + $del_stmt="delete from vicidial_manager_chats"; + $del_rslt=$dbhA3->do($del_stmt); + } +} diff --git a/docs/CHAT_MESSAGING.txt b/docs/CHAT_MESSAGING.txt new file mode 100644 index 00000000..9cf0064c --- /dev/null +++ b/docs/CHAT_MESSAGING.txt @@ -0,0 +1,54 @@ +CHAT MESSAGING Started 2014-05-01 Updated 2015-12-13 + + +After over 18 months of development, the Chat Messaging system for Vicidial was added to svn/trunk on December 13th, 2015(svn revision 2428). Our Chat messaging allows for customers to chat with agents from websites, as well as allowing managers to chat with agents and agents to chat with other agents all within their existing agent screen. + +The Chat Messaging built into Vicidial is entirely web-based and uses it's own protocol. Also, all messages are logged and searchable though the Agent-Manager Chat Log accessible through the Admin Utilities webpage. + + + +AGENT CHAT INTERFACE INSTRUCTIONS: + +If your system administrator has enabled the chat feature, when you log in to the Vicidial agent interface, you will see two tabs at the top of your interface labeled "CHAT INTERNAL" and "CHAT CUSTOMER". + +If you have any internal chats open, the words "CHAT INTERNAL" will appear in red. If you are involved in a chat where there are unread messages, the chat tab will be blinking red. To view the agent customer chat interface, simply click on the "CHAT CUSTOMER" tabs. The chat interface window will appear in place of the customer's information. If you have a chat with an unread message, that chat will automatically load in the agent screen by default, along with the name of the person you are chatting with and the date and time the chat started. If you have no unread messages, but have any open chats, the chat where the last message was posted will load by default. Otherwise, the screen will simply inform you that you have no active chats. + +In the chat window, messages posted by you are displayed in blue text, while messages posted by the person you are chatting with are displayed in red. + +Beneath the chat window is the text box you use to type in messages and send them. You can send them either by clicking the blue "SEND MESSAGE" button or by simply pressing the Enter key on your keyboard while you are typing something into the text box. + + +On the right side of the "CHAT INTERNAL" screen is a box labeled "Your active chats". For every open chat that you have, this box will display the name of the user you are chatting with. Chats with unread messages will be printed in boldface and highlighted in blue. To toggle between chats, simply click on the name of the person you are chatting with. + +As you receive messages via the chat interface, you will occasionally hear an audio cue indicating you have a new message. If you would like to prevent this cue from being played, there is a checkbox beneath the "Your active chats" labeled "Mute alert sound" that you can mark to prevent this cue from being played. + +If at any point you would like to initiate a chat with another user, you may click on the green "CHAT WITH LIVE AGENT" button to bring up a simple form to begin chatting with an agent. On the left side of the screen you may select a live agent to chat with. The only agents that will be available for you to talk to will be agents who meet two criteria: + +1. They must currently be logged into the Vicidial agent interface. +2. They must belong to a user group that your user group has the ability to transfer to - these are the "Agent Status Viewable Groups" which are defined in the admin User Group page by authorized administrators. + +On the right side of the screen is a text box in which you type the initial message you'd like to send to the selected live agent. Once you have filled this out you may click the green "START CHAT" button. You must have selected an agent and also have entered a message. + +You can return to the chat screen at any time by clicking the red "BACK TO CHAT SCREEN" button. This will also clear anything you entered into the agent form. + + + +MANAGER CHAT INTERFACE INSTRUCTIONS: + +In the Administration web screen, there is a new link at the top of the screen next to the HOME link and the Timeclock link called "Chat". If you click on this link, you will be taken to the new manager chat screen. This screen will allow you to start chats with logged-in agents, as well as give you the ability to send broadcast chats to all agents that are logged in, or just specific agents. + + + +CUSTOMER CHAT INSTRUCTIONS: + +There is a new folder in the web directory called "chat_customer". You will find a file in this folder called "customer_chat_code.php" that you can use to write your own web page for a customer to chat from, or you can just use that page as your Chat URL. The Chat URL is a field in the System Settings that you need to populate in order for the customer chat to work. To use the default for this, just add "chat_customer/customer_chat_code.php" to your current Vicidial webserver URL. For example, if your current webserver url is "http://192.168.1.2/" then you can use this as your Chat URL: "http://192.168.1.2/chat_customer/customer_chat_code.php" + + +Chat settings in System Settings: + +Allow Chats -This is where you can set whether this system will be able to receive incoming chats in addition to phone calls, as well as allow agent-to-agent and agent-to-manager chatting. + +Chat Timeout -This is where you can set how long a customer chat can stay alive after the customer has navigated away from or closed their chat window. When the timeout is reached the chat is closed. + +Chat URL -This is the location where you have placed the chat web pages for customer use. + diff --git a/install.pl b/install.pl index 8bc8c857..bb6ba059 100644 --- a/install.pl +++ b/install.pl @@ -40,6 +40,7 @@ # 150312-0942 - Added ExpectedDBSchema value in astguiclient.conf # 150911-1808 - Added creation of GPG directory for encrypted recordings # 151029-0650 - Added Asterisk 11 as listed option, added new sample voicemail.conf for 1.8 and higher +# 151212-0840 - Added chat_customer web directory, removed static language build actions # ############################################ @@ -2557,6 +2558,7 @@ if ($NOWEB < 1) if (!-e "$PATHweb/vicidial/ploticus/") {`mkdir -p $PATHweb/vicidial/ploticus/`;} if (!-e "$PATHweb/vicidial/agent_reports/") {`mkdir -p $PATHweb/vicidial/agent_reports/`;} if (!-e "$PATHweb/vicidial/server_reports/") {`mkdir -p $PATHweb/vicidial/server_reports/`;} + if (!-e "$PATHweb/chat_customer/") {`mkdir -p $PATHweb/chat_customer/`;} print "Copying web files...\n"; # save custom.css if its not empty @@ -2568,11 +2570,13 @@ if ($NOWEB < 1) `cp -f ./www/vicidial/robots.txt $PATHweb/vicidial/agent_reports/`; `cp -f ./www/vicidial/robots.txt $PATHweb/vicidial/server_reports/`; if (-e "$PATHweb/agc/css/custom.css.save_user_changes") {`mv $PATHweb/agc/css/custom.css.save_user_changes $PATHweb/agc/css/custom.css`;} + `cp -f ./www/vicidial/robots.txt $PATHweb/chat_customer/`; print "setting web scripts to executable...\n"; `chmod 0777 $PATHweb/`; `chmod -R 0755 $PATHweb/agc/`; `chmod -R 0755 $PATHweb/vicidial/`; + `chmod -R 0755 $PATHweb/chat_customer/`; `chmod 0777 $PATHweb/agc/`; `chmod 0777 $PATHweb/vicidial/`; `chmod 0777 $PATHweb/vicidial/ploticus/`; @@ -2587,86 +2591,12 @@ if ($NOWEB < 1) `rm -f $PATHweb/vicidial/new_listloader_superL.php`; `rm -f $PATHweb/vicidial/listloader_super.pl`; `rm -f $PATHweb/vicidial/listloader.pl`; + `chmod 0777 $PATHweb/chat_customer/`; } if ( ($PROMPTcopy_web_lang =~ /y/i) || ($CLIcopy_web_lang =~ /y/i) ) { - print "Copying web language translation files to $PATHweb...\n"; - if (!-e "$PATHweb/agc_br/") {`mkdir -p $PATHweb/agc_br/`;} - if (!-e "$PATHweb/agc_de/") {`mkdir -p $PATHweb/agc_de/`;} - if (!-e "$PATHweb/agc_dk/") {`mkdir -p $PATHweb/agc_dk/`;} - if (!-e "$PATHweb/agc_el/") {`mkdir -p $PATHweb/agc_el/`;} - if (!-e "$PATHweb/agc_en/") {`mkdir -p $PATHweb/agc_en/`;} - if (!-e "$PATHweb/agc_es/") {`mkdir -p $PATHweb/agc_es/`;} - if (!-e "$PATHweb/agc_fr/") {`mkdir -p $PATHweb/agc_fr/`;} - if (!-e "$PATHweb/agc_it/") {`mkdir -p $PATHweb/agc_it/`;} - if (!-e "$PATHweb/agc_jp/") {`mkdir -p $PATHweb/agc_jp/`;} - if (!-e "$PATHweb/agc_nl/") {`mkdir -p $PATHweb/agc_nl/`;} - if (!-e "$PATHweb/agc_pl/") {`mkdir -p $PATHweb/agc_pl/`;} - if (!-e "$PATHweb/agc_pt/") {`mkdir -p $PATHweb/agc_pt/`;} - if (!-e "$PATHweb/agc_ru/") {`mkdir -p $PATHweb/agc_ru/`;} - if (!-e "$PATHweb/agc_se/") {`mkdir -p $PATHweb/agc_se/`;} - if (!-e "$PATHweb/agc_sk/") {`mkdir -p $PATHweb/agc_sk/`;} - if (!-e "$PATHweb/agc_tw/") {`mkdir -p $PATHweb/agc_tw/`;} - if (!-e "$PATHweb/vicidial_br/") {`mkdir -p $PATHweb/vicidial_br/`;} - if (!-e "$PATHweb/vicidial_de/") {`mkdir -p $PATHweb/vicidial_de/`;} - if (!-e "$PATHweb/vicidial_el/") {`mkdir -p $PATHweb/vicidial_el/`;} - if (!-e "$PATHweb/vicidial_en/") {`mkdir -p $PATHweb/vicidial_en/`;} - if (!-e "$PATHweb/vicidial_es/") {`mkdir -p $PATHweb/vicidial_es/`;} - if (!-e "$PATHweb/vicidial_fr/") {`mkdir -p $PATHweb/vicidial_fr/`;} - if (!-e "$PATHweb/vicidial_it/") {`mkdir -p $PATHweb/vicidial_it/`;} - - print "Copying web files...\n"; - `cp -f -R ./LANG_www/* $PATHweb/`; - - print "setting web lang scripts to executable...\n"; - `chmod 0777 $PATHweb/`; - `chmod -R 0755 $PATHweb/agc_br/`; - `chmod -R 0755 $PATHweb/agc_de/`; - `chmod -R 0755 $PATHweb/agc_dk/`; - `chmod -R 0755 $PATHweb/agc_el/`; - `chmod -R 0755 $PATHweb/agc_en/`; - `chmod -R 0755 $PATHweb/agc_es/`; - `chmod -R 0755 $PATHweb/agc_fr/`; - `chmod -R 0755 $PATHweb/agc_it/`; - `chmod -R 0755 $PATHweb/agc_jp/`; - `chmod -R 0755 $PATHweb/agc_nl/`; - `chmod -R 0755 $PATHweb/agc_pl/`; - `chmod -R 0755 $PATHweb/agc_pt/`; - `chmod -R 0755 $PATHweb/agc_ru/`; - `chmod -R 0755 $PATHweb/agc_se/`; - `chmod -R 0755 $PATHweb/agc_sk/`; - `chmod -R 0755 $PATHweb/agc_tw/`; - `chmod -R 0755 $PATHweb/vicidial_br/`; - `chmod -R 0755 $PATHweb/vicidial_de/`; - `chmod -R 0755 $PATHweb/vicidial_el/`; - `chmod -R 0755 $PATHweb/vicidial_en/`; - `chmod -R 0755 $PATHweb/vicidial_es/`; - `chmod -R 0755 $PATHweb/vicidial_fr/`; - `chmod -R 0755 $PATHweb/vicidial_it/`; - `chmod 0777 $PATHweb/agc_br/`; - `chmod 0777 $PATHweb/agc_de/`; - `chmod 0777 $PATHweb/agc_dk/`; - `chmod 0777 $PATHweb/agc_el/`; - `chmod 0777 $PATHweb/agc_en/`; - `chmod 0777 $PATHweb/agc_es/`; - `chmod 0777 $PATHweb/agc_fr/`; - `chmod 0777 $PATHweb/agc_it/`; - `chmod 0777 $PATHweb/agc_jp/`; - `chmod 0777 $PATHweb/agc_nl/`; - `chmod 0777 $PATHweb/agc_pl/`; - `chmod 0777 $PATHweb/agc_pt/`; - `chmod 0777 $PATHweb/agc_ru/`; - `chmod 0777 $PATHweb/agc_se/`; - `chmod 0777 $PATHweb/agc_sk/`; - `chmod 0777 $PATHweb/agc_tw/`; - `chmod 0777 $PATHweb/vicidial_br/`; - `chmod 0777 $PATHweb/vicidial_de/`; - `chmod 0777 $PATHweb/vicidial_el/`; - `chmod 0777 $PATHweb/vicidial_en/`; - `chmod 0777 $PATHweb/vicidial_es/`; - `chmod 0777 $PATHweb/vicidial_fr/`; - `chmod 0777 $PATHweb/vicidial_it/`; + print "Static language files no longer available, use dynamic language features.\n"; } if ($PATHconf !~ /\/etc\/astguiclient.conf/) @@ -2690,6 +2620,7 @@ if ($PATHconf !~ /\/etc\/astguiclient.conf/) `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/vicidial/listloader_super.pl `; `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/vicidial/listloader_rowdisplay.pl `; `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/vicidial/spreadsheet_sales_viewer.pl `; + `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/chat_customer/dbconnect_mysqli.php `; } if ( ($PROMPTcopy_conf_files =~ /y/i) || ($CLIcopy_conf_files =~ /y/i) ) diff --git a/www/agc/agc_agent_manager_chat_interface.php b/www/agc/agc_agent_manager_chat_interface.php new file mode 100644 index 00000000..0fa498b7 --- /dev/null +++ b/www/agc/agc_agent_manager_chat_interface.php @@ -0,0 +1,269 @@ + LICENSE: AGPLv2 +# +# This page is for agents to chat with managers via the agent interface. +# +# changes: +# 141212-2245 - First Build +# 151213-1108 - Added variable filtering +# + +$admin_version = '2.12-2'; +$build = '151213-1108'; + +$sh="managerchats"; + +require("dbconnect_mysqli.php"); +require("functions.php"); + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,enable_languages,language_method FROM system_settings;"; +$rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysqli_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $non_latin = $row[0]; + $SSenable_languages = $row[1]; + $SSlanguage_method = $row[2]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["action"])) {$action=$_GET["action"];} + elseif (isset($_POST["action"])) {$action=$_POST["action"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["manager_chat_id"])) {$manager_chat_id=$_GET["manager_chat_id"];} + elseif (isset($_POST["manager_chat_id"])) {$manager_chat_id=$_POST["manager_chat_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 (!$user) {echo "Page should only be viewed through the agent interface."; die;} + +if ($non_latin < 1) + { + $user = preg_replace('/[^-\_0-9a-zA-Z]/','',$user); + $pass = preg_replace('/[^-\_0-9a-zA-Z]/','',$pass); + $manager_chat_id = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$user); + } +else + { + $user = preg_replace("/\'|\"|\\\\|;/","",$user); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); + $manager_chat_id = preg_replace("/\'|\"|\\\\|;/","",$user); + } + +# Get a count on unread messages where the user is involved but not the chat manager/initiator in order to create the ChatReloadIDNumber variable +$chat_reload_id_number_array=array(); +$unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.user='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid"; +$unread_rslt=mysqli_query($link, $unread_stmt); +while ($unread_row=mysqli_fetch_array($unread_rslt)) { + $IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"]; + array_push($chat_reload_id_number_array, "$IDNumber"); +} + +# Pull the most recently posted-to chat that has not been viewed, then the most recent period, and display that as the default window +$stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)),vicidial_manager_chat_log.user from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.user='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chats.manager=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc"; +$rslt=mysqli_query($link, $stmt); + +$active_chats_array=array(); +$chat_subid_array=array(); +$unread_chats_array=array(); +$chat_managers_array=array(); +$chat_start_date_array=array(); +$agents_managers_array=array(); // for override +$priority_chat=""; +$priority_chat_subid=""; +while ($row=mysqli_fetch_row($rslt)) { + if ($row[0]!="") { + if (!$priority_chat) {$priority_chat=$row[0];} # The priority_chat is the most recent chat that has not been viewed. + if (!$priority_chat_subid) {$priority_chat_subid=$row[1];} # The priority_chat is the most recent chat that has not been viewed. + if (!$agent_manager_override) {$agent_manager_override="0";} # The priority_chat is the most recent chat that has not been viewed. + array_push($active_chats_array, "$row[0]"); + $chat_subid_array[$row[0]]="$row[1]"; + $chat_managers_array[$row[0]]="$row[2]"; + $chat_start_date_array[$row[0]]="$row[3]"; + if ($row[4]>0) {array_push($unread_chats_array, $row[0]);} # Store any chat with unread messages. + $agents_managers_array[$row[0]]="0"; // not a chat where the agent is a manager + } +} + + # Get a count on unread messages where the user is the chat manager/initiator in order to create the ChatReloadIDNumber variable + $unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.manager='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid"; + $unread_rslt=mysqli_query($link, $unread_stmt); + while ($unread_row=mysqli_fetch_array($unread_rslt)) { + $IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"]; + array_push($chat_reload_id_number_array, "$IDNumber"); + } + + + ### This was added for agent to agent chats since there needs to be a list of open chats where the agent viewing this is also the manager, + ### which will now happen because agents can now start their own chats. Added vicidial_manager_chat_log.user to this query on 2/4/15 for + ### manager override + $stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)),vicidial_manager_chat_log.user from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.manager='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chat_log.user=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc"; + $rslt=mysqli_query($link, $stmt); + while ($row=mysqli_fetch_row($rslt)) { + if ($row[0]!="") { + if (!$priority_chat) {$priority_chat=$row[0];} # The priority_chat is the most recent chat that has not been viewed. + if (!$priority_chat_subid) {$priority_chat_subid=$row[1];} # The priority_chat is the most recent chat that has not been viewed. + if (!$agent_manager_override) {$agent_manager_override=$row[5];} # The priority_chat is the most recent chat that has not been viewed. + array_push($active_chats_array, "$row[0]"); + $chat_subid_array[$row[0]]="$row[1]"; // Added back in on 3/3 - why was this removed? + $chat_managers_array[$row[0]]="$row[2]"; + $chat_start_date_array[$row[0]]="$row[3]"; + if ($row[4]>0) {array_push($unread_chats_array, $row[0]);} # Store any chat with unread messages. + $agents_managers_array[$row[0]]="$row[5]"; // IS a chat where the agent is a manager + } + } + ######### +asort($active_chats_array); +asort($chat_managers_array); + +asort($chat_reload_id_number_array); +$ChatReloadIDNumber=""; +while (list($key, $id_number) = each($chat_reload_id_number_array)) { + $ChatReloadIDNumber.="$id_number."; +} +$ChatReloadIDNumber=substr($ChatReloadIDNumber,0,-1); +?> + + + + + + + +<?php echo _QXZ("ADMINISTRATION: Agent/Manager Chat Interface"); ?> + + +"; +echo ""; +echo "\n"; +echo ""; +echo ""; +echo ""; +echo ""; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +#echo "\n"; +#echo "\n"; +#echo "\n"; +echo "
Chatting with:
".$chat_managers_array[$priority_chat]."
Chat started:
".$chat_start_date_array[$priority_chat]."
Your active chats:
\n"; +echo "\t

\n"; +echo "\t\n"; +echo "
\n"; +echo "
\n"; + echo "
    "; + if (empty($chat_managers_array)) { + echo "\t
  • NO OPEN CHATS
  • \n"; + } else { + while (list($manager_chat_id, $text) = each($chat_managers_array)) { + $manager_chat_subid=$chat_subid_array[$manager_chat_id]; + if (!empty($unread_chats_array) && in_array($manager_chat_id, $unread_chats_array)) {$cclass="unreadchat";} else {$cclass="viewedchat";} + echo "\t
  • ".$chat_managers_array[$manager_chat_id]."
  • \n"; + + $sid++; + } + } + echo "
\n"; +echo "\t
\n"; +echo "(bolded chats = unread messages)
Mute alert sound
\n"; +echo "\t

\n"; +echo "\t

"; +echo "
 \n"; +#echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo ""; +?> +
+ + + diff --git a/www/agc/chat_db_query.php b/www/agc/chat_db_query.php new file mode 100644 index 00000000..8c6c16c9 --- /dev/null +++ b/www/agc/chat_db_query.php @@ -0,0 +1,807 @@ + LICENSE: AGPLv2 +# +# Called by vdc_chat_display.php and vicidial_chat_agent.js. This contains all actions taken by the +# agent's interface when chatting with customers, other agents, and managers, through +# vdc_chat_display.php and vicidial_chat_agent.js. Sample actions include creating and ending +# agent-to-agent chats, refreshing the chat window, and sending messages to the database to be +# displayed. +# +# Builds: +# 150901-2348 - First build +# + +require("dbconnect_mysqli.php"); +require("functions.php"); + +$NOW_TIME = date("Y-m-d H:i:s"); +$color_array=array("#FF0000", "#0000FF", "#009900", "#990099", "#009999", "#666600", "#999999"); +$style_array=array("", "italics", "bold italics"); + +if (isset($_GET["action"])) {$action=$_GET["action"];} + elseif (isset($_POST["action"])) {$action=$_POST["action"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["chat_id"])) {$chat_id=$_GET["chat_id"];} + elseif (isset($_POST["chat_id"])) {$chat_id=$_POST["chat_id"];} +if (isset($_GET["chat_group_id"])) {$chat_group_id=$_GET["chat_group_id"];} + elseif (isset($_POST["chat_group_id"])) {$chat_group_id=$_POST["chat_group_id"];} +if (isset($_GET["chat_level"])) {$chat_level=$_GET["chat_level"];} + elseif (isset($_POST["chat_level"])) {$chat_level=$_POST["chat_level"];} +if (isset($_GET["chat_creator"])) {$chat_creator=$_GET["chat_creator"];} + elseif (isset($_POST["chat_creator"])) {$chat_creator=$_POST["chat_creator"];} +if (isset($_GET["chat_member_name"])) {$chat_member_name=$_GET["chat_member_name"];} + elseif (isset($_POST["chat_member_name"])) {$chat_member_name=$_POST["chat_member_name"];} +if (isset($_GET["chat_message"])) {$chat_message=$_GET["chat_message"];} + elseif (isset($_POST["chat_message"])) {$chat_message=$_POST["chat_message"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} + elseif (isset($_POST["user_level"])) {$user_level=$_POST["user_level"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} + elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} +if (isset($_GET["keepalive"])) {$keepalive=$_GET["keepalive"];} + elseif (isset($_POST["keepalive"])) {$keepalive=$_POST["keepalive"];} +if (isset($_GET["current_message_count"])) {$current_message_count=$_GET["current_message_count"];} + elseif (isset($_POST["current_message_count"])) {$current_message_count=$_POST["current_message_count"];} + +if (isset($_GET["manager_chat_id"])) {$manager_chat_id=$_GET["manager_chat_id"];} + elseif (isset($_POST["manager_chat_id"])) {$manager_chat_id=$_POST["manager_chat_id"];} +if (isset($_GET["manager_chat_subid"])) {$manager_chat_subid=$_GET["manager_chat_subid"];} + elseif (isset($_POST["manager_chat_subid"])) {$manager_chat_subid=$_POST["manager_chat_subid"];} +if (isset($_GET["agent_manager"])) {$agent_manager=$_GET["agent_manager"];} + elseif (isset($_POST["agent_manager"])) {$agent_manager=$_POST["agent_manager"];} +if (isset($_GET["agent_user"])) {$agent_user=$_GET["agent_user"];} + elseif (isset($_POST["agent_user"])) {$agent_user=$_POST["agent_user"];} +if (isset($_GET["agent_override"])) {$agent_override=$_GET["agent_override"];} + elseif (isset($_POST["agent_override"])) {$agent_override=$_POST["agent_override"];} +if (isset($_GET["hangup_override"])) {$hangup_override=$_GET["hangup_override"];} + elseif (isset($_POST["hangup_override"])) {$hangup_override=$_POST["hangup_override"];} +if (isset($_GET["manager_message"])) {$manager_message=$_GET["manager_message"];} + elseif (isset($_POST["manager_message"])) {$manager_message=$_POST["manager_message"];} +if (isset($_GET["ChatReloadIDNumber"])) {$ChatReloadIDNumber=$_GET["ChatReloadIDNumber"];} + elseif (isset($_POST["ChatReloadIDNumber"])) {$ChatReloadIDNumber=$_POST["ChatReloadIDNumber"];} + +$chat_member_name = preg_replace('/[^- \.\,\_0-9a-zA-Z]/',"",$chat_member_name); +if (!$user) {echo "No user, no using."; exit;} + +###### AGENT/MANAGER CHAT FUNCTIONS ####### +if ($action=="CreateAgentToAgentChat" && $agent_manager && $agent_user && $manager_message) { + + # Check that you aren't already chatting with the agent - also checks for chats where the other agent is the manager and you are the requested chat recipient + $dupe_chat_stmt="select * from vicidial_manager_chats where (manager='$agent_manager' and selected_agents like '%|$agent_user|%') or (manager='$agent_user' and selected_agents like '%|$agent_manager|%')"; + $dupe_chat_rslt=mysqli_query($link, $dupe_chat_stmt); + if (mysqli_num_rows($dupe_chat_rslt)>0) { + echo "Error: You already have an open chat with this agent"; + } else { + + # This is slightly different from the manager-to-agent chat because it's only one agent you're chatting to so for reporting all that agent's specific information is grabbed and used to make the vicidial_manager_chats entry. Since the query should only return one result there's no while loop to insert subid chat info. + + $stmt="select vicidial_live_agents.user, vicidial_users.full_name, vicidial_users.user_group, vicidial_live_agents.campaign_id from vicidial_live_agents, vicidial_users where vicidial_live_agents.user=vicidial_users.user and vicidial_live_agents.user='$agent_user' and vicidial_users.user!='$agent_manager' order by vicidial_users.full_name asc"; + $rslt=mysqli_query($link, $stmt); + if (mysqli_num_rows($rslt)>0) { + $row=mysqli_fetch_row($rslt); + + $user=$row[0]; + $user_group=$row[2]; + $campaign_id=$row[3]; + + $ins_stmt="insert into vicidial_manager_chats(chat_start_date, manager, selected_agents, selected_user_groups, selected_campaigns, allow_replies) VALUES(now(), '$agent_manager', '|$agent_user|', '|$user_group|', '|$campaign_id|', 'Y')"; + $ins_rslt=mysqli_query($link, $ins_stmt); + $manager_chat_id=mysqli_insert_id($link); + + $subid=1; + + # $manager_message = preg_replace('/;/i','',$manager_message); + $manager_message = preg_replace("/\r/i",'',$manager_message); + $manager_message = preg_replace("/\n/i",' ',$manager_message); + # $manager_message=addslashes(trim("$manager_message")); + + $ins_chat_stmt="insert into vicidial_manager_chat_log(manager_chat_id, manager_chat_subid, manager, user, message, message_date, message_posted_by) VALUES('$manager_chat_id', '$subid', '$agent_manager', '$agent_user', '".mysqli_real_escape_string($link, $manager_message)."', now(), '$agent_manager')"; + $ins_chat_rslt=mysqli_query($link, $ins_chat_stmt); + echo "$manager_chat_id|$subid"; + } + } +} + +if ($action=="DisplayMgrAgentChat" && $manager_chat_id && $manager_chat_subid && $user) { + $stmt="select vm.message_posted_by, vm.message, vm.message_date, vu.full_name, vm.manager, vm.manager_chat_subid, vmc.chat_start_date from vicidial_manager_chats vmc, vicidial_manager_chat_log vm, vicidial_users vu where vmc.manager_chat_id='$manager_chat_id' and vmc.manager_chat_id=vm.manager_chat_id and vm.manager_chat_subid='$manager_chat_subid' and vm.user=vu.user order by vm.manager_chat_subid asc, message_date desc"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($debug==1) {echo "$stmt
\n";} + + # Mark messages as viewed by user (not manager, even if manager is agent at the time) + $upd_stmt="update vicidial_manager_chat_log set message_viewed_date=now() where message_viewed_date is null and manager_chat_id='$manager_chat_id' and manager_chat_subid='$manager_chat_subid' and user='$user'"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + $new_messages=mysqli_affected_rows($link); + + if (mysqli_num_rows($rslt)>0) { + $prev_chat_subid=""; + $backlog_limit=20; + $chat_output_text=""; + while($row=mysqli_fetch_row($rslt)) { + if (!$chat_start_date) {$chat_start_date=$row[6];} + if (!$manager) {$manager=$row[4];} + if ($backlog_limit>0) { + # Current agent is always the blue text + if ($row[0]!=$user) {$fc="#990000";} else {$fc="#000099";} + $chat_output_text="$row[1]
".$chat_output_text; + $backlog_limit--; + } + } + + $reply_stmt="select allow_replies from vicidial_manager_chats where manager_chat_id='$manager_chat_id'"; + $reply_rslt=mysql_to_mysqli($reply_stmt, $link); + $reply_row=mysqli_fetch_row($reply_rslt); + $allow_replies=$reply_row[0]; + + if ($manager==$user) { + $mgr_stmt="select distinct full_name from vicidial_users vu, vicidial_manager_chat_log vc where manager_chat_id='$manager_chat_id' and manager_chat_subid='$manager_chat_subid' and vc.user=vu.user"; + $mgr_rslt=mysql_to_mysqli($mgr_stmt, $link); + if (mysqli_num_rows($mgr_rslt)!=1) { + $display_name="ERROR - $mgr_stmt"; + } else { + $mgr_row=mysqli_fetch_row($mgr_rslt); + $display_name=$mgr_row[0]; + } + } else { + $mgr_stmt="select full_name from vicidial_users where user='$manager'"; + $mgr_rslt=mysql_to_mysqli($mgr_stmt, $link); + $mgr_row=mysqli_fetch_row($mgr_rslt); + $display_name=$mgr_row[0]; + } + + echo $allow_replies."\n".$chat_output_text."\n".$chat_start_date."\n".$display_name."\n".$new_messages; + } else { + echo "N\nCHAT ENDED\n\n"; + } +} + +if ($action=="EndAgentToAgentChat" && $manager_chat_id) { + $archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id'"; + $archive_rslt=mysqli_query($link, $archive_stmt); + + $archive_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats where manager_chat_id='$manager_chat_id'"; + $archive_rslt=mysqli_query($link, $archive_stmt); + + $delete_stmt="delete from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id'"; + $delete_rslt=mysqli_query($link, $delete_stmt); + + if (mysqli_affected_rows($link)>0) { + $archive_stmt="delete from vicidial_manager_chats where manager_chat_id='$manager_chat_id'"; + $archive_rslt=mysqli_query($link, $archive_stmt); + } + echo mysqli_affected_rows($link); +} + +if ($action=="RefreshActiveChatView" && $user) { + # Get a count on unread messages where the user is involved but not the chat manager/initiator in order to create the ChatReloadIDNumber variable + $chat_reload_id_number_array=array(); + $unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.user='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid"; + $unread_rslt=mysqli_query($link, $unread_stmt); + while ($unread_row=mysqli_fetch_array($unread_rslt)) { + $IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"]; + array_push($chat_reload_id_number_array, "$IDNumber"); + } + + # Pull the most recently posted-to chat that has not been viewed, then the most recent period, and display that as the default window + $stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)) from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.user='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chats.manager=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc"; + $rslt=mysqli_query($link, $stmt); + + $active_chats_array=array(); + $chat_subid_array=array(); + $unread_chats_array=array(); + $chat_managers_array=array(); + $chat_start_date_array=array(); + while ($row=mysqli_fetch_row($rslt)) { + if ($row[0]!="") { + array_push($active_chats_array, "$row[0]"); + $chat_subid_array[$row[0]]="$row[1]"; + $chat_managers_array[$row[0]]="$row[2]"; + $chat_start_date_array[$row[0]]="$row[3]"; + if ($row[4]>0) {array_push($unread_chats_array, $row[0]);} # Store any chat with unread messages. + $agents_managers_array[$row[0]]="0"; + } + } + + # Get a count on unread messages where the user is the chat manager/initiator in order to create the ChatReloadIDNumber variable + $unread_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is not null, 0, 1)) as unread_count from vicidial_manager_chat_log where vicidial_manager_chat_log.manager='$user' group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid"; + $unread_rslt=mysqli_query($link, $unread_stmt); + while ($unread_row=mysqli_fetch_array($unread_rslt)) { + $IDNumber=$unread_row["manager_chat_id"]."-".$unread_row["manager_chat_subid"]."-".$unread_row["unread_count"]; + array_push($chat_reload_id_number_array, "$IDNumber"); + } + + ### This was added for agent to agent chats since there needs to be a list of open chats where the agent viewing this is also the manager, + ### which will now happen because agents can now start their own chats. Added vicidial_manager_chat_log.user to this query on 2/4/15 for + ### manager override + $stmt="select distinct vicidial_manager_chat_log.manager_chat_id, vicidial_manager_chat_log.manager_chat_subid, vicidial_users.full_name, vicidial_manager_chats.chat_start_date, sum(if(vicidial_manager_chat_log.message_viewed_date is null, 1, 0)),vicidial_manager_chat_log.user from vicidial_manager_chat_log, vicidial_manager_chats, vicidial_users where vicidial_manager_chat_log.manager='$user' and vicidial_manager_chat_log.manager_chat_id=vicidial_manager_chats.manager_chat_id and vicidial_manager_chat_log.user=vicidial_users.user group by manager_chat_id, manager_chat_subid order by message_viewed_date asc, message_date desc"; + $rslt=mysqli_query($link, $stmt); + while ($row=mysqli_fetch_row($rslt)) { + if ($row[0]!="") { + array_push($active_chats_array, "$row[0]"); + $chat_subid_array[$row[0]]="$row[1]"; + $chat_managers_array[$row[0]]="$row[2]"; + $chat_start_date_array[$row[0]]="$row[3]"; + if ($row[4]>0) {array_push($unread_chats_array, $row[0]);} # Store any chat with unread messages. + $agents_managers_array[$row[0]]="$row[5]"; // IS a chat where the agent is a manager + } + } + ######### + asort($chat_reload_id_number_array); + $new_ChatReloadIDNumber=""; + while (list($key, $id_number) = each($chat_reload_id_number_array)) { + $new_ChatReloadIDNumber.="$id_number."; + } + $new_ChatReloadIDNumber=substr($new_ChatReloadIDNumber,0,-1); + + sort($active_chats_array); + asort($chat_managers_array); + + if ($new_ChatReloadIDNumber!=$ChatReloadIDNumber) { + echo "$new_ChatReloadIDNumber|"; + echo "
    "; + if (empty($chat_managers_array)) { + echo "\t
  • NO OPEN CHATS
  • \n"; + } else { + while (list($manager_chat_id, $text) = each($chat_managers_array)) { + $manager_chat_subid=$chat_subid_array[$manager_chat_id]; + if (!empty($unread_chats_array) && in_array($manager_chat_id, $unread_chats_array)) {$cclass="unreadchat";} else {$cclass="viewedchat";} + echo "\t
  • ".$chat_managers_array[$manager_chat_id]."
  • \n"; + } + } + echo "
\n"; + } +} + +if ($action=="ReloadAgentNewChatSpan" && $user) { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Select a live agent:
\n"; + + $stmt="SELECT user_group from vicidial_users where user='$user';"; + if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00573',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysqli_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_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $agent_status_viewable_groups = $row[0]; + $agent_status_viewable_groupsSQL = preg_replace('/\s\s/i','',$agent_status_viewable_groups); + $agent_status_viewable_groupsSQL = preg_replace('/\s/i',"','",$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 (preg_match("/ALL-GROUPS/",$agent_status_viewable_groups)) + {$AGENTviewSQL = "";} + else + { + $AGENTviewSQL = "($agent_status_viewable_groupsSQL)"; + + if (preg_match("/CAMPAIGN-AGENTS/",$agent_status_viewable_groups)) + {$AGENTviewSQL = "($AGENTviewSQL or (campaign_id='$campaign'))";} + $AGENTviewSQL = "and $AGENTviewSQL"; + } + + $stmt="SELECT vla.user,vu.full_name from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user and vu.user!='$user' $AGENTviewSQL order by vu.full_name;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($rslt) {$agents_count = mysqli_num_rows($rslt);} + $loop_count=0; + echo ""; + + echo "
Message:
\n"; + echo ""; + echo "


\n
"; + +} + +if ($action=="SendMgrChatMessage" && $manager_chat_id && $manager_chat_subid) { + + $chat_message = preg_replace("/\r/i",'',$chat_message); + $chat_message = preg_replace("/\n/i",' ',$chat_message); + + $mgr_stmt="select manager from vicidial_manager_chats where manager_chat_id='$manager_chat_id'"; + $mgr_rslt=mysqli_query($link, $mgr_stmt); + $mgr_row=mysqli_fetch_row($mgr_rslt); + $manager=$mgr_row[0]; + + $message_posted_by=$user; + if ($agent_override && $agent_override!="0") {$user=$agent_override;} // Added for agent-to-agent chatting so the manager ID and user ID don't get mixed up + + if ($manager) { + $ins_chat_stmt="insert into vicidial_manager_chat_log(manager_chat_id, manager_chat_subid, manager, user, message, message_date, message_posted_by) VALUES('$manager_chat_id', '$manager_chat_subid', '$manager', '$user', '".mysqli_real_escape_string($link, $chat_message)."', now(), '$message_posted_by')"; + $ins_chat_rslt=mysqli_query($link, $ins_chat_stmt); + if (mysqli_insert_id($link)>0) { + $reload_chat_span=1; + } else { + echo "Error sending message."; + } + } else { + echo "Error sending message."; + } +} +###################################### + + +/* JOEJ - removed since this is for customer requests only and is now done on a single page +if ($action=="request_chat" && $user && $chat_member_name) { # For people requesting a chat with an agent; consider using a special user variable name for this + $ip_address=$_SERVER['REMOTE_ADDR']; + + # SEARCH FOR CUSTOMER IN DATABASE - IF NOT FOUND BY PHONE OR IP ADDRESS MAKE A NEW USER + if ($phone_number) { + $stmt="select lead_id from vicidial_list where phone_number='$phone_number' order by entry_date desc limit 1"; + $rslt=mysql_to_mysqli($stmt, $link); + } else { + $stmt="select lead_id from vicidial_list where email like '%".$ip_address."%' order by entry_date desc limit 1"; + $rslt=mysql_to_mysqli($stmt, $link); + } + + if (mysqli_num_rows($rslt)>0) { + $row=mysqli_fetch_row($rslt); + $lead_id=$row[0]; + } else { + # Create lead in vicidial_list table + $ins_stmt="insert into vicidial_list(first_name, last_name, email, list_id, phone_number, security_phrase) VALUES('$first_name', '$last_name', '$ip_address', '$default_list_id', '$phone_number', '$group_id')"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + $lead_id=mysqli_insert_id($link); + } + + if (!$lead_id || $lead_id==0) { + echo "0|Could not find or create dialer entry - $ins_stmt"; + exit; + } + + $ins_stmt="insert into vicidial_live_chats(status, chat_creator, group_id, lead_id, chat_start_time, customer_ping_date) VALUES('WAITING', 'NONE', '$group_id', '$lead_id', now(), now())"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + $chat_id=mysqli_insert_id($link); + + if ($chat_id>0) { + + $ins_stmt="insert into vicidial_chat_participants(chat_id, chat_member, chat_member_name) VALUES('$chat_id', '$user', '$chat_member_name')"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + if (mysqli_affected_rows($link)==0) { + $del_stmt="delete from vicidial_live_chats where chat_id='$chat_id'"; + $del_rslt=mysql_to_mysqli($del_stmt, $link); + echo "0|Chat started, failure to join"; + } else { + echo "1|$chat_id|$lead_id"; + } + } else { + echo "0|Chat not started - $ins_stmt"; + } +} +*/ + +if ($action=="assign_chat" && $chat_id) { # Assign available vicidial_agent to chat +} + +###### CUSTOMER-AGENT CHAT FUNCTIONS ###### +if ($action=="start_chat" && $user && $server_ip) { + if (!$chat_group_id) { + echo "NO_GROUP"; + } else { + $user_stmt="select full_name from vicidial_users where user='$user'"; + $user_rslt=mysql_to_mysqli($user_stmt, $link); + if (mysqli_num_rows($user_rslt)>0) { + $live_agent_stmt="select * from vicidial_live_agents where user='$user' and status='PAUSED'"; + $live_agent_rslt=mysql_to_mysqli($live_agent_stmt, $link); + if (mysqli_num_rows($live_agent_rslt)>0) { + $user_row=mysqli_fetch_row($user_rslt); + $user_name="$user_row[0]"; + + $upd_stmt="UPDATE vicidial_live_agents set status='INCALL',comments='CHAT',last_call_time='$NOW_TIME',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='$NOW_TIME',pause_code='' where user='$user' and server_ip='$server_ip';"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + if (mysqli_affected_rows($link)>0) { + $ins_stmt="insert into vicidial_live_chats(chat_creator, chat_start_time, status, group_id) values('$user', now(), 'WAITING', '$chat_group_id')"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + + $chat_id=mysqli_insert_id($link); + if ($chat_id) { + $ins_stmt2="insert into vicidial_chat_participants(chat_id, chat_member, chat_member_name, vd_agent) values('$chat_id', '$user', '$user_name', 'Y')"; + $ins_rslt2=mysql_to_mysqli($ins_stmt2, $link); + echo $chat_id; + } else { + echo "0"; + } + } else { + echo "FAILED_LIVE_STATUS"; + } + } else { + echo "NOT_PAUSED"; + } + } else { + echo "0"; + } + } +} + +/* Customers have separate function file - customer_chat_functions.php */ +if ($action=="agent_send_message" && $chat_id) { + $live_stmt="select status from vicidial_live_chats where chat_id='$chat_id'"; + $live_rslt=mysql_to_mysqli($live_stmt, $link); + + if ($user && $chat_message && $chat_id && mysqli_num_rows($live_rslt)>0) { + $live_row=mysqli_fetch_row($live_rslt); + $status=$live_row[0]; + if ($status=="WAITING") { + echo "Chat $chat_id is waiting for an agent"; + } else { + if ($status=="LIVE") { + $ins_stmt="insert ignore into vicidial_chat_log(chat_id, message, poster, chat_member_name, chat_level) VALUES('$chat_id', '".mysqli_real_escape_string($link, $chat_message)."', '$user', '".mysqli_real_escape_string($link, $chat_member_name)."', '$chat_level')"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + if (mysqli_affected_rows($link)<1) { + echo "SYSTEM ERROR
\n"; + } + } else { + echo "SYSTEM ERROR
\n"; + } + } + } else if (mysqli_num_rows($rslt)==0) { + echo "Chat $chat_id has been closed"; + } +} + +if ($action=="agent_leave_chat" && $user && $chat_id) { + $del_stmt2="delete from vicidial_chat_participants where chat_id='$chat_id' and chat_member='$user'"; + $del_rslt2=mysql_to_mysqli($del_stmt2, $link); + $deleted_participants=mysqli_affected_rows($link); + if ($deleted_participants>0) { + # ERASE THE CHAT IF THE PERSON NEVER GOT PICKED UP - I DON'T REMEMBER WHY I MOVED customer_leave_chat TO leave_chat + $stmt="select lead_id from vicidial_live_chats where chat_id='$chat_id' and status='WAITING' and chat_creator='NONE'"; + $rslt=mysql_to_mysqli($stmt, $link); + if (mysqli_num_rows($rslt)>0) { + $row=mysqli_fetch_row($rslt); + $lead_id=$row[0]; + # CHECK IF SHOULD USE SPECIAL DROP STATUS 'CDROP' FOR DROPPED CHATS + $upd_stmt="update vicidial_list set status='CDROP' where lead_id='$lead_id'"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + + $ins_stmt="insert ignore into vicidial_chat_archive select * From vicidial_live_chats where chat_id='$chat_id'"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + + $del_stmt="delete from vicidial_live_chats where chat_id='$chat_id' and status='WAITING' and chat_creator='NONE'"; + $del_rslt=mysql_to_mysqli($del_stmt, $link); + } + } +} + +if ($action=="update_agent_chat_window" && $chat_id) { + $status_stmt="select status, chat_creator from vicidial_live_chats where chat_id='$chat_id'"; + $status_rslt=mysql_to_mysqli($status_stmt, $link); + if (mysqli_num_rows($status_rslt)==0) { + echo "Chat $chat_id does not exist or has been closed
\n"; + } else { + $status_row=mysqli_fetch_row($status_rslt); + + ## Modify user's ping date to verify they are still participating + if ($user && $keepalive) { + $upd_stmt="update vicidial_chat_participants set ping_date=now() where chat_member='$user' and chat_id='$chat_id'"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + } + + ## CHECK IF CHAT IS ACTIVE, IF SO GRAB DISTINCT USERS IN ORDER OF POST TO ASSIGN COLORS + if ($status_row[0]=="LIVE") { + $live_stmt="select * from vicidial_live_chats vlc, vicidial_chat_participants vcp where vlc.chat_id='$chat_id' and status='LIVE' and vlc.chat_id=vcp.chat_id and vcp.chat_member='$user'"; + $live_rslt=mysql_to_mysqli($live_stmt, $link); + if (mysqli_num_rows($live_rslt)>0) { + echo "Current chat: $chat_id
\n"; + + # Create color-coding for chat + $stmt="select * from vicidial_chat_log where chat_id='$chat_id' order by message_time asc"; + + $rslt=mysql_to_mysqli($stmt, $link); + $chat_members=array(); + while ($row=mysqli_fetch_row($rslt)) { + if (!in_array("$row[4]", $chat_members)) { + array_push($chat_members, "$row[4]"); + } + } + + ## GRAB CHAT MESSAGES AND DISPLAY THEM + if (!$user_level || $user_level==0) {$user_level_clause=" and chat_level='0' ";} else {$user_level_clause="";} + + $stmt="select * from vicidial_chat_log where chat_id='$chat_id' $user_level_clause order by message_time asc"; + + $rslt=mysql_to_mysqli($stmt, $link); + while ($row=mysqli_fetch_row($rslt)) { + $chat_color_key=array_search("$row[4]", $chat_members); + $row[2]=preg_replace('/\n/', '
', $row[2]); + echo "
  • $row[5] ($row[3]) - $row[2]
  • \n"; + } + + ## PLAY AUDIO FILE IF THERE ARE NEW MESSAGES + $current_messages=mysqli_num_rows($rslt); + echo "\n"; + } else { + echo "Click on a live chat at right to join it.
    \n"; + } + } else { + if ($status_row[1]=="NONE") { + echo "Waiting for next available agent....
    \n"; + # 8/28 - Added in case agent starts chat but hasn't invited someone or they haven't shown up yet + } else if ($status_row[1]==$user || $status_row[0]=="WAITING") { + echo "Please send an invite to the customer to begin...
    \n"; + } else { + echo "SYSTEM ERROR
    \n"; + } + } + } +} + +### CURRENTLY DEFUNCT +/* +if ($action=="customer_leave_chat" && $chat_id) { + $del_stmt2="delete from vicidial_chat_participants where chat_id='$chat_id' and chat_member='$user'"; + $del_rslt2=mysql_to_mysqli($del_stmt2, $link); + $deleted_participants=mysqli_affected_rows($link); + + $archive_stmt="insert ignore into vicidial_chat_archive select chat_id, chat_start_time, 'DROP' as status, chat_creator, group_id, lead_id from vicidial_live_chats where chat_id='$chat_id' and status='WAITING' and chat_creator='NONE'"; + $archive_rslt=mysql_to_mysqli($archive_stmt, $link); + if (mysqli_affected_rows($link)>0) { + $del_stmt="delete from vicidial_live_chats where chat_id='$chat_id' and status='WAITING' and chat_creator='NONE'"; + $del_rslt=mysql_to_mysqli($del_stmt, $link); + } +} +*/ +##################################### + +if ($action=="send_invite" && $chat_id && $email && $chat_group_id) { + $chat_stmt="select chat_url from system_settings"; + $chat_rslt=mysql_to_mysqli($chat_stmt, $link); + $chat_row=mysqli_fetch_row($chat_rslt); + $chat_url=$chat_row[0]; + + ## Check if person being emailed exists as a lead + $email_stmt="select lead_id from vicidial_list where email='$email' order by lead_id desc limit 1"; + $email_rslt=mysql_to_mysqli($email_stmt, $link); + if (mysqli_num_rows($email_rslt)>0) { + $email_row=mysqli_fetch_row($email_rslt); + $lead_id=$email_row[0]; + } else { + $ins_stmt="insert into vicidial_list(status, email, list_id, security_phrase) VALUES('NEW', '$email', '$default_list_id', '$chat_group_id')"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + $lead_id=mysqli_insert_id($link); + } + + if ($lead_id) { + $to = "$email"; + $from = 'vicidial_chat_bot@vicidial.com'; + $subject ="VICIDIAL CHAT INVITE - DO NOT REPLY TO THIS EMAIL"; + + $headers = "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; + $headers .= "To: $email\r\n"; + $headers .= "From: $from\r\n"; + + $unique_userID=time().".".rand(10000, 99999); + + $user_stmt="select full_name from vicidial_users where user='$user'"; + $user_rslt=mysql_to_mysqli($user_stmt, $link); + $user_row=mysqli_fetch_row($user_rslt); + $user_name=$user_row[0]; + + $message = " + + Invitation to ViciDIAL chat + + +

    $user_name has invited you to participate in a Vicidial Chat
    + +

    JOIN CHAT
    + +

    Enter your name, which will allow you to start chatting with the Vicidial agent.
    + + "; + + # + # + # + # + #
    PUT FORM HERE LATER
    + + + $sendmail = @mail($to, $subject, $message, $headers); + } + + if ($sendmail) + { + $upd_stmt="update vicidial_live_chats set lead_id='$lead_id' where chat_id='$chat_id'"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + if (mysqli_affected_rows($link)>0) + { + echo "$lead_id"; + } + else + { + echo "0"; + } + } + else + { + echo "0"; + } +} + +if ($action=="end_chat" && $chat_id && $chat_creator && $user && $server_ip) { + if ($user!=$chat_creator) { + echo "You cannot end this chat unless you are the one who started it."; + exit; + } + + $archive_stmt="insert ignore into vicidial_chat_archive select * from vicidial_live_chats where chat_id='$chat_id'"; + $archive_rslt=mysql_to_mysqli($archive_stmt, $link); + + $archive_log_stmt="insert ignore into vicidial_chat_log_archive select * from vicidial_chat_log where chat_id='$chat_id'"; + $archive_log_rslt=mysql_to_mysqli($archive_log_stmt, $link); + + $del_stmt="delete from vicidial_live_chats where chat_id='$chat_id' and chat_creator='$chat_creator'"; + $del_rslt=mysql_to_mysqli($del_stmt, $link); + if (mysqli_affected_rows($link)==0) { + echo "Warning: chat ID not found. Deleting any remaining participants...

    "; + } else { + echo "Chat ended

    "; + } + $del_log_stmt="delete from vicidial_chat_log where chat_id='$chat_id'"; + $del_log_rslt=mysql_to_mysqli($del_log_stmt, $link); + + $del_stmt2="delete from vicidial_chat_participants where chat_id='$chat_id'"; + $del_rslt2=mysql_to_mysqli($del_stmt2, $link); + $deleted_participants=mysqli_affected_rows($link); + + echo "$deleted_participants removed from chat."; + + # HTML to display after ending chat - will only display again if no lead_id, i.e. no customer involved and no dispositioning needed. + echo "|"; + if (!$lead_id) { + $upd_stmt="UPDATE vicidial_live_agents set status='PAUSED',comments='',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='$NOW_TIME',pause_code='' where user='$user' and server_ip='$server_ip' and status='INCALL' and comments='CHAT'"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + + $vla_stmt="select closer_campaigns from vicidial_live_agents where user='$user'"; + $vla_rslt=mysql_to_mysqli($vla_stmt, $link); + echo "

    "; + echo "

    "; + echo "|TOGGLE_DIAL_CONTROL"; + } +} + +if ($action=="join_chat" && $user && $chat_id && $chat_member_name) { + # REMOVE AGENT FROM OTHER CHATS, JUST IN CASE + $del_stmt="delete from vicidial_chat_participants where chat_member='$user'"; + $del_rslt=mysql_to_mysqli($del_stmt, $link); + + $ins_stmt="insert into vicidial_chat_participants(chat_id, chat_member, chat_member_name, vd_agent) values('$chat_id', '$user', '".mysqli_real_escape_string($link, $chat_member_name)."', 'Y')"; + $ins_rslt=mysql_to_mysqli($ins_stmt, $link); + if (mysqli_affected_rows($link)==0) { + echo "ERROR|Chat was not joined."; + } else { + $creator_stmt="select chat_creator from vicidial_live_chats where chat_id='$chat_id'"; + $creator_rslt=mysql_to_mysqli($creator_stmt, $link); + if (mysqli_num_rows($creator_rslt)>0) { + $crow=mysqli_fetch_row($creator_rslt); + echo "$crow[0]"; + } else { + echo "ERROR|You have joined a non-existent chat. Trippy.\n"; + } + } +} + +if ($action=="show_live_chats" && $user) { + echo "

      \n"; + if ($user && $pass) { + $user_stmt="select full_name from vicidial_users where user='$user' and pass='$pass'"; + $user_rslt=mysql_to_mysqli($user_stmt, $link); + $vicidial_user=mysqli_num_rows($user_rslt); + $vicidial_user_row=mysqli_fetch_row($user_rslt); + $full_name=$vicidial_user_row[0]; + } + + $active_chats=array(); + $agents_in_chat=array(); + $absent_agents=array(); + if ($vicidial_user) { # If you aren't a vicidial_user you aren't going to see the chat window. + $stmt="select vlc.chat_id, vcp.chat_member, vcp.chat_member_name, vlc.chat_creator, vcp.vd_agent from vicidial_live_chats vlc, vicidial_chat_participants vcp where vlc.chat_id=vcp.chat_id order by vlc.chat_id asc, vcp.chat_member_name asc"; + + $rslt=mysql_to_mysqli($stmt, $link); + while($row=mysqli_fetch_row($rslt)) { + $chat_id=$row[0]; + $chat_member=$row[1]; + $chat_member_name=$row[2]; + $chat_creator=$row[3]; + $vd_agent=$row[4]; + $active_chats[$chat_id][]=array("$chat_member", "$chat_member_name", "in chat"); + if ($vd_agent=="Y") { + array_push($agents_in_chat, "$chat_member"); + } + } + + # If an agent is the owner of a live chat but not a participant, they need their name displayed there. + $empty_live_chat_stmt="select chat_id, '$user' as chat_member, '$full_name' as chat_member, chat_creator from vicidial_live_chats where status='LIVE' and chat_creator='$user'"; + $empty_live_chat_rslt=mysql_to_mysqli($empty_live_chat_stmt, $link); + while($row=mysqli_fetch_row($empty_live_chat_rslt)) { + $chat_id=$row[0]; + $chat_member=$row[1]; + $chat_member_name=$row[2]; + if (!$active_chats[$chat_id]) { + $active_chats[$chat_id][]=array("$chat_member", "$chat_member_name", "absent"); + } + } + } + + if ($active_chats) { + echo "Available Chats:

      "; + while (list($key, $val)=each($active_chats)) { + echo "\n"; + } + echo "
    "; + } + + if ($rslt && mysqli_num_rows($rslt)>0) { + echo ""; + } +} + +?> diff --git a/www/agc/conf_exten_check.php b/www/agc/conf_exten_check.php index b4cc546c..59a60e4b 100644 --- a/www/agc/conf_exten_check.php +++ b/www/agc/conf_exten_check.php @@ -68,13 +68,14 @@ # 141216-2111 - Added language settings lookups and user/pass variable standardization # 141228-0053 - Found missing phrase for QXZ # 150723-1708 - Added ajax logging and agent screen click logging +# 150904-2138 - Added SQL features for chats started via agent invite, modified output # -$version = '2.12-43'; -$build = '150723-1708'; +$version = '2.12-44'; +$build = '150904-2138'; $php_script = 'conf_exten_check.php'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=40; +$mysql_log_count=43; $one_mysql_log=0; $DB=0; $SSagent_debug_logging=0; @@ -353,6 +354,75 @@ if ($ACTION == 'refresh') } ##### END check on calls in queue, number of active calls in the campaign + ### see if chats/emails are enabled, and if so how many of each are waiting + # 03041 and 03042 are the error logs for this + + $chat_email_stmt="select allow_chats, allow_emails from system_settings;"; + $chat_email_rslt=mysql_to_mysqli($chat_email_stmt, $link); + $chat_email_row=mysqli_fetch_row($chat_email_rslt); + + # GET closer logs, in case they weren't grabbed above due to campagentstdisp!=YES + if ($chat_email_row[0]!=0 || $chat_email_row[1]!=0) + { + $stmt="SELECT status,campaign_id,closer_campaigns,comments from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03043',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysqli_fetch_row($rslt); + $Alogin=$row[0]; + $Acampaign=$row[1]; + $AccampSQL=$row[2]; + $live_agents_comments=$row[3]; + $AccampSQL = preg_replace('/\s\-/','', $AccampSQL); + $AccampSQL = preg_replace('/\s/',"','", $AccampSQL); + if (preg_match('/AGENTDIRECT/i', $AccampSQL)) + { + $AccampSQL = preg_replace('/AGENTDIRECT/i','', $AccampSQL); + $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )"; + } + } + + if ($chat_email_row[0]==0) + { + $WaitinGChats="N"; + } + else + { + $chat_stmt="select count(*) from vicidial_live_chats where status='WAITING' and (group_id IN('$AccampSQL')) and chat_creator!='$user'"; + $chat_rslt=mysql_to_mysqli($chat_stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$chat_stmt,'03041',$user,$server_ip,$session_name,$one_mysql_log);} + $chat_row=mysqli_fetch_row($chat_rslt); + $WaitinGChats=$chat_row[0]; + # Chat alert priority: waiting chats = blink, then in-chat = on, then = off + if ($WaitinGChats > 0) + { + $WaitinGChats = "Y"; # Make CHAT button blink + } + else if ($Acomments=="CHAT") + { + $WaitinGChats = "C"; # in-chat, so make CHAT button display "ON"; + } + else + { + $WaitinGChats = "N"; # no chats waiting, not in chat, make CHAT display "OFF" + } + } + if ($chat_email_row[1]==0) + { + $WaitinGEmails="N"; + } + else + { + $email_stmt="select count(*) from vicidial_email_list, vicidial_xfer_log where vicidial_email_list.status='QUEUE' and vicidial_email_list.user='$user' and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid and direction='INBOUND' and vicidial_xfer_log.campaign_id in ('$AccampSQL') and closer='EMAIL_XFER'"; + $email_rslt=mysql_to_mysqli($email_stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$email_stmt,'03042',$user,$server_ip,$session_name,$one_mysql_log);} + $email_row=mysqli_fetch_row($email_rslt); + $WaitinGEmails=$email_row[0]; + if ($WaitinGEmails > 0) {$WaitinGEmails = ""._QXZ("Emails in Queue").": $WaitinGEmails";} + else {$WaitinGEmails = ""._QXZ("Emails in Queue").": $WaitinGEmails";} + } + + if ($auto_dial_level > 0) { ### update the vicidial_live_agents every second with a new random number so it is shown to be alive @@ -719,8 +789,8 @@ if ($ACTION == 'refresh') $Alogin='API_LOGOUT'; $external_pause=''; } - - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . '|APIRecording: ' . $external_recording . '|APIPaUseCodE: ' . $external_pause_code . "\n"; + + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . '|APIRecording: ' . $external_recording . '|APIPaUseCodE: ' . $external_pause_code . '|WaitinGChats: ' . $WaitinGChats . '|WaitinGEmails: ' . $WaitinGEmails . '|LivEAgentCommentS: ' . $live_agents_comments . "\n"; if (strlen($timer_action) > 3) { diff --git a/www/agc/css/custom.css b/www/agc/css/custom.css index 8d1c8b69..37798017 100644 --- a/www/agc/css/custom.css +++ b/www/agc/css/custom.css @@ -1 +1,57 @@ - +input.red_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#990000; + border:2px solid; + border-top-color:#FFCCCC; + border-left-color:#FFCCCC; + border-right-color:#330000; + border-bottom-color:#330000; +} +input.green_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#009900; + border:2px solid; + border-top-color:#CCFFCC; + border-left-color:#CCFFCC; + border-right-color:#003300; + border-bottom-color:#003300; +} +input.blue_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#000099; + border:2px solid; + border-top-color:#CCCCFF; + border-left-color:#CCCCFF; + border-right-color:#000033; + border-bottom-color:#000033; +} +input.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +textarea.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +select.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} diff --git a/www/agc/css/simpletree.css b/www/agc/css/simpletree.css new file mode 100644 index 00000000..6f31274b --- /dev/null +++ b/www/agc/css/simpletree.css @@ -0,0 +1,132 @@ +ul.treeview, ul.treeview ul{ /*CSS for Simple Tree Menu*/ +list-style-type: none; +/* background: url(images/vline.png) repeat-y; */ +font-weight: bold; +margin: 0; +padding: 0; +} + +ul.treeview li{ /*Style for LI elements in general (excludes an LI that contains sub lists)*/ +background: white url(../images/messenger-blue-icon.png) no-repeat; +list-style-type: none; +padding-left: 15px; +margin-bottom: 2px; +cursor: hand !important; +} + +.treeview li.submenu{ /* Style for LI that contains sub lists (other ULs). */ +background: white url(../images/messenger-blue-icon.png) no-repeat; +color: #369; +font-weight: bold; +cursor: hand !important; +margin-bottom: 2px; +padding: 0 15px; +line-height: 15px; +} + + +ul.chatview, ul.chatview ul{ /*CSS for Simple Tree Menu*/ +list-style-type: none; +margin: 0; +padding: 0; +} + +.chatview li.viewedchat{ /* Style for LI that contains sub lists (other ULs). */ +background: white url(../images/messenger-blue-icon.png) no-repeat; +color: #369; +cursor: hand !important; +margin-bottom: 2px; +padding: 0 15px; +line-height: 15px; +font-family: Arial, Helvetica, sans-serif; +font-size: 10pt; +} + +.chatview li.unreadchat{ /* Style for LI that contains sub lists (other ULs). */ +background: white url(../images/messenger-blue-icon.png) no-repeat; +background-color: #CCCCFF; +color: #369; +cursor: hand !important; +margin-bottom: 2px; +padding: 0 15px; +line-height: 15px; +font-family: Arial, Helvetica, sans-serif; +font-size: 10pt; +font-weight: bold; +} + +/* .treeview li.submenu ul{ /*Style for ULs that are children of LIs (submenu) */ +/*display: none; /*Hide them by default. Don't delete. */ +/* } */ + +.treeview .submenu ul li{ /*Style for LIs of ULs that are children of LIs (submenu) */ +cursor: hand; +} + +ul.treeview li:last-child { +/* background: #fff url(images/lastnode.png) no-repeat; */ +margin-bottom: 20px; +} + +.chat_title { font-family: Arial, Helvetica, sans-serif; font-size: 11pt} +.chat_message { font-family: Arial, Helvetica, sans-serif; font-size: 10pt} +.chat_timestamp { font-family: Arial, Helvetica, sans-serif; font-size: 8pt} +.vd_agent { color:#009900; } +.absent_agent { color:#FF0000; } +.bold {font-weight: bold;} +.italics {font-style: italic;} +.alert { + font-weight: bold; + color:#FFFFFF; + background-color:#FF0000; +} + +input.red_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#990000; + border:2px solid; + border-top-color:#FFCCCC; + border-left-color:#FFCCCC; + border-right-color:#330000; + border-bottom-color:#330000; +} +input.green_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#009900; + border:2px solid; + border-top-color:#CCFFCC; + border-left-color:#CCFFCC; + border-right-color:#003300; + border-bottom-color:#003300; +} +input.blue_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#000099; + border:2px solid; + border-top-color:#CCCCFF; + border-left-color:#CCCCFF; + border-right-color:#000033; + border-bottom-color:#000033; +} +textarea.chat_window { + font-family: Arial, Sans-Serif; + font-size: 11px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +td.chat_window { + border:2px solid #000000; + padding: 5px; + vertical-align: top; + background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(222,222,222,0) 50%, rgba(222,222,222,0) 50%, rgba(222,222,222,1) 100%); +} diff --git a/www/agc/images/vdc_mgr_chat.jpg b/www/agc/images/vdc_mgr_chat.jpg new file mode 100644 index 0000000000000000000000000000000000000000..45560d54af7268ca01622a56390fc33bf5c060f5 GIT binary patch literal 1898 zcmbW0c~lek7RP_t$ReOYmMRBRSsE61h=Ep(r~$zOg%VVvMHE@27>ObX=$xXag;pub z;!>fqicl2EVl6cV!{$4b2OEb;g8^8q*<4jjNPfDVChZc1D<009BO6#zg1BmxeQFonb1pFsF?H);^PBcNP2fq=(~B@r=P+-dANAks+|E7yCQEDeq%+b3FX z_$ucn#bH}*gH=eU#?k$tFoR07w)tS$a;J}&&MvMVtc`3>uaCFy;QILP^z;8bloz&p z&))DuQHP^rV&je+Kaq4YIptL9*>mSbUw@OCb?I_$UVg!qtJjK4O3TVCZdKmCS0|Q8 zW%qx6(D+Ev)ZEhA_PFaw_t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W-%MhA|~>z1d^ z6pF26WiWnot9{d%BEh*O76RHAS6%z|@lbHBmG_c~r7=6*Sy}cp=D0lmWf50dJLkJY z@iy0uN4G~_N{^RgV-XCL;^hf&b7AE3Sje+UH!#m6Tkz+epk;toFT literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_tab_chat_internal_blink.gif b/www/agc/images/vdc_tab_chat_internal_blink.gif new file mode 100644 index 0000000000000000000000000000000000000000..a4d3398f2be3d8ca775f64e02b7573b6b6dbc67a GIT binary patch literal 4706 zcmeI!X*|?x!w2wd#-C;w%vgu4W5$+|eW$_9Fv=3LH)d=hDNAaZDHh(pafuFrX+U9ldiZBTbMJj{`teN+J!wa5A#8axz+2=^Ox;Q;^F8fFLK& z-FZq$p$q^$dASP!XecQgC@A3Y%6o7shDwSp08UUNSSqVr763Y`YWwhnez40(O=FLi zW*Y*!%P(Z3rcTt>(%ws?YN%2)G%d9DjzbtnO^y2~$ZD@HNk?DbK<^+?%h1?>Y+y7g zB4}r*zly|~nw!v!4ZZaB_L~~L7e-rJS@;?mZlJL9;u0jAeJ)n!L8fLQ<`!#G5)?af zn3dI6DcMNNeZICfM@b|)l@dd;jk6)~Fv zq|_!P_a8rTF)=0m6zfuQ+NskSgVC{#smV{`;Yqkl?E;gp=|%Fj7l#+}b#{iCR$yrS%%nWvZ7nZ4ZNN8FONoSe^j zc@NK(*4EWLE-(A7pkTeQaHQhgMp4nF%XPnVIAc|n6Bnwtx!fz)nkO&TPS@3KpD%B1 zYng3qZ0opj>-Nq0mXy_1I-ur*8efqHV z;REl}=k?9sHh}ZZIKzS2F>H!|m+PMI}{T+bV23tru`_`J?QwVWQKl>9ucPFjk94hT^Tzr^^ z)qQ#;{Yc__~t~!tm_v|DSAZu>KFS1uTUVYj9 zC$Wf>+*=tew+2U_NpY`sv2@i-*lS*Pj6AZ4A^s_Dlx1hZX#b2x7zmx)->m%@gSerM zGmbxepIwj;LQ#Ux;EHiNS5#k>{$tXqf7K8-oxL&%S3%Qsn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g1QR};CKL|ORY6iN=Mo%+bza|R4%N!yuG1#U@YO~d0)5rxI zrsFIHk?`gm4fu6XxqVfgZ^EbIB2PYg5#$o4(U3gq(NFJq?zErSF-d<}{onQO-y!#R U$o(IM+~0%n??L$gXb_tJ8&UDXga7~l literal 0 HcmV?d00001 diff --git a/www/agc/images/vdc_tab_chat_internal_red.gif b/www/agc/images/vdc_tab_chat_internal_red.gif new file mode 100644 index 0000000000000000000000000000000000000000..74aded1a5f3289ae106d83f3f4705ed40cea6c1e GIT binary patch literal 1497 zcmeIx|5MU;0LSq+_|ZO)sbDBha)4jUFX^)KOXn9r)S5*%XPRG8@k`EPOy|z2A?OaX zE?g;EUZ+`BGffOs!Y@FIh~E%R@k^p^_T}8|oVVS%bT;=-?592N@fW=AUg42+KYu0_ zIDoeTAOS$S2Z4|xkrERV2?TYTno7;gr2F=D?t$S>G`iE=yz{_;E(?n;OUrI6t1c|I z%i6jdhwHYnk=feH@OYV>oy^|;#i2uT2M0Nk_<}@|lgV-?C%Ln;+{LA5kE?5syL+#P zN1vx>ua{Tf(W8C7zJ14!_n$b?fAVC1K!74JP0aR)&VEC=?Z)J`fc( zaQ5ur`SXJpE~sN;)p2p^gambB;!skOIyqUBk}||(YEn}*>FF94Yd9lgI5Sh5ojshB zqrH52G(Uf&pkS=1Xsoz+w4`M0>eaE*(s3SdoX;OGE1M7qbd{C5>(_NRZs>%<$y>Md z)zx~DNMBp4udCDFxij6^INj9r>fytgmX_Jp)|s}p+4lBXv3Rzl!|?pMK_W49bTOUb?*kF(-Jo4%K2=V>FO1zH+Ir<$V zlxlVC8X=P7M53BlmU|3$up%iA7#t_^xr>^DywG9($H2={Z03%ekmSRME50Sb5o8U8 z`{-P_#L20>xe7SeLSnWnKv!6KM?A%bD9u6>e=@+_rfasMFB7#SBI4Y@@xmS+&i?nX zasom}`wH7|daT=14C#ETZY~L!j(R(8(-|&_zyDJ@Z7LEt-Dsq&xjO?=PIj;C%{>y%qTc)Geaih6wjnSF!MsV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JX011{)QQPmpG(o{b+BY^aiG-EpgIqt3)(E zIlb?D7-`}kv$)*jsBG0_pEpgn3y+9a{XTGR@7-Suco?Mq`D|Ha-g9(m^%uVg+L#)Z?l#0}dVWO8i+85jiK zEng@vz~FGO;_2M&H(iQqHcV$YH*w+h$j`22ha#km(i}v*N)}ufR1nfga&3(`crY$t zMq*6M|I`8o2JRX~!P*_N)0`Wa+A(w8 zLadA28}56B7^4SQxAUE)FP1 delta 651 zcmV;60(AYI3z!8`M@dFFIbm7=9sqJ0ULiT00000 zS^ypZ00sUaC5~iio@lDBY%4;}W6gAJ-*~R?JTE;CNGa0j8IQTs%r=- z4ytxLb%a|Cm;j@lU;&wFWd?ffr1kPe|a+kgMv1SjfFRJ zHUR?_l@$XFHv$Njl>m=30G)rG0Dd&0G!vti3XiL!hc=Nk0hJ1O2bGyL3AqCc0SlA| zprUuj3kH|P6{!^l0MXHv2cgor(9))|6gdL}+ZF^B)u$B*paQuF=9;+#?K7$YHU*UM zHS;~Q76laxH*!5<@C?+91eG44x-pJjsAlpi(35nIk;Hx7Zs@Z?pwxd11r_kwP;kK1 zLW=Df0Z^)f?l5*Nn6h#Yh1N(=tAb6K7mY~Dah*odant}P`zJgXIr)_wPH*YfdUh|-|Jf!QSCzD;$s~1I lA9dbC%o*21dovW3&jh;FLtz|YNQmKv+TF(CheU+{06QA5AH@Iw diff --git a/www/agc/vdc_chat_display.php b/www/agc/vdc_chat_display.php new file mode 100644 index 00000000..bad2d528 --- /dev/null +++ b/www/agc/vdc_chat_display.php @@ -0,0 +1,719 @@ + LICENSE: AGPLv2 +# +# This is the interface for agents to chat with customers and each other. It's separate from the manager-to-agent +# chat interface out of necessity and calls the chat_db_query.php page to send information and display it. It will +# display any open chat the agent has, and of those open chats the full conversation of the current active chat +# will be displayed. It will also show when an agent has a new unread message in any of his conversations and +# allow the agent to toggle between them. They can also initiate chats with any agent currently logged into a +# campaign through the agent interface. +# +# Builds: +# 150903-2349 - First build +# 151213-1107 - Added variable filtering +# + +require("dbconnect_mysqli.php"); +require("functions.php"); + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,enable_languages,language_method FROM system_settings;"; +$rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysqli_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $non_latin = $row[0]; + $SSenable_languages = $row[1]; + $SSlanguage_method = $row[2]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["email_invite_lead_id"])) {$email_invite_lead_id=$_GET["email_invite_lead_id"];} + elseif (isset($_POST["email_invite_lead_id"])) {$email_invite_lead_id=$_POST["email_invite_lead_id"];} +if (isset($_GET["chat_id"])) {$chat_id=$_GET["chat_id"];} + elseif (isset($_POST["chat_id"])) {$chat_id=$_POST["chat_id"];} +if (isset($_GET["chat_group_id"])) {$chat_group_id=$_GET["chat_group_id"];} + elseif (isset($_POST["chat_group_id"])) {$chat_group_id=$_POST["chat_group_id"];} +if (isset($_GET["chat_group_ids"])) {$chat_group_ids=$_GET["chat_group_ids"];} + elseif (isset($_POST["chat_group_ids"])) {$chat_group_ids=$_POST["chat_group_ids"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} + elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["child_window"])) {$child_window=$_GET["child_window"];} + elseif (isset($_POST["child_window"])) {$child_window=$_POST["child_window"];} +if (isset($_GET["outside_user_name"])) {$outside_user_name=$_GET["outside_user_name"];} + elseif (isset($_POST["outside_user_name"])) {$outside_user_name=$_POST["outside_user_name"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["clickmute"])) {$clickmute=$_GET["clickmute"];} + elseif (isset($_POST["clickmute"])) {$clickmute=$_POST["clickmute"];} + +if ($clickmute!="1") {$clickmute="0";} // Prevents annoying quirk of playing the audio cue every time you click the tab to view this + +$lead_id = preg_replace("/[^0-9]/","",$lead_id); +$chat_id = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_id); +$chat_group_id = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$chat_group_id); +$server_ip = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$server_ip); +$email = preg_replace("/\'|\"|\\\\|;/","",$email); +$chat_group_ids = preg_replace("/\\\\|;/","",$chat_group_ids); +$campaign = preg_replace('/[^-\_0-9a-zA-Z]/','',$campaign); +$dial_method = preg_replace('/[^-\_0-9a-zA-Z]/','',$dial_method); +$clickmute = preg_replace("/\'|\"|\\\\|;/","",$clickmute); + +if ($non_latin < 1) + { + $user = preg_replace('/[^-\_0-9a-zA-Z]/','',$user); + $pass = preg_replace('/[^-\_0-9a-zA-Z]/','',$pass); + $outside_user_name = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$user); + $chat_creator = preg_replace('/[^- \_0-9a-zA-Z]/','',$chat_creator); + $phone_number = preg_replace("/[^0-9]/","",$phone_number); + $first_name = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$first_name); + $last_name = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$last_name); + } +else + { + $user = preg_replace("/\'|\"|\\\\|;/","",$user); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); + $outside_user_name = preg_replace("/\'|\"|\\\\|;/","",$user); + } + +$user_stmt="select full_name, user_level from vicidial_users where user='$user'"; +echo "\n"; +$user_level=0; +$user_rslt=mysql_to_mysqli($user_stmt, $link); +if (mysqli_num_rows($user_rslt)>0) { + $user_row=mysqli_fetch_row($user_rslt); + $full_name=$user_row[0]; + $user_level=$user_row[1]; + + if ($chat_id) { + $chat_stmt="select * from vicidial_live_chats where chat_creator='$user' and chat_id='$chat_id'"; + echo "\n"; + } else { + # echo "Waiting for chat request..."; exit; + } +} else { + unset($pass); + + ## Since user is not a vicidial user, check to see if they belong to another chat and use that as the default chat variable. + $chat_stmt="select chat_id from vicidial_chat_participants where chat_member='$user'"; + $chat_rslt=mysql_to_mysqli($chat_stmt, $link); + if (mysqli_num_rows($chat_rslt)>0) { + $chat_row=mysqli_fetch_row($chat_rslt); + $chat_id=$chat_row[0]; + } +} +$stmt="select * from vicidial_list where lead_id='$lead_id'"; +$rslt=mysql_to_mysqli($stmt, $link); +if (mysqli_num_rows($rslt)>0) { + $row=mysqli_fetch_array($rslt); + $first_name=$row["first_name"]; + $last_name=$row["last_name"]; + if (!$full_name) {$full_name=trim("$first_name $last_name");} + if (!$email) {$email=$row["email"];} +} +?> + + +Vicidial Chat Interface + + + + + + + +No user ID - no chat access. Sorry "; + exit; +} + +$user_stmt="select full_name from vicidial_users where user='$user' limit 1"; +$user_rslt=mysql_to_mysqli($user_stmt, $link); +$inchat_html=""; $nochat_html=""; +$autojoin_js_fx="StartRefresh();"; + +if (mysqli_num_rows($user_rslt)==0) { + if($outside_user_name && $chat_id) { + $inchat_html.=""; + $autojoin_js_fx.="JoinChat('$chat_id');"; + } else { + $chat_stmt="select chat_member_name from vicidial_chat_log where poster='$user' order by message_time desc limit 1"; + $chat_rslt=mysql_to_mysqli($chat_stmt, $link); + if (mysqli_num_rows($chat_rslt)==0) { + $nochat_html.="Please enter your name below before joining a chat:
    "; + $nochat_html.=""; + } else { + $chat_row=mysqli_fetch_row($chat_rslt); + $outside_user_name=$chat_row[0]; + $inchat_html.=""; + $autojoin_js_fx.="JoinChat('$chat_id');"; + } + } +} else { + $user_row=mysqli_fetch_row($user_rslt); + $inchat_html.=""; + $autojoin_js_fx.="JoinChat('$chat_id');"; +} + +if($child_window) { + $inchat_html.="

    "; +} +?> + +\n"; ?> +

    + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + + + + + +
    + +


    Mute alert sound +


    + Privacy ON"; + } + ?> +
    + +
    +
    + "; + if (!$chat_id) { + echo "

    "; + + echo "

    \n"; + } + if ($chat_creator && $chat_creator==$user) { + if (!$email_invite_lead_id) { # Flag from sending an invite - this page reloads as a result and this below INVITE button must be prevented from being loaded + echo "

    "; + } + echo "

    "; + } + echo ""; + } + + ?> +
      + +
    + + + + + + + + +
    + + diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 8d5312e0..0106ae58 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -394,13 +394,14 @@ # 151026-1710 - Added function for Status Groups lookups and delivery to agent screen # 151119-1931 - Fixed issue with outbound CID in some cases during dial-only function # 151209-1615 - Fixed issue with possible data loss using callback or dispo comments +# 151212-0916 - Added chat-related functions for the agent interface # -$version = '2.12-289'; -$build = '151209-1615'; +$version = '2.12-290'; +$build = '151212-0916'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=635; +$mysql_log_count=649; $one_mysql_log=0; $DB=0; $SSagent_debug_logging=0; @@ -630,6 +631,8 @@ if (isset($_GET["email_row_id"])) {$email_row_id=$_GET["email_row_id"];} elseif (isset($_POST["email_row_id"])) {$email_row_id=$_POST["email_row_id"];} if (isset($_GET["inbound_email_groups"])) {$inbound_email_groups=$_GET["inbound_email_groups"];} elseif (isset($_POST["inbound_email_groups"])) {$inbound_email_groups=$_POST["inbound_email_groups"];} +if (isset($_GET["inbound_chat_groups"])) {$inbound_chat_groups=$_GET["inbound_chat_groups"];} + elseif (isset($_POST["inbound_chat_groups"])) {$inbound_chat_groups=$_POST["inbound_chat_groups"];} if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];} @@ -830,7 +833,7 @@ $sip_hangup_cause_dictionary = array( ############################################# ##### 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,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats FROM system_settings;"; $rslt=mysql_to_mysqli($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";} @@ -854,6 +857,7 @@ if ($qm_conf_ct > 0) $SSagent_debug_logging = $row[13]; $SSdefault_language = $row[14]; $active_modules = $row[15]; + $allow_chats = $row[16]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -7855,12 +7859,41 @@ if ($ACTION == 'XFERemail') } ####################################################################################### -### VDADcheckINCOMINGemail - for auto-dial VICIDiaL dialing this will check for emails +### ManagerChatsCheck - for campaigns/systems where chatting is enabled, this will +### look in the vicidial_manager_chats table for any active chats +### involving the agent ID being passed and will return any current +### chats involving the agent, and will blink for unread messages, +### including chats where the agent is the manager/originator +####################################################################################### +if ($ACTION == 'ManagerChatsCheck') + { + // Get a count on how many chats the agent is involved in, and also any chats where there are unread messages BY THE USER to determine if the user gets a blinking light. + $chat_stmt="select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is null and user='$user', 1, 0)) from vicidial_manager_chat_log where (user='$user' or manager='$user') group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid"; + $chat_rslt=mysql_to_mysqli($chat_stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$chat_stmt,'00636',$user,$server_ip,$session_name,$one_mysql_log);} + $active_chats=mysqli_num_rows($chat_rslt); + while ($chat_row=mysqli_fetch_row($chat_rslt)) + { + $unread_messages+=$chat_row[2]; + } + #$upd_stmt="update vicidial_manager_chat_log set audio_alerted='Y' where (user='$user' or manager='$user') and audio_alerted='N' and message_posted_by!='$user'"; + $upd_stmt="select count(*) From vicidial_manager_chat_log where (user='$user' or manager='$user')"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + #$message_alert=mysqli_affected_rows($link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$upd_stmt,'00637',$user,$server_ip,$session_name,$one_mysql_log);} + + $upd_row=mysqli_fetch_row($upd_rslt); + $message_alert=$upd_row[0]; + echo "$active_chats|$unread_messages|$message_alert"; + } + +####################################################################################### +### VDADcheckINCOMINGother - for auto-dial VICIDiaL dialing this will check for emails ### in the vicidial_email_list table in NEW status, then ### lookup the lead info and pass it back to vicidial.php ### Also looks up transferred emails in vicidial_xfer_log -###################################################################################### -if ($ACTION == 'VDADcheckINCOMINGemail') +####################################################################################### +if ($ACTION == 'VDADcheckINCOMINGother') { $VDCL_ingroup_recording_override = ''; $VDCL_ingroup_rec_filename = ''; @@ -7876,6 +7909,7 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $INclosecallid=''; $INxfercallid=''; $email_group_str=''; + $chat_group_str=''; $email_group_ct=count($inbound_email_groups); # This should always be greater than zero for the script to reach this point, but just in case... for ($i=0; $i<$email_group_ct; $i++) @@ -7883,6 +7917,13 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $email_group_str.="'$inbound_email_groups[$i]',"; } $email_group_str=substr($email_group_str, 0, -1); + + $chat_group_ct=count($inbound_chat_groups); # This should always be greater than zero for the script to reach this point, but just in case... + for ($i=0; $i<$chat_group_ct; $i++) { + $chat_group_str.="'$inbound_chat_groups[$i]',"; + } + $chat_group_str=substr($chat_group_str, 0, -1); + # $DB=1; if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) @@ -7895,8 +7936,11 @@ if ($ACTION == 'VDADcheckINCOMINGemail') } else { + + ### CHECK FOR EMAILS ### + #if ($email_group_ct>0) { + ### Check for transfers - #$upd_stmt="update vicidial_email_list inner join(select email_row_id from vicidial_email_list inner join vicidial_inbound_groups on vicidial_inbound_groups.group_id=vicidial_email_list.group_id order by queue_priority desc, email_date asc limit 1) as selected_row on selected_row.email_row_id=vicidial_email_list.email_row_id set status='QUEUE', user='$user'"; $stmt="SELECT vicidial_email_list.lead_id, vicidial_email_list.email_date, vicidial_email_list.email_to, vicidial_email_list.email_from, vicidial_email_list.subject, vicidial_xfer_log.campaign_id, vicidial_email_list.email_row_id, vicidial_xfer_log.xfercallid from vicidial_email_list, vicidial_xfer_log where vicidial_email_list.status='QUEUE' and vicidial_email_list.user='$user' and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid and direction='INBOUND' and vicidial_xfer_log.campaign_id in ($email_group_str) and closer='EMAIL_XFER' order by vicidial_xfer_log.call_date asc limit 1"; if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);} if ($DB) {echo "$stmt\n";} @@ -7905,6 +7949,7 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $email_ct = mysqli_num_rows($rslt); $xferred_email=$email_ct; + # Check if there are any QUEUE emails if ($email_ct==0) { # Check if there are any QUEUE emails @@ -7913,23 +7958,29 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00488',$user,$server_ip,$session_name,$one_mysql_log);} $email_ct = mysqli_num_rows($rslt); - -# if ($email_ct==0) -# { -# $upd_stmt="update vicidial_email_list inner join(select email_row_id from vicidial_email_list inner join vicidial_inbound_groups on vicidial_inbound_groups.group_id=vicidial_email_list.group_id order by queue_priority desc, email_date asc limit 1) as selected_row on selected_row.email_row_id=vicidial_email_list.email_row_id set status='QUEUE', user='$user'"; -# if ($DB) {echo "$upd_stmt\n";} -# $rslt=mysql_to_mysqli($stmt, $link); -# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00104',$user,$server_ip,$session_name,$one_mysql_log);} + } -# if (mysqli_affected_rows($link)>0) -# { -# $stmt = "select lead_id, email_date, email_to, email_from, subject, group_id, email_row_id from vicidial_email_list where status='QUEUE' and direction='INBOUND' and user='$user' and group_id in ($email_group_str) order by email_date asc limit 1"; -# if ($DB) {echo "$stmt\n";} -# $rslt=mysql_to_mysqli($stmt, $link); -# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00104',$user,$server_ip,$session_name,$one_mysql_log);} -# $email_ct = mysqli_num_rows($rslt); -# } -# } + ### Check for chats + if ($email_ct==0) + { + $stmt="select * from vicidial_live_chats where status='WAITING' and group_id in ($chat_group_str) order by chat_id asc limit 1"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00638',$user,$server_ip,$session_name,$one_mysql_log);} + if (mysqli_num_rows($rslt)>0) + { + $chat_row=mysqli_fetch_row($rslt); + $chat_id=$chat_row[0]; + $status =$chat_row[2]; + $chat_creator=$chat_row[3]; + $group_id=$chat_row[4]; + $VDADchannel_group=$chat_row[4]; + $lead_id=$chat_row[5]; + $uniqueid=date("U").".".rand(1, 9999); + $upd_stmt="update vicidial_live_chats set status='LIVE', chat_creator='$user' where chat_id='$chat_id'"; + $upd_rslt=mysql_to_mysqli($upd_stmt, $link); + $chat_ct=mysqli_affected_rows($link); + } } if ($email_ct > 0) @@ -7946,9 +7997,9 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $uniqueid=date("U").".".rand(1, 9999); if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} - # echo "1\n" . $lead_id . '|'.$uniqueid.'|' . $email_date . '|' . $email_from . '|' . $subject . '|' . $email_row_id . "|\n"; # VDIC_data_VDAC + # Change to better suit the output processed by the agent interface - echo "1\n" . $lead_id . '|'.$uniqueid.'|' . $email_from . '|EMAIL|' . $email_row_id . '|' . $email_row_id . "|\n"; # VDIC_data_VDAC + echo "1\n" . $lead_id . '|'.$uniqueid.'|' . $email_from . '|EMAIL|' . $email_row_id . '|' . $email_row_id . "|EMAIL\n"; # VDIC_data_VDAC ##### 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';"; @@ -8042,13 +8093,18 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00493',$user,$server_ip,$session_name,$one_mysql_log);} + + ### IF incoming result => answer email, not chat... + ### update the email lead status to INCALL - # I moved user='$user' clause here because it is now getting added to the lead when the status becomes QUEUE + # user='$user' clause moved here because it is now getting added to the lead when the status becomes QUEUE $stmt = "UPDATE vicidial_email_list set status='INCALL', uniqueid='$uniqueid' where lead_id='$lead_id' and email_row_id='$email_row_id' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00494',$user,$server_ip,$session_name,$one_mysql_log);} + ### END IF + ### if a transfer, update the transfer record with the user if ($xferred_email==1) { @@ -8058,6 +8114,112 @@ if ($ACTION == 'VDADcheckINCOMINGemail') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00495',$user,$server_ip,$session_name,$one_mysql_log);} } + } + else if ($chat_ct>0) + { + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + # Change to better suit the output processed by the agent interface + echo "1\n" . $lead_id . '|'.$uniqueid.'|' . $email_from . '|CHAT|' . $chat_id . '|' . $chat_id . "|CHAT\n"; # VDIC_data_VDAC + + + ##### 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_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00639',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vla_cc_ct = mysqli_num_rows($rslt); + if ($vla_cc_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $calls_today =$row[0]; + } + else + {$calls_today ='0';} + $calls_today++; + + ### update the agent status to INCALL in vicidial_live_agents while handling email + $stmt = "UPDATE vicidial_live_agents set status='INCALL',comments='CHAT',last_call_time='$NOW_TIME',lead_id='$lead_id',calls_today='$calls_today',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='$NOW_TIME',pause_code='' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00640',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_to_mysqli($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_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00641',$user,$server_ip,$session_name,$one_mysql_log);} + + $stmtA = "UPDATE vicidial_live_inbound_agents set calls_today='$calls_today',last_call_time=NOW() WHERE user='$user' and group_id='$VDADchannel_group';"; + $rsltA=mysql_to_mysqli($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00642',$user,$server_ip,$session_name,$one_mysql_log);} + $stmtA = "UPDATE vicidial_inbound_group_agents set calls_today='$calls_today',group_type='C' WHERE user='$user' and group_id='$VDADchannel_group';"; + $rsltA=mysql_to_mysqli($stmtA, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00643',$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_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00644',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysqli_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysqli_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_phrase = 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;} + } + + ### 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_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00645',$user,$server_ip,$session_name,$one_mysql_log);} + + } + + if ($email_ct>0 || $chat_ct>0) { + ### ANYTHING AFTER THIS POINT - DOES NOT MATTER WHETHER AN EMAIL OR CHAT IS BEING FIELDED + + ### gather custom_call_id from vicidial_log_extended table $custom_call_id=''; /* Can't use this - $unique_id is gotten from querying the vicidial_live_agents from an inbound call. These are not calls. @@ -8072,6 +8234,7 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $custom_call_id = $row[0]; } */ + $custom_call_id=''; ### gather user_group and full_name of agent $user_group=''; @@ -11879,6 +12042,35 @@ if ($ACTION == 'userLOGout') sleep(1); + ##### End any still-active chats initiated by the agent + if ($allow_chats==1) { + $stmt="select manager_chat_id from vicidial_manager_chats where manager='$user'"; + $rslt=mysqli_query($link, $stmt); + + while ($row=mysqli_fetch_row($rslt)) { + $manager_chat_id=$row[0]; + + $archive_stmt="insert ignore into vicidial_manager_chat_log_archive select * from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id'"; + $archive_rslt=mysqli_query($link, $archive_stmt); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$archive_stmt,'00646',$user,$server_ip,$session_name,$one_mysql_log);} + + $archive_stmt="insert ignore into vicidial_manager_chats_archive select * from vicidial_manager_chats where manager_chat_id='$manager_chat_id'"; + $archive_rslt=mysqli_query($link, $archive_stmt); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$archive_stmt,'00647',$user,$server_ip,$session_name,$one_mysql_log);} + + $delete_stmt="delete from vicidial_manager_chat_log where manager_chat_id='$manager_chat_id'"; + $delete_rslt=mysqli_query($link, $delete_stmt); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$delete_stmt,'00648',$user,$server_ip,$session_name,$one_mysql_log);} + + if (mysqli_affected_rows($link)>0) { + $archive_stmt="delete from vicidial_manager_chats where manager_chat_id='$manager_chat_id'"; + $archive_rslt=mysqli_query($link, $archive_stmt); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$archive_stmt,'00649',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + } + ###### + ##### 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";} diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 97887e84..c8e4a2f5 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -9,6 +9,9 @@ # - 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 +# - vdc_email_display.php: display email interface +# - vdc_chat_display.php: display chat interface +# - agc_agent_manager_chat_interface.php: display internal chats # # CHANGELOG # 50607-1426 - First Build of VICIDIAL web client basic login process finished @@ -505,10 +508,11 @@ # 151028-1458 - Added status groups statuses feature with min/max seconds qualifiers for statuses # 151119-1925 - Fixed issue with scheduled callbacks and status groups # 151125-0942 - Fixed manual call only logging bug +# 151212-0922 - Added all chat functionality # -$version = '2.12-477c'; -$build = '151125-0942'; +$version = '2.12-478c'; +$build = '151212-0922'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=85; $one_mysql_log=0; @@ -605,7 +609,7 @@ if ($sl_ct > 0) ############################################# ##### 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,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules,allow_chats,chat_url FROM system_settings;"; $rslt=mysql_to_mysqli($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";} @@ -637,6 +641,8 @@ if ($qm_conf_ct > 0) $enable_third_webform = $row[21]; $default_language = $row[22]; $active_modules = $row[23]; + $chat_enabled = $row[24]; + $chat_URL = $row[25]; } else { @@ -2066,6 +2072,7 @@ else $VARingroup_handlers="''"; $VARphonegroups="''"; $VARemailgroups="''"; + $VARchatgroups="''"; if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') ) { ### validate that the agent has not exceeded their max inbound calls for today @@ -2094,6 +2101,7 @@ else $VARingroup_handlers=''; $VARphonegroups=''; $VARemailgroups=''; + $VARchatgroups=''; $stmt="SELECT group_id,group_handling from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 800;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01015',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2101,22 +2109,31 @@ else $closer_ct = mysqli_num_rows($rslt); $INgrpCT=0; $EMAILgrpCT=0; + $CHATgrpCT=0; $PHONEgrpCT=0; while ($INgrpCT < $closer_ct) { $row=mysqli_fetch_row($rslt); $closer_groups[$INgrpCT] =$row[0]; - $closer_group_handling[$INgrpCT] =$row[1]; // PHONE OR EMAIL - this is important + $closer_group_handling[$INgrpCT] =$row[1]; // PHONE OR EMAIL OR CHAT - this is important $VARingroups = "$VARingroups'$closer_groups[$INgrpCT]',"; $VARingroup_handlers = "$VARingroup_handlers'$closer_group_handling[$INgrpCT]',"; - if ($row[1]=="EMAIL") // Make a list of ingroups for email handling groups and one for phones, so there is no overlap + if ($row[1]=="EMAIL") // Make a list of ingroups for email handling groups, chat handling groups and one for phones, so there is no overlap { $VARemailgroups = "$VARemailgroups'$closer_groups[$INgrpCT]',"; + $VARemailgroupsURL = $VARemailgroupsURL."&email_group_ids[]=$closer_groups[$INgrpCT]"; $EMAILgrpCT++; } + else if ($row[1]=="CHAT") + { + $VARchatgroups = "$VARchatgroups'$closer_groups[$INgrpCT]',"; + $VARchatgroupsURL = $VARchatgroupsURL."&chat_group_ids[]=$closer_groups[$INgrpCT]"; + $CHATgrpCT++; + } else { $VARphonegroups = "$VARphonegroups'$closer_groups[$INgrpCT]',"; + $VARphonegroupsURL = $VARphonegroupsURL."&phone_group_ids[]=$closer_groups[$INgrpCT]"; $PHONEgrpCT++; } $INgrpCT++; @@ -2125,6 +2142,7 @@ else $VARingroup_handlers = substr("$VARingroup_handlers", 0, -1); $VARphonegroups = substr("$VARphonegroups", 0, -1); $VARemailgroups = substr("$VARemailgroups", 0, -1); + $VARchatgroups = substr("$VARchatgroups", 0, -1); } else {$closer_campaigns = "''";} @@ -3774,6 +3792,10 @@ $CCAL_OUT .= ""; var EMAILgroupCOUNT = 0; var incomingEMAILgroups= new Array(); + VARchatgroups = new Array(); + var CHATgroupCOUNT = 0; + var incomingCHATgroups= new Array(); + VARphonegroups = new Array(); // var PHONEgroupCOUNT = ''; var PHONEgroupCOUNT = 0; @@ -4082,7 +4104,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var CheckDEADcall = 0; var CheckDEADcallON = 0; var CheckDEADcallCOUNT = 0; - var currently_in_email = 0; + var currently_in_email_or_chat = 0; var VtigeRLogiNScripT = ''; var VtigeRurl = ''; var VtigeREnableD = ''; @@ -4186,6 +4208,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var custom_fields_enabled=''; var form_contents_loaded=0; var email_enabled=''; + var chat_enabled=''; + var chat_URL=''; var enable_xfer_presets=''; var hide_xfer_number_to_dial=''; var Presets_HTML=''; @@ -4366,6 +4390,23 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} image_LB_ivrgrabparkedcall.src="./images/"; var image_LB_ivrparkcall = new Image(); image_LB_ivrparkcall.src="./images/"; + var image_internal_chat_OFF = new Image(); + image_internal_chat_OFF.src="./images/"; + var image_internal_chat_ON = new Image(); + image_internal_chat_ON.src="./images/"; + var image_internal_chat_ALERT = new Image(); + image_internal_chat_ALERT.src="./images/"; + var image_customer_chat_OFF = new Image(); + image_customer_chat_OFF.src="./images/"; + var image_customer_chat_ON = new Image(); + image_customer_chat_ON.src="./images/"; + var image_customer_chat_ALERT = new Image(); + image_customer_chat_ALERT.src="./images/"; + var image_chat_alert_UNMUTE = new Image(); + image_chat_alert_UNMUTE.src="./images/"; + var image_chat_alert_MUTE = new Image(); + image_chat_alert_MUTE.src="./images/"; + 0) { @@ -5125,6 +5166,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var CamPCalLs = CamPCalLs_array[1]; var DiaLCalLs_array = check_time_array[5].split("DiaLCalls: "); var DiaLCalLs = DiaLCalLs_array[1]; + var WaitinGChats_array = check_time_array[27].split("WaitinGChats: "); + var WaitinGChats = WaitinGChats_array[1]; + var WaitinGEmails_array = check_time_array[28].split("WaitinGEmails: "); + var WaitinGEmails = WaitinGEmails_array[1]; if (AGLogiN != 'N') { document.getElementById("AgentStatusStatus").innerHTML = AGLogiN; @@ -5137,6 +5182,27 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { document.getElementById("AgentStatusDiaLs").innerHTML = DiaLCalLs; } + // Chat alert + if (chat_enabled > 0) + { + if (WaitinGChats == 'Y') + { + document.images['CustomerChatImg'].src=image_customer_chat_ALERT.src; + } + else if (WaitinGChats == 'C') + { + document.images['CustomerChatImg'].src=image_customer_chat_ON.src; + } + else + { + document.images['CustomerChatImg'].src=image_customer_chat_OFF.src; + } + } + // Email alert + if (WaitinGEmails != 'N') + { + document.getElementById("AgentStatusEmails").innerHTML = WaitinGEmails; + } if ( (AGLogiN == 'DEAD_VLA') && ( (vicidial_agent_disable == 'LIVE_AGENT') || (vicidial_agent_disable == 'ALL') ) ) { showDiv('AgenTDisablEBoX'); @@ -6738,6 +6804,82 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } } +// ################################################################################ +// Request list of active manager chats for this agent + function InternalChatsCheck(line_code) + { + var xmlhttp=false; + // var MGR_chat_print=0; + var MGRpre=''; + var MGRpost=''; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + var InternalChat_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=ManagerChatsCheck"; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(InternalChat_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var active_InternalChat_info = null; + active_InternalChat_info = xmlhttp.responseText; + var Internal_chat_array=active_InternalChat_info.split("|"); + var Internal_chat_print=Internal_chat_array[0]; + var Internal_chat_unread_msg=Internal_chat_array[1]; + var Internal_chat_alert_sounds=Internal_chat_array[2]; + + if (Internal_chat_print>0) + { + if (Internal_chat_unread_msg>0) + { + document.images['InternalChatImg'].src=image_internal_chat_ALERT.src; + } + else + { + document.images['InternalChatImg'].src=image_internal_chat_ON.src; + } + } + else + { + Internal_chat_print="NO"; + document.images['InternalChatImg'].src=image_internal_chat_OFF.src; + } + + var ChatIFrame = document.getElementById('InternalChatIFrame'); + var innerChatDoc = (ChatIFrame.contentDocument) ? ChatIFrame.contentDocument : ChatIFrame.contentWindow.document; + + if (innerChatDoc.getElementById("InternalMessageCount")) // Prevents javascript error when page loads + { + if (Internal_chat_alert_sounds>innerChatDoc.getElementById("InternalMessageCount").value && innerChatDoc.getElementById("InternalMessageCount").value>0 && !innerChatDoc.getElementById("MuteChatAlert").checked) + { + document.getElementById("ChatAudioAlertFile").play(); + } + innerChatDoc.getElementById("InternalMessageCount").value=Internal_chat_alert_sounds; + } + } + // alert(line_code+ " -- " + MGR_chat_print + " -- " +MGR_chat_unread_msg); + } + } + } // ################################################################################ // closes callback list screen @@ -6838,6 +6980,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) auto_dial_level=starting_dial_level; MainPanelToFront(); CalLBacKsCounTCheck(); + InternalChatsCheck(); manual_dial_in_progress=0; } @@ -8079,6 +8222,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (fields_list.match(regUDemailreload)) {EmailContentsLoad();} + // JOEJ 060514 - new for chat feature + var regUDchatreload = new RegExp("chatreload,","ig"); + if (fields_list.match(regUDchatreload)) + {CustomerChatContentsLoad();} + var regWFAcustom = new RegExp("^VAR","ig"); if (VDIC_web_form_address.match(regWFAcustom)) { @@ -8311,6 +8459,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) auto_dial_level=starting_dial_level; MainPanelToFront(); CalLBacKsCounTCheck(); + InternalChatsCheck(); if (MDnextCID.match(regMNCvar)) {alert_box("\n" + campaign); alert_displayed=1;} @@ -8696,6 +8845,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { EmailContentsLoad(); } + // JOEJ 060514 - new for chat feature + // Will populate chat tab in case this is a customer awaiting a chat AND the agent selected a campaign that allows chats + if (chat_enabled > 0 && CHATgroupCOUNT > 0) + { + CustomerChatContentsLoad(); + } if (get_call_launch == 'SCRIPT') { if (delayed_script_load == 'YES') @@ -8715,6 +8870,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) EmailPanelToFront(); } + if (get_call_launch == 'CHAT') + { + CustomerChatPanelToFront(); + } + if (get_call_launch == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); @@ -9115,6 +9275,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { EmailContentsLoad(); } + // JOEJ 060514 - new for email feature + // Will populate chat tab in case this is a customer awaiting a chat with an agent + if (chat_enabled > 0) + { + CustomerChatContentsLoad(); + } if (get_call_launch == 'SCRIPT') { if (delayed_script_load == 'YES') @@ -9131,6 +9297,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { EmailPanelToFront(); } + if (get_call_launch == 'CHAT') + { + CustomerChatPanelToFront(); + } if (get_call_launch == 'WEBFORM') { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); @@ -10074,6 +10244,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { EmailContentsLoad(); } + // JOEJ 060514 - new for chat feature + if (chat_enabled > 0) + { + CustomerChatContentsLoad(); + } if (CalL_AutO_LauncH == 'SCRIPT') { if (delayed_script_load == 'YES') @@ -10125,15 +10300,15 @@ function set_length(SLnumber,SLlength_goal,SLdirection) alert(" " + dial_display_number + "\n - " + VDIC_data_VDIG[1] + "   " + VDIC_fronter); } } - else if (email_enabled>0 && EMAILgroupCOUNT>0 && AutoDialWaiting==1) + else if ( ((email_enabled>0 && EMAILgroupCOUNT>0) || (chat_enabled>0 && CHATgroupCOUNT>0)) && AutoDialWaiting==1) { - // JOEJ check for EMAIL + // JOEJ check for EMAIL/CHAT // QUEUEpadding is needed to allow inbound calls to get through QUEUE status QUEUEpadding++; if (QUEUEpadding==5) { QUEUEpadding=0; - check_for_incoming_email(); + check_for_incoming_other(); } } xmlhttprequestcheckauto = undefined; @@ -10146,45 +10321,53 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // ################################################################################ -// Check to see if there is an email unanswered in queue +// Check to see if there is an email or chat unanswered in queue // This should not happen if the agent is INCALL - function check_for_incoming_email() +// Pass the manual_chat_override when the agent starts a chat themselves, +// so the dialer will skip checking for emails + function check_for_incoming_other(manual_chat_override) { - if (typeof(xmlhttprequestcheckemail) == "undefined") + if (typeof(xmlhttprequestcheckother) == "undefined") { all_record = 'NO'; all_record_count=0; - var xmlhttprequestcheckemail=false; - if (!xmlhttprequestcheckemail && typeof XMLHttpRequest!='undefined') + var xmlhttprequestcheckother=false; + if (!xmlhttprequestcheckother && typeof XMLHttpRequest!='undefined') { - xmlhttprequestcheckemail = new XMLHttpRequest(); + xmlhttprequestcheckother = new XMLHttpRequest(); } - if (xmlhttprequestcheckemail) + if (xmlhttprequestcheckother) { - checkVDAI_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&orig_pass=" + orig_pass + "&campaign=" + campaign + "&ACTION=VDADcheckINCOMINGemail" + "&agent_log_id=" + agent_log_id; + checkVDAI_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&orig_pass=" + orig_pass + "&campaign=" + campaign + "&ACTION=VDADcheckINCOMINGother" + "&agent_log_id=" + agent_log_id; - // Add on all the email groups the user selected in order to pass them to the vdc_db_query script - for (var i = 0; i < incomingEMAILgroups.length; i++) { - checkVDAI_query+="&inbound_email_groups[]="+incomingEMAILgroups[i]; - } + if (!manual_chat_override) + { + // Add on all the email groups the user selected in order to pass them to the vdc_db_query script + for (var i = 0; i < incomingEMAILgroups.length; i++) + { + checkVDAI_query+="&inbound_email_groups[]="+incomingEMAILgroups[i]; + } + } + // Add on all the chat groups the user selected in order to pass them to the vdc_db_query script + for (var i = 0; i < incomingCHATgroups.length; i++) + { + checkVDAI_query+="&inbound_chat_groups[]="+incomingCHATgroups[i]; + } - xmlhttprequestcheckemail.open('POST', 'vdc_db_query.php'); - xmlhttprequestcheckemail.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); - xmlhttprequestcheckemail.send(checkVDAI_query); + xmlhttprequestcheckother.open('POST', 'vdc_db_query.php'); + xmlhttprequestcheckother.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttprequestcheckother.send(checkVDAI_query); - xmlhttprequestcheckemail.onreadystatechange = function() + xmlhttprequestcheckother.onreadystatechange = function() { - if (xmlhttprequestcheckemail.readyState == 4 && xmlhttprequestcheckemail.status == 200) + if (xmlhttprequestcheckother.readyState == 4 && xmlhttprequestcheckother.status == 200) { var check_incoming = null; - check_incoming = xmlhttprequestcheckemail.responseText; - // alert(checkVDAI_query); - //alert(xmlhttprequestcheckemail.responseText); + check_incoming = xmlhttprequestcheckother.responseText; var check_VDIC_array=check_incoming.split("\n"); if (check_VDIC_array[0] == '1') { - // alert(xmlhttprequestcheckemail.responseText); AutoDialWaiting = 0; UpdatESettingSChecK = 1; @@ -10192,7 +10375,21 @@ function set_length(SLnumber,SLlength_goal,SLdirection) VDIC_web_form_address = VICIDiaL_web_form_address; VDIC_web_form_address_two = VICIDiaL_web_form_address_two; VDIC_web_form_address_three = VICIDiaL_web_form_address_three; - document.getElementById("EmailAudioAlertFile").play(); + CalL_AutO_LauncH = VDIC_data_VDAC[3]; + if (CalL_AutO_LauncH=='EMAIL') + { + document.vicidial_form.email_row_id.value= VDIC_data_VDAC[4]; + document.getElementById("EmailAudioAlertFile").play(); + } + else if (CalL_AutO_LauncH=='CHAT') + { + if (chat_enabled > 0) + { + document.images['CustomerChatImg'].src=image_customer_chat_ON.src; + document.getElementById("ChatAudioAlertFile").play(); + document.vicidial_form.chat_id.value= VDIC_data_VDAC[4]; + } + } var VDIC_fronter=''; var VDIC_data_VDIG=check_VDIC_array[2].split("|"); @@ -10203,7 +10400,6 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var VDCL_fronter_display = VDIC_data_VDIG[3]; VDCL_group_id = VDIC_data_VDIG[4]; CalL_ScripT_id = VDIC_data_VDIG[5]; - CalL_AutO_LauncH = 'EMAIL'; // FORCE EMAIL tab CalL_XC_a_Dtmf = VDIC_data_VDIG[7]; CalL_XC_a_NuMber = VDIC_data_VDIG[8]; CalL_XC_b_Dtmf = VDIC_data_VDIG[9]; @@ -10305,8 +10501,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) VD_live_customer_call = 1; VD_live_call_secondS = 0; customer_sec = 0; - CheckDEADcallON = 1; // Do this to keep the interface from instantly reading an email as a hangup - currently_in_email = 1; // Do this to block channel checks (or anything else) that would indicate a completed call + currently_in_email_or_chat = 1; // Do this to block channel checks (or anything else) that would indicate a completed call // INSERT VICIDIAL_LOG ENTRY FOR THIS CALL PROCESS // DialLog("start"); @@ -10774,6 +10969,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { EmailContentsLoad(); } + // JOEJ 060514 - new for chat feature + if (chat_enabled > 0) + { + CustomerChatContentsLoad('', '', manual_chat_override); + } if (CalL_AutO_LauncH == 'SCRIPT') { if (delayed_script_load == 'YES') @@ -10790,6 +10990,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { EmailPanelToFront(); } + if (CalL_AutO_LauncH == 'CHAT') + { + CustomerChatPanelToFront(); + } if (CalL_AutO_LauncH == 'WEBFORM') { @@ -10825,8 +11029,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) alert(" " + dial_display_number + "\n - " + VDIC_data_VDIG[1] + "   " + VDIC_fronter); } } - xmlhttprequestcheckemail = undefined; - delete xmlhttprequestcheckemail; + xmlhttprequestcheckother = undefined; + delete xmlhttprequestcheckother; } } } @@ -11068,6 +11272,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (customer_sec < 1) {customer_sec = VD_live_call_secondS;} var process_post_hangup=0; + + // Force chat to end, if exists. Uses hangup_override value in EndChat function to end if chat does not exist. + if (document.getElementById('CustomerChatIFrame') && typeof document.getElementById('CustomerChatIFrame').contentWindow.EndChat=='function') + { + document.getElementById('CustomerChatIFrame').contentWindow.EndChat('Hangup'); + } + if ( (RedirecTxFEr < 1) && ( (MD_channel_look==1) || (auto_dial_level == 0) ) ) { MD_channel_look=0; @@ -11739,7 +11950,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) else { move_on=0; - alert_box(""); + alert_box(": " + inOUT + "|" + agent_lead_search); } } } @@ -11990,7 +12201,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) CheckDEADcallON=0; CheckDEADcallCOUNT=0; customer_sec=0; - currently_in_email=0; + currently_in_email_or_chat=0; customer_3way_hangup_counter=0; customer_3way_hangup_counter_trigger=0; waiting_on_dispo=1; @@ -12159,6 +12370,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.called_count.value =''; document.vicidial_form.call_notes.value =''; document.vicidial_form.call_notes_dispo.value =''; + document.vicidial_form.email_row_id.value =''; + document.vicidial_form.chat_id.value =''; document.vicidial_form.dispo_comments.value =''; document.vicidial_form.cbcomment_comments.value =''; VDCL_group_id = ''; @@ -12307,6 +12520,14 @@ function set_length(SLnumber,SLlength_goal,SLdirection) {document.getElementById("ScriptContents").innerHTML = '';} parked_hangup='0'; + // Set customer chat tab to OFF, just to be sure + if (chat_enabled > 0) + { + document.images['CustomerChatImg'].src=image_customer_chat_OFF.src; + } + CustomerChatContentsLoad(); + EmailContentsLoad(); + AgentDispoing = 0; if ( (alt_number_dialing == 'SELECTED') || (alt_number_dialing == 'SELECTED_TIMER_ALT') || (alt_number_dialing == 'SELECTED_TIMER_ADDR3') ) @@ -12854,8 +13075,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // Added to get email counts so inbound emails will come in - this is normally done in CloserSelectContent_select, which is bypassed if agents aren't allowed to select ingroups var loop_ct = 0; EMAILgroupCOUNT = 0; + CHATgroupCOUNT = 0; PHONEgroupCOUNT = 0; incomingEMAILS = 0; + incomingCHATS = 0; while (loop_ct < INgroupCOUNT) { if (VARingroup_handlers[loop_ct]=="EMAIL") @@ -12864,6 +13087,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) EMAILgroupCOUNT++; incomingEMAILS++; } + else if (VARingroup_handlers[loop_ct]=="CHAT") + { + incomingCHATgroups[incomingCHATS]=VARingroups[loop_ct]; + CHATgroupCOUNT++; + incomingCHATS++; + } else { PHONEgroupCOUNT++; @@ -12911,12 +13140,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { var loop_ct = 0; EMAILgroupCOUNT = 0; + CHATgroupCOUNT = 0; PHONEgroupCOUNT = 0; var CSCcolumn = ''; var live_CSC_HTML_ADD = ''; var live_CSC_HTML_DELETE = ''; var live_CSC_LIST_value = " "; incomingEMAILS = 0; + incomingCHATS = 0; + incomingEMAILgroups = new Array(); + incomingCHATgroups = new Array(); while (loop_ct < INgroupCOUNT) { var regCSL = new RegExp(" " + VARingroups[loop_ct] + " ","ig"); @@ -12936,6 +13169,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection) EMAILgroupCOUNT++; incomingEMAILS++; } + else if (VARingroup_handlers[loop_ct]=="CHAT") + { + incomingCHATgroups[incomingCHATS]=VARingroups[loop_ct]; + CHATgroupCOUNT++; + incomingCHATS++; + } else { PHONEgroupCOUNT++; @@ -15059,6 +15298,7 @@ function phone_number_format(formatphone) { { if (EMLrefresh=='YES') {button_click_log = button_click_log + "" + SQLdate + "-----EmailContentsLoad---|";} + var email_row_id = document.vicidial_form.email_row_id.value; var form_list_id = document.vicidial_form.list_id.value; var form_entry_list_id = document.vicidial_form.entry_list_id.value; if (form_entry_list_id.length > 2) @@ -15068,6 +15308,41 @@ function phone_number_format(formatphone) { form_entry_list_id = ''; } +// ################################################################################ +// Refresh the agent/customer CHAT content + function CustomerChatContentsLoad(clickMute, CHTrefresh, email_invite_lead_id) + { + if (CHTrefresh=='YES') + {button_click_log = button_click_log + "" + SQLdate + "-----CustomerChatContentsLoad---|";} var form_list_id = document.vicidial_form.list_id.value; + var form_entry_list_id = document.vicidial_form.entry_list_id.value; + var form_chat_id = document.vicidial_form.chat_id.value; + if (form_entry_list_id.length > 2) + {form_list_id = form_entry_list_id} + document.getElementById('CustomerChatIFrame').src='./vdc_chat_display.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user + '&pass=' + orig_pass + '&campaign=' + campaign + '&chat_id=' + form_chat_id + '&dial_method=' + dial_method + '&clickmute=' + clickMute + '&email_invite_lead_id=' + email_invite_lead_id + '&server_ip=' + server_ip + '&session_id=' + '&uniqueid=' + document.vicidial_form.uniqueid.value + '&stage=DISPLAY' + "&campaign=" + campaign + "&phone_login=" + phone_login + "&original_phone_login=" + original_phone_login +"&phone_pass=" + phone_pass + "&fronter=" + fronter + "&closer=" + user + "&group=" + group + "&channel_group=" + group + "&SQLdate=" + SQLdate + "&epoch=" + UnixTime + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&customer_zap_channel=" + lastcustchannel + "&customer_server_ip=" + lastcustserverip +"&server_ip=" + server_ip + "&SIPexten=" + extension + "&session_id=" + session_id + "&phone=" + document.vicidial_form.phone_number.value + "&parked_by=" + document.vicidial_form.lead_id.value +"&dispo=" + LeaDDispO + '' +"&dialed_number=" + dialed_number + '' +"&dialed_label=" + dialed_label + '' +"&camp_script=" + campaign_script + '' +"&in_script=" + CalL_ScripT_id + '' +"&script_width=" + script_width + '' +"&script_height=" + script_height + '' +"&fullname=" + LOGfullname + '' +"&recording_filename=" + recording_filename + '' +"&recording_id=" + recording_id + '' +"&user_custom_one=" + VU_custom_one + '' +"&user_custom_two=" + VU_custom_two + '' +"&user_custom_three=" + VU_custom_three + '' +"&user_custom_four=" + VU_custom_four + '' +"&user_custom_five=" + VU_custom_five + '' +"&preset_number_a=" + CalL_XC_a_NuMber + '' +"&preset_number_b=" + CalL_XC_b_NuMber + '' +"&preset_number_c=" + CalL_XC_c_NuMber + '' +"&preset_number_d=" + CalL_XC_d_NuMber + '' +"&preset_number_e=" + CalL_XC_e_NuMber + '' +"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +"&did_id=" + did_id + '' +"&did_extension=" + did_extension + '' +"&did_pattern=" + did_pattern + '' +"&did_description=" + did_description + '' +"&closecallid=" + closecallid + '' + "&xfercallid=" + xfercallid + '' + "&chat_group_id=" + VDCL_group_id + '' + "&agent_log_id=" + agent_log_id + "&call_id=" + LasTCID + "&user_group=" + VU_user_group + '' +"&web_vars=" + LIVE_web_vars + ''; + form_list_id = ''; + form_chat_id = ''; + form_entry_list_id = ''; + // CustomerChatPanelToFront(); + } + +// ################################################################################ +// Refresh the agent/manager CHAT content + function InternalChatContentsLoad(ICHrefresh) + { + if (ICHrefresh=='YES') + {button_click_log = button_click_log + "" + SQLdate + "-----InternalChatContentsLoad---|";} var form_list_id = document.vicidial_form.list_id.value; + var form_list_id = document.vicidial_form.list_id.value; + var form_entry_list_id = document.vicidial_form.entry_list_id.value; + var form_chat_id = document.vicidial_form.chat_id.value; + if (form_entry_list_id.length > 2) + {form_list_id = form_entry_list_id} + document.getElementById('InternalChatIFrame').src='./agc_agent_manager_chat_interface.php?lead_id=' + document.vicidial_form.lead_id.value + '&list_id=' + form_list_id + '&user=' + user ; + form_list_id = ''; + form_chat_id = ''; + form_entry_list_id = ''; + InternalChatPanelToFront(); + } + // ################################################################################ // Move the Dispo frame out of the way and change the link to maximize @@ -15501,6 +15776,9 @@ function phone_number_format(formatphone) { hideDiv('ScriptRefresH'); hideDiv('EmailPanel'); hideDiv('EmailRefresH'); + hideDiv('CustomerChatPanel'); + hideDiv('CustomerChatRefresH'); + hideDiv('InternalChatPanel'); hideDiv('FormPanel'); hideDiv('FormRefresH'); hideDiv('DispoSelectBox'); @@ -15547,6 +15825,10 @@ function phone_number_format(formatphone) { {hideDiv('callsinqueuedisplay');} if (agentonly_callbacks != '1') {hideDiv('CallbacksButtons');} + if (email_enabled < 1) + {hideDiv('AgentStatusEmails');} + if (allow_alerts < 1) + {hideDiv('AgentAlertSpan');} if (allow_alerts < 1) {hideDiv('AgentAlertSpan');} // if ( (agentcall_manual != '1') && (starting_dial_level > 0) ) @@ -15784,7 +16066,7 @@ function phone_number_format(formatphone) { {TerritorySelect_submit();} } if (logout_stop_timeouts==1) {WaitingForNextStep=1;} - if ( (custchannellive < customer_gone_seconds) && (lastcustchannel.length > 3) && (no_empty_session_warnings < 1) && (document.vicidial_form.lead_id.value != '') && (currently_in_email==0) ) + if ( (custchannellive < customer_gone_seconds) && (lastcustchannel.length > 3) && (no_empty_session_warnings < 1) && (document.vicidial_form.lead_id.value != '') && (currently_in_email_or_chat==0) ) {CustomerChanneLGone();} // document.getElementById("debugbottomspan").innerHTML = "custchannellive: " + custchannellive + " lastcustchannel.length: " + lastcustchannel.length + " no_empty_session_warnings: " + no_empty_session_warnings + " lead_id: |" + document.vicidial_form.lead_id.value + "|"; if ( (custchannellive < -10) && (lastcustchannel.length > 3) ) {ReChecKCustoMerChaN();} @@ -15831,6 +16113,10 @@ function phone_number_format(formatphone) { CalLBacKsCounTCheck(); CB_count_check=0; } + if (chat_enabled=='1') // JOEJ - if chat is enabled, check if manager has sent message. + { + InternalChatsCheck(); + } if ( (even > 0) && (agent_display_dialable_leads > 0) ) { DiaLableLeaDsCounT(); @@ -15858,7 +16144,7 @@ function phone_number_format(formatphone) { VD_live_call_secondS++; document.vicidial_form.SecondS.value = VD_live_call_secondS; document.getElementById("SecondSDISP").innerHTML = VD_live_call_secondS; - if (CheckDEADcallON > 0) + if (CheckDEADcallON > 0 && currently_in_email_or_chat < 1) { CheckDEADcallCOUNT++; // document.getElementById("debugbottomspan").innerHTML = "DEAD CALL SECONDS " + CheckDEADcallCOUNT; @@ -16301,6 +16587,10 @@ function phone_number_format(formatphone) { { divref = document.getElementById(divvar).style; divref.visibility = 'hidden'; + if (divvar == 'InternalChatPanel') // Clear the manager chat panel to prevent incoming messages from immediately being marked as read + { + document.getElementById('InternalChatIFrame').src='./agc_agent_manager_chat_interface.php?user='+user; + } } } function clearDiv(divvar) @@ -16526,6 +16816,9 @@ function phone_number_format(formatphone) { hideDiv('FormRefresH'); hideDiv('EmailPanel'); hideDiv('EmailRefresH'); + hideDiv('CustomerChatPanel'); + hideDiv('CustomerChatRefresH'); + hideDiv('InternalChatPanel'); showDiv('MainPanel'); ShoWGenDerPulldown(); @@ -16598,6 +16891,9 @@ function phone_number_format(formatphone) { hideDiv('FormRefresH'); hideDiv('EmailPanel'); hideDiv('EmailRefresH'); + hideDiv('CustomerChatPanel'); + hideDiv('CustomerChatRefresH'); + hideDiv('InternalChatPanel'); document.getElementById("MainTable").style.backgroundColor=""; document.getElementById("MaiNfooter").style.backgroundColor=""; panel_bgcolor=''; @@ -16625,6 +16921,9 @@ function phone_number_format(formatphone) { } hideDiv('EmailPanel'); hideDiv('EmailRefresH'); + hideDiv('CustomerChatPanel'); + hideDiv('CustomerChatRefresH'); + hideDiv('InternalChatPanel'); document.getElementById("MainTable").style.backgroundColor=""; document.getElementById("MaiNfooter").style.backgroundColor=""; panel_bgcolor=''; @@ -16639,8 +16938,13 @@ function phone_number_format(formatphone) { var CBFPheight = 'px'; document.getElementById("CallbacksButtons").style.top = CBFPheight; document.getElementById("CallbacksButtons").style.left = '340px'; + hideDiv('FormPanel'); + hideDiv('FormRefresH'); showDiv('EmailPanel'); showDiv('EmailRefresH'); + hideDiv('CustomerChatPanel'); + hideDiv('CustomerChatRefresH'); + hideDiv('InternalChatPanel'); if ( (OtherTab == '0') && (comments_all_tabs == 'ENABLED') ) { OtherTab='1'; @@ -16656,6 +16960,49 @@ function phone_number_format(formatphone) { HidEGenDerPulldown(); } + function CustomerChatPanelToFront(CPFclick) + { + if (CPFclick=='YES') + {button_click_log = button_click_log + "" + SQLdate + "-----CustomerChatPanelToFront---|";} + var CBFPheight = 'px'; + document.getElementById("CallbacksButtons").style.top = CBFPheight; + document.getElementById("CallbacksButtons").style.left = '360px'; + hideDiv('FormPanel'); + hideDiv('FormRefresH'); + hideDiv('EmailPanel'); + hideDiv('EmailRefresH'); + showDiv('CustomerChatPanel'); + showDiv('CustomerChatRefresH'); + hideDiv('InternalChatPanel'); + document.getElementById("MainTable").style.backgroundColor=""; + document.getElementById("MaiNfooter").style.backgroundColor=""; + panel_bgcolor=''; + // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + + HidEGenDerPulldown(); + } + + function InternalChatPanelToFront(IPFclick) + { + if (IPFclick=='YES') + {button_click_log = button_click_log + "" + SQLdate + "-----InternalChatPanelToFront---|";} + var CBFPheight = 'px'; + document.getElementById("CallbacksButtons").style.top = CBFPheight; + document.getElementById("CallbacksButtons").style.left = '360px'; + hideDiv('FormPanel'); + hideDiv('FormRefresH'); + hideDiv('EmailPanel'); + hideDiv('EmailRefresH'); + hideDiv('CustomerChatPanel'); + hideDiv('CustomerChatRefresH'); + showDiv('InternalChatPanel'); + document.getElementById("MainTable").style.backgroundColor=""; + document.getElementById("MaiNfooter").style.backgroundColor=""; + panel_bgcolor=''; + // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor; + + HidEGenDerPulldown(); + } function HidEGenDerPulldown() { @@ -16749,14 +17096,23 @@ $zi=2; - + 0) {echo "\n";} ?> 0) {echo "\n";} ?> - + 0) + { + # INTERNAL CHAT + echo "\n"; + + # CUSTOMER CHAT + echo "\n"; + } + ?> +
    " alt="MAIN" width="115px" height="30px" border="0" />" alt="SCRIPT" width="90px" height="30px" border="0" />" alt="SCRIPT" width="67px" height="30px" border="0" /> \"FORM\"\"EMAIL\"         \"CHAT\"\"CHAT\"     
          
    " name="livecall" alt="Live Call" width="109px" height="30px" border="0" />
    @@ -16861,6 +17217,8 @@ $zi=2; + + @@ -17267,6 +17625,23 @@ if ($agent_display_dialable_leads > 0)
    + +
    \n";} + ?> +
    +
    + + +
    \n";} + ?> +
    +
    + + diff --git a/www/agc/vicidial_chat_agent.js b/www/agc/vicidial_chat_agent.js new file mode 100644 index 00000000..65dfc7dc --- /dev/null +++ b/www/agc/vicidial_chat_agent.js @@ -0,0 +1,396 @@ +// vicidial_chat_agent.js +// +// Copyright (C) 2014 Joe Johnson, Matt Florell LICENSE: AGPLv2 +// +// Used by agc_agent_manager_chat_interface.php - this contains all the Javascript functions that +// execute the various actions that run in chat_db_query.php, such as creating chats, displaying +// chats, ending chats, and sending messages. +// +// Builds: +// 150121-2229 - First build +// + +// ################################################################################ +// Show parent alert + function chat_alert_box(temp_message) + { + window.parent.document.getElementById("AlertBoxContent").innerHTML = temp_message; + + parent.showDiv('AlertBox'); + + window.parent.document.alert_form.alert_button.focus(); + } + +/// Functions for agent/manager chatting +function CreateAgentToAgentChat() { + var agent_message=encodeURIComponent(document.getElementById("agent_message").value); + var user=document.getElementById("user").value; + var agent=document.getElementById("agent").value; + + if (!agent_message || agent_message=="") + { + chat_alert_box("Please enter a chat message"); + return false; + } + if (!agent || agent=="") + { + chat_alert_box("Please select an agent to chat with"); + return false; + } + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + var chat_SQL_query = "action=CreateAgentToAgentChat&agent_manager="+user+"&agent_user="+agent+"&manager_message="+agent_message+"&user="+user; + xmlhttp.open('POST', 'chat_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(chat_SQL_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var ChatText = null; + ChatText = xmlhttp.responseText; + var ChatText_array=ChatText.split("|"); + + if (ChatText.match(/^Error/)) + { + chat_alert_box(ChatText); + } + else + { + document.getElementById("agent_message").value=""; + document.getElementById("AgentNewChatSpan").style.display='none'; + document.getElementById("AgentChatSpan").style.display='block'; + document.getElementById("AgentEndChatSpan").style.display = 'block'; + document.getElementById("AgentManagerOverride").value=agent; + document.getElementById("CurrentActiveChat").value=ChatText_array[0]; + document.getElementById("CurrentActiveChatSubID").value=ChatText_array[1]; + } + } + } + delete xmlhttp; + } +} + +// Displays selected chat, also marks any message on it as read. +function DisplayMgrAgentChat(manager_chat_id, manager_chat_subid) { + if (manager_chat_id) + { + document.getElementById("CurrentActiveChat").value=manager_chat_id; + document.getElementById("CurrentActiveChatSubID").value=manager_chat_subid; + } + else + { + var manager_chat_id=document.getElementById("CurrentActiveChat").value; + var manager_chat_subid=document.getElementById("CurrentActiveChatSubID").value; + } + + if (!manager_chat_id || !manager_chat_subid) + { + document.getElementById("AllowAgentReplies").style.display = 'none'; + // document.getElementById("ActiveManagerChatTranscript").innerHTML=ChatText_array[1]; + // document.getElementById("ActiveChatStartDate").innerHTML=ChatText_array[2]; + // document.getElementById("ActiveChatManager").innerHTML=ChatText_array[3]; + return false; + } + var user=document.getElementById("user").value; + var agent_override=document.getElementById("AgentManagerOverride").value; + + // JCJ - commented out 10/19 so any agent in a-2-a chat can end it. + // if (agent_override && agent_override!="0" && agent_override!="") + // { + document.getElementById("AgentEndChatSpan").style.display = 'block'; + // } + // else + // { + // document.getElementById("AgentEndChatSpan").style.display = 'none'; + // } + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + var chat_SQL_query = "action=DisplayMgrAgentChat&user="+user+"&manager_chat_id="+manager_chat_id+"&manager_chat_subid="+manager_chat_subid; + xmlhttp.open('POST', 'chat_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(chat_SQL_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var ChatText = null; + ChatText = xmlhttp.responseText; + var ChatText_array=ChatText.split("\n"); + + var allow_agent_replies=ChatText_array[0]; + var new_messages=ChatText_array[4]; + + if (allow_agent_replies=="Y") + { + document.getElementById("AllowAgentReplies").style.display = 'block'; + } + else + { + document.getElementById("AllowAgentReplies").style.display = 'none'; + } + + document.getElementById("ActiveManagerChatTranscript").innerHTML=ChatText_array[1]; + document.getElementById("ActiveChatStartDate").innerHTML=ChatText_array[2]; + document.getElementById("ActiveChatManager").innerHTML=ChatText_array[3]; + document.getElementById("ActiveManagerChatTranscript").scrollTop = document.getElementById("ActiveManagerChatTranscript").scrollHeight; + RefreshActiveChatView(); + } + } + delete xmlhttp; + } +} + +// Ends selected displayed chat +function EndAgentToAgentChat() { + var manager_chat_id=document.getElementById("CurrentActiveChat").value; + var manager_chat_subid=document.getElementById("CurrentActiveChatSubID").value; + var user=document.getElementById("user").value; + + if (!manager_chat_id || !manager_chat_subid) + { + document.getElementById("AllowAgentReplies").style.display = 'none'; + return false; + } + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + var chat_SQL_query = "action=EndAgentToAgentChat&user="+user+"&manager_chat_id="+manager_chat_id+"&manager_chat_subid="+manager_chat_subid; + xmlhttp.open('POST', 'chat_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(chat_SQL_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var ChatText = null; + ChatText = xmlhttp.responseText; // echoes number of lines affected - should be greater than zero. + + if (ChatText>0) + { + document.getElementById("AllowAgentReplies").style.display = 'none'; + document.getElementById("AgentEndChatSpan").style.display = 'none'; + document.getElementById("ActiveManagerChatTranscript").innerHTML=''; + document.getElementById("AgentManagerOverride").value=''; + document.getElementById("ActiveChatStartDate").innerHTML=''; + document.getElementById("ActiveChatManager").innerHTML=''; + } + + RefreshActiveChatView(); + } + } + delete xmlhttp; + } +} + +function RefreshActiveChatView() { + var user=document.getElementById("user").value; + var ChatReloadIDNumber=document.getElementById("ChatReloadIDNumber").value; + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + var chat_SQL_query = "action=RefreshActiveChatView&user="+user+"&ChatReloadIDNumber="+ChatReloadIDNumber; + xmlhttp.open('POST', 'chat_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(chat_SQL_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var ActiveChatText = null; + ActiveChatText = xmlhttp.responseText; + if(ActiveChatText!="") + { + var ActiveChatText_array=ActiveChatText.split("|"); + document.getElementById("ChatReloadIDNumber").value=ActiveChatText_array[0]; + document.getElementById("AllActiveChats").innerHTML=ActiveChatText_array[1]; + } + } + } + delete xmlhttp; + } +} + +function ReloadAgentNewChatSpan(user) { + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + var chat_SQL_query = "action=ReloadAgentNewChatSpan&user="+user; + xmlhttp.open('POST', 'chat_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(chat_SQL_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var Agent2AgentText = xmlhttp.responseText; + document.getElementById("AgentNewChatSpan").innerHTML=Agent2AgentText; + } + } + delete xmlhttp; + } +} + +function SendMgrChatMessage(manager_chat_id, manager_chat_subid) { + // if (!manager_chat_id) {return false;} + if (manager_chat_id) + { + document.getElementById("CurrentActiveChat").value=manager_chat_id; + document.getElementById("CurrentActiveChatSubID").value=manager_chat_subid; + } + else + { + var manager_chat_id=document.getElementById("CurrentActiveChat").value; + var manager_chat_subid=document.getElementById("CurrentActiveChatSubID").value; + } + + var user=document.getElementById("user").value; + var agent_override=document.getElementById("AgentManagerOverride").value; + var chat_message=encodeURIComponent(document.getElementById("manager_message").value); + + if (!chat_message || chat_message=="") {return false;} + + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + var chat_SQL_query = "action=SendMgrChatMessage&user="+user+"&manager_chat_id="+manager_chat_id+"&manager_chat_subid="+manager_chat_subid+"&chat_message="+chat_message+"&agent_override="+agent_override; + xmlhttp.open('POST', 'chat_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(chat_SQL_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + var ChatText = null; + ChatText = xmlhttp.responseText; + + if (ChatText.length>0 && ChatText.match(/^Error/)) + { + chat_alert_box(ChatText); + } + else + { + document.getElementById("manager_message").value=""; + } + } + } + delete xmlhttp; + } +} + +function MgrAgentAutoRefresh() { + rInt=window.setInterval(function() {DisplayMgrAgentChat()}, 1000); +} diff --git a/www/chat_customer/css/custom.css b/www/chat_customer/css/custom.css new file mode 100644 index 00000000..37798017 --- /dev/null +++ b/www/chat_customer/css/custom.css @@ -0,0 +1,57 @@ +input.red_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#990000; + border:2px solid; + border-top-color:#FFCCCC; + border-left-color:#FFCCCC; + border-right-color:#330000; + border-bottom-color:#330000; +} +input.green_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#009900; + border:2px solid; + border-top-color:#CCFFCC; + border-left-color:#CCFFCC; + border-right-color:#003300; + border-bottom-color:#003300; +} +input.blue_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#000099; + border:2px solid; + border-top-color:#CCCCFF; + border-left-color:#CCCCFF; + border-right-color:#000033; + border-bottom-color:#000033; +} +input.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +textarea.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +select.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} diff --git a/www/chat_customer/css/simpletree.css b/www/chat_customer/css/simpletree.css new file mode 100644 index 00000000..910309c5 --- /dev/null +++ b/www/chat_customer/css/simpletree.css @@ -0,0 +1,121 @@ +ul.treeview, ul.treeview ul{ /*CSS for Simple Tree Menu*/ +list-style-type: none; +/* background: url(images/vline.png) repeat-y; */ +font-weight: bold; +margin: 0; +padding: 0; +} + +ul.treeview li{ /*Style for LI elements in general (excludes an LI that contains sub lists)*/ +background: white url(../images/messenger-blue-icon.png) no-repeat; +list-style-type: none; +padding-left: 15px; +margin-bottom: 2px; +cursor: hand !important; +} + +.treeview li.submenu{ /* Style for LI that contains sub lists (other ULs). */ +background: white url(../images/messenger-blue-icon.png) no-repeat; +color: #369; +font-weight: bold; +cursor: hand !important; +margin-bottom: 2px; +padding: 0 15px; +line-height: 15px; +} + + +/* .treeview li.submenu ul{ /*Style for ULs that are children of LIs (submenu) */ +/*display: none; /*Hide them by default. Don't delete. */ +/* } */ + +.treeview .submenu ul li{ /*Style for LIs of ULs that are children of LIs (submenu) */ +cursor: hand; +} + +ul.treeview li:last-child { +/* background: #fff url(images/lastnode.png) no-repeat; */ +margin-bottom: 20px; +} + +.chat_title { font-family: Arial, Helvetica, sans-serif; font-size: 11pt} +.chat_message { font-family: Arial, Helvetica, sans-serif; font-size: 10pt} +.chat_timestamp { font-family: Arial, Helvetica, sans-serif; font-size: 8pt} +.bold {font-weight: bold;} +.italics {font-style: italic;} +.alert { + font-weight: bold; + color:#FFFFFF; + background-color:#FF0000; +} + +input.red_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#990000; + border:2px solid; + border-top-color:#FFCCCC; + border-left-color:#FFCCCC; + border-right-color:#330000; + border-bottom-color:#330000; +} +input.green_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#009900; + border:2px solid; + border-top-color:#CCFFCC; + border-left-color:#CCFFCC; + border-right-color:#003300; + border-bottom-color:#003300; +} +input.blue_btn{ + font-family: Arial, Sans-Serif; + font-size: 10px; + color:#FFFFFF; + font-weight:bold; + background-color:#000099; + border:2px solid; + border-top-color:#CCCCFF; + border-left-color:#CCCCFF; + border-right-color:#000033; + border-bottom-color:#000033; +} +textarea.chat_window { + font-family: Arial, Sans-Serif; + font-size: 11px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +td.chat_window { + border:2px solid #000000; + padding: 5px; + vertical-align: top; + background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(222,222,222,0) 50%, rgba(222,222,222,0) 50%, rgba(222,222,222,1) 100%); +} +input.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +textarea.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} +select.form_field { + font-family: Arial, Sans-Serif; + font-size: 10px; + margin-bottom: 3px; + padding: 2px; + border: solid 1px #000066; +} diff --git a/www/chat_customer/css/style.css b/www/chat_customer/css/style.css new file mode 100644 index 00000000..d50fe805 --- /dev/null +++ b/www/chat_customer/css/style.css @@ -0,0 +1,69 @@ +/* /!\ DO NOT EDIT THIS FILE !!! Please edit custom.css to keep your customizations after an upgrade /!\ */ + +body { padding:0; margin:0; background: #FFF; } + +div.scroll_list { height: 400px; width: 140px; overflow: scroll; } +div.text_input { overflow: auto; font-size: 10px; font-family: sans-serif; } +.body_text { font-size: 13px; font-family: sans-serif; } +.queue_text_red { font-size: 12px; font-family: sans-serif; font-weight: bold; color: red; } +.queue_text { font-size: 12px; font-family: sans-serif; color: black; text-decoration:none; } +.preview_text { font-size: 13px; font-family: sans-serif; background: #CCFFCC; } +.preview_text_red { font-size: 13px; font-family: sans-serif; background: #FFCCCC; } +.body_small { font-size: 11px; font-family: sans-serif; } +.body_small_bold { font-size: 11px; font-family: sans-serif; font-weight: bold; } +.body_tiny { font-size: 10px; font-family: sans-serif; } +.log_text { font-size: 11px; font-family: monospace; } +.log_text_red { font-size: 11px; font-family: monospace; font-weight: bold; background: #FF3333; } +.log_title { font-size: 12px; font-family: monospace; font-weight: bold; } +.sd_text { font-size: 16px; font-family: sans-serif; font-weight: bold; } +.sh_text { font-size: 14px; font-family: sans-serif; font-weight: bold; } +.sb_text { font-size: 12px; font-family: sans-serif; } +.sk_text { font-size: 11px; font-family: sans-serif; } +.skb_text { font-size: 13px; font-family: sans-serif; font-weight: bold; } +.ON_conf { font-size: 11px; font-family: monospace; color: black; background: #FFFF99; } +.OFF_conf { font-size: 11px; font-family: monospace; color: black; background: #FFCC77; } +.cust_form { font-family: sans-serif; font-size: 10px; overflow: hidden; } +.cust_form_text { font-family: sans-serif; font-size: 10px; overflow: auto; } + +.blink { +-webkit-animation: blink .75s linear infinite; +-moz-animation: blink .75s linear infinite; +-ms-animation: blink .75s linear infinite; +-o-animation: blink .75s linear infinite; +animation: blink .75s linear infinite; +} + +@-webkit-keyframes blink { +0% { opacity: 1; } +50% { opacity: 1; } +50.01% { opacity: 0; } +100% { opacity: 0; } +} + +@-moz-keyframes blink { +0% { opacity: 1; } +50% { opacity: 1; } +50.01% { opacity: 0; } +100% { opacity: 0; } +} + +@-ms-keyframes blink { +0% { opacity: 1; } +50% { opacity: 1; } +50.01% { opacity: 0; } +100% { opacity: 0; } +} + +@-o-keyframes blink { +0% { opacity: 1; } +50% { opacity: 1; } +50.01% { opacity: 0; } +100% { opacity: 0; } +} + +@keyframes blink { +0% { opacity: 1; } +50% { opacity: 1; } +50.01% { opacity: 0; } +100% { opacity: 0; } +} diff --git a/www/chat_customer/customer_chat_code.php b/www/chat_customer/customer_chat_code.php new file mode 100644 index 00000000..4d2d7dc3 --- /dev/null +++ b/www/chat_customer/customer_chat_code.php @@ -0,0 +1,26 @@ + LICENSE: AGPLv2 +# +# Example for incorporating the customer side of the Vicidial chat into a web page. +# Can be called as an include file, if desired. +# +# Builds: +# 151212-0829 - First Build for customer chat +# + +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["chat_id"])) {$chat_id=$_GET["chat_id"];} + elseif (isset($_POST["chat_id"])) {$chat_id=$_POST["chat_id"];} +if (isset($_GET["chat_group_id"])) {$chat_group_id=$_GET["chat_group_id"];} + elseif (isset($_POST["chat_group_id"])) {$chat_group_id=$_POST["chat_group_id"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["unique_userID"])) {$unique_userID=$_GET["unique_userID"];} + elseif (isset($_POST["unique_userID"])) {$unique_userID=$_POST["unique_userID"];} +$URL_vars="?user=".urlencode($unique_userID)."&lead_id=".$lead_id."&group_id=".urlencode($chat_group_id)."&chat_id=".$chat_id."&email=".urlencode($email); +?> + +