Added vicidial call length logging to ra_call_control Agent API function

Fixes for manual dial agent-state issues and a translation issue in vicidial.php

git-svn-id: svn://192.168.202.10@3356 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2021-02-22 16:02:04 +00:00
parent 956463aecf
commit 528b441723
4 changed files with 42 additions and 18 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2020-11-12
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2021-02-22
This document describes the functions of an API(Application Programming Interface)
for the VICIDIAL Agent screen. This functionality will be rather limited at first
@@ -553,7 +553,7 @@ SUCCESS: st_get_agent_active_lead lead found - 6666|7275551212|123456|9987-12347
ra_call_control -
DESCRIPTION:
Allows for remote agent call control: hangup/transfer calls being handled by remote agents, also options for recording a disposition and call length
Allows for remote agent call control: hangup/transfer calls being handled by remote agents, also options for logging a disposition and call length
VALUES:
value -
@@ -571,6 +571,7 @@ status -
EXAMPLE URLS:
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1028&function=ra_call_control&stage=INGROUPTRANSFER&ingroup_choices=DEFAULTINGROUP&value=Y0316001655000402028
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=9877&function=ra_call_control&stage=HANGUP&status=TEST88&value=V2221052110000798236
RESPONSES:
ERROR: ra_call_control not valid - Y0315201639000402027|6666|INGROUPTRANSFER
+6 -5
View File
@@ -1,7 +1,7 @@
<?php
# api.php
#
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed as an API(Application Programming Interface) to allow
# other programs to interact with the VICIDIAL Agent screen
@@ -102,10 +102,11 @@
# 200403-1510 - Added outbound_cid option to external_dial function
# 201112-2053 - Added vm_message function
# 210116-1138 - Addressed session ID issue in ticket #1251
# 210222-1058 - Added call length logging to ra_call_control function
#
$version = '2.14-67';
$build = '201112-2053';
$version = '2.14-68';
$build = '210222-1058';
$startMS = microtime();
@@ -3258,11 +3259,11 @@ if ($function == 'ra_call_control')
{$status='RAXFER';}
if ($call_type=='IN')
{
$stmt = "UPDATE vicidial_closer_log SET status='$status' where uniqueid='$uniqueid' and lead_id='$lead_id' and campaign_id='$campaign_id' order by closecallid desc limit 1;";
$stmt = "UPDATE vicidial_closer_log SET status='$status',length_in_sec=(UNIX_TIMESTAMP(NOW()) - start_epoch),end_epoch=UNIX_TIMESTAMP(NOW()) where uniqueid='$uniqueid' and lead_id='$lead_id' and campaign_id='$campaign_id' order by closecallid desc limit 1;";
}
else
{
$stmt = "UPDATE vicidial_log SET status='$status',user='$agent_user' where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;";
$stmt = "UPDATE vicidial_log SET status='$status',user='$agent_user',length_in_sec=(UNIX_TIMESTAMP(NOW()) - start_epoch),end_epoch=UNIX_TIMESTAMP(NOW()) where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;";
}
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
+29 -7
View File
@@ -1,7 +1,7 @@
<?php
# vicidial.php - the web-based version of the astVICIDIAL client application
#
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# Other scripts that this application depends on:
# - vdc_db_query.php: Updates information in the database
@@ -653,10 +653,11 @@
# 201117-0818 - Changes for better compatibility with non-latin data input
# 201123-1436 - Added Daily call count limit features
# 201201-2015 - Added transfer_button_launch feature
# 210222-0819 - Fixes for manual dial agent-state issues and a translation issue
#
$version = '2.14-621c';
$build = '201201-2015';
$version = '2.14-622c';
$build = '210222-0819';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=92;
$one_mysql_log=0;
@@ -4800,6 +4801,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var lastxferchannel='';
var custchannellive=0;
var xferchannellive=0;
var manual_call_live=0;
var nochannelinsession=0;
var agc_dial_prefix = '91';
var dtmf_silent_prefix = '<?php echo $dtmf_silent_prefix ?>';
@@ -8348,7 +8350,15 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
if (MEdial=='YES')
{manual_entry_dial=1;}
var move_on=1;
if ( (starting_dial_level != 0) && (dial_next_failed < 1) && ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) || (in_lead_preview_state==1) ) )
// JCJ
// alert("Both move_ons must be true plus at least one of the last 5 variables must be '1' to check. Then all 7 non-move_on must be true to manual dial.:\nmove_on - starting_dial_level != 0 ("+starting_dial_level+")\nmove_on - dial_next_failed < 1 ("+dial_next_failed+")\n(N/A)dial_method = "+dial_method+"\n(N/A)custchanellive = "+custchannellive+"\nauto_pause_precall == 'Y' ("+auto_pause_precall+")\nagent_pause_codes_active=='Y' OR 'FORCE' ("+agent_pause_codes_active+")\nAutoDialWaiting == 1 ("+AutoDialWaiting+")\nVD_live_customer_call != 1 ("+VD_live_customer_call+")\nalt_dial_active != 1 ("+alt_dial_active+")\nMD_channel_look != 1 ("+MD_channel_look+")\nin_lead_preview_state != 1 ("+in_lead_preview_state+")");
// JCJ Check if in live call in MANUAL dial method so person can't place manual calls
if (dial_method == 'MANUAL' && (lastcustchannel.length > 0 || manual_call_live > 0))
{
move_on=0;
alert_box("<?php echo _QXZ("MANUAL DIAL IS NOT ALLOWED WHILE INCALL"); ?>");
}
else if ( (starting_dial_level != 0) && (dial_next_failed < 1) && ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) || (in_lead_preview_state==1) ) )
{
if ((auto_pause_precall == 'Y') && ( (agent_pause_codes_active=='Y') || (agent_pause_codes_active=='FORCE') ) && (AutoDialWaiting == 1) && (VD_live_customer_call!=1) && (alt_dial_active!=1) && (MD_channel_look!=1) && (in_lead_preview_state!=1) )
{
@@ -10099,7 +10109,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
InternalChatsCheck();
if (MDnextCID.match(regMNCvar))
{alert_box("<?php echo _QXZ("No more leads in the hopper for campaign:"); ?>\n" + campaign); alert_displayed=1;}
{
alert_box("<?php echo _QXZ("No more leads in the hopper for campaign:"); ?>\n" + campaign);
alert_displayed=1;
in_lead_preview_state=0; // JCJ - This needs to be reset here otherwise the variable stays at 1 and thus manual dials can't be made even if the agent is paused.
}
if (MDnextCID.match(regMDFvarDNC))
{alert_box("<?php echo _QXZ("This phone number is in the DNC list:"); ?>\n" + mdnPhonENumbeR); alert_displayed=1;}
if (MDnextCID.match(regMDFvarDCCL))
@@ -10142,6 +10156,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
else
{
fronter = user;
manual_call_live=1;
LasTCID = MDnextResponse_array[0];
document.vicidial_form.lead_id.value = MDnextResponse_array[1];
LeaDPreVDispO = MDnextResponse_array[2];
@@ -10817,6 +10832,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
prefix_choice='';
agent_dialed_number='';
agent_dialed_type='';
manual_call_live=0;
// CalL_ScripT_id='';
// CalL_ScripT_color='';
dial_next_failed=0;
@@ -11040,6 +11056,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
LasTCID = MDOnextResponse_array[0];
MD_channel_look=1;
custchannellive=1;
manual_call_live=1;
var dispnum = manDiaLonly_num;
var status_display_number = phone_number_format(dispnum);
@@ -11209,6 +11226,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
if (dial_method == "INBOUND_MAN")
{
auto_dial_level=starting_dial_level;
// JCJ - reset dial_next_failed to zero here. Currently if hopper is empty, agent is auto paused and dial_next_failed=1
// However it remains 1 if you click to be active which causes the move_on check to be skipped allowing active
// agents to manual dial.
dial_next_failed=0;
document.getElementById("DiaLControl").innerHTML = "<a href=\"#\" onclick=\"AutoDial_ReSume_PauSe('VDADpause','','','','','','','YES');\"><img src=\"./images/<?php echo _QXZ("vdc_LB_active.gif"); ?>\" border=\"0\" alt=\"You are active\" /></a><br /><a href=\"#\" onclick=\"ManualDialNext('','','','','','0','','','YES');\"><img src=\"./images/<?php echo _QXZ("vdc_LB_dialnextnumber.gif"); ?>\" border=\"0\" alt=\"Dial Next Number\" /></a>";
}
@@ -13718,6 +13739,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
lastcustchannel='';
lastcustserverip='';
MDchannel='';
manual_call_live=0;
if (post_phone_time_diff_alert_message.length > 10)
{
document.getElementById("post_phone_time_diff_span_contents").innerHTML = "";
@@ -17828,7 +17850,7 @@ function phone_number_format(formatphone) {
{
var temp_response = xmlhttp.responseText;
// alert(xmlhttp.responseText);
var regCDS = new RegExp("ERROR: no","ig");
var regCDS = new RegExp("ERROR","ig");
if (temp_response.match(regCDS))
{
// alert_box(temp_response);
@@ -19268,7 +19290,7 @@ function phone_number_format(formatphone) {
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_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 + "|";
// document.getElementById("debugbottomspan").innerHTML = "custchannellive: " + custchannellive + " customer_gone_seconds: " + customer_gone_seconds + ", lastcustchannel.length: " + lastcustchannel.length + " no_empty_session_warnings: " + no_empty_session_warnings + " lead_id: |" + document.vicidial_form.lead_id.value + "|" + " currently_in_email_or_chat: " + currently_in_email_or_chat; //JCJ
if ( (custchannellive < -10) && (lastcustchannel.length > 3) ) {ReChecKCustoMerChaN();}
if ( (nochannelinsession > 16) && (check_n > 15) && (no_empty_session_warnings < 1) ) {NoneInSession();}
if (external_transferconf_count > 0) {external_transferconf_count = (external_transferconf_count - 1);}
+4 -4
View File
@@ -5959,7 +5959,7 @@ echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $admin_version BUILD: $build ADD: $ADD PHP_SELF: $PHP_SELF-->\n";
echo "<META NAME=\"ROBOTS\" CONTENT=\"NONE\">\n";
echo "<META NAME=\"COPYRIGHT\" CONTENT=\"&copy; 2020 ViciDial Group\">\n";
echo "<META NAME=\"COPYRIGHT\" CONTENT=\"&copy; 2021 ViciDial Group\">\n";
echo "<META NAME=\"AUTHOR\" CONTENT=\"ViciDial Group\">\n";
echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<script language=\"JavaScript\" src=\"help.js\"></script>\n";
@@ -44888,7 +44888,7 @@ if ($ADD==999995)
echo "<br><B> "._QXZ("Welcome to ViciDial: copyright, trademark and license page")."</B><BR><BR>\n";
echo "<center><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top><B><font size=3>"._QXZ("Copyright").": </B></td><td align=left> &nbsp; "._QXZ("The ViciDial Contact Center Suite is maintained by the")." <a href=\"http://www.vicidial.com/\" target=\"_blank\">ViciDial Group</a>, &copy; 2020</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top><B><font size=3>"._QXZ("Copyright").": </B></td><td align=left> &nbsp; "._QXZ("The ViciDial Contact Center Suite is maintained by the")." <a href=\"http://www.vicidial.com/\" target=\"_blank\">ViciDial Group</a>, &copy; 2021</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top><B><font size=3>"._QXZ("Trademark").": </B></td><td align=left> &nbsp; \"VICIDIAL\" "._QXZ("is a registered trademark of the")." <a href=\"http://www.vicidial.com/\" target=\"_blank\">ViciDial Group</a>. Here is our <a href=\"http://www.vicidial.com/?page_id=262\" target=\"_blank\">"._QXZ("trademark use policy")."</a></td></tr>\n";
@@ -44909,7 +44909,7 @@ if ($ADD==999995)
echo "<center><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=middle rowspan=3 nowrap><B><font size=3>"._QXZ("Matex").": </B></td>";
echo "<td align=right valign=top><B><font size=2>"._QXZ("Copyright").": </B></td><td align=left><font size=1> &nbsp; "._QXZ("Matex PHP Mathematical expression parser and evaluator library was written by Dorin Marcoci").", &copy; 2021</td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top><B><font size=2>"._QXZ("License").": </B></td><td align=left><font size=1> &nbsp; "._QXZ("Chart.js is licensed under the")." <a href=\"https://github.com/madorin/matex/blob/master/LICENSE.md\" target=\"_blank\">MIT "._QXZ("open source license")."</a></td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top><B><font size=2>"._QXZ("License").": </B></td><td align=left><font size=1> &nbsp; "._QXZ("Matex is licensed under the")." <a href=\"https://github.com/madorin/matex/blob/master/LICENSE.md\" target=\"_blank\">MIT "._QXZ("open source license")."</a></td></tr>\n";
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top nowrap><B><font size=2>"._QXZ("Source Code").": </B></td><td align=left><font size=1> &nbsp; "._QXZ("Matex original source code is available at")." <a href=\"https://github.com/madorin/matex\" target=\"_blank\">"._QXZ("this link")."</a>.</td></tr>\n";
echo "<tr><td colspan=3> &nbsp; </tr>";
@@ -45831,7 +45831,7 @@ echo "<FONT STYLE=\"font-family:HELVETICA;font-size:9;color:white;\"><br><br><!-
echo _QXZ("VERSION").": $admin_version<BR>";
echo _QXZ("BUILD").": $build\n";
if (!preg_match("/_BUILD_/",$SShosted_settings))
{echo "<BR><a href=\"$PHP_SELF?ADD=999995\"><font color=white>&copy; 2020 ViciDial Group</font></a><BR><img src=\"images/pixel.gif\">";}
{echo "<BR><a href=\"$PHP_SELF?ADD=999995\"><font color=white>&copy; 2021 ViciDial Group</font></a><BR><img src=\"images/pixel.gif\">";}
echo "</FONT>\n";
?>