Added call_channel and call_transfer logging for 3way-press outside-agents
git-svn-id: svn://192.168.202.10@3795 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -47,11 +47,12 @@
|
||||
#exten => i,n,Hangup()
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2024 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# changes:
|
||||
# 231113-2041 - First Build
|
||||
# 231227-1427 - Added multi-phone ability
|
||||
# 240108-1503 - Added call_channel and call_transfer logging
|
||||
#
|
||||
|
||||
$script = 'agi-3way_press_outside.agi';
|
||||
@@ -379,13 +380,13 @@ if ($AGILOG) {$agi_string = "3-WAY DEBUG: user/server/session found: |$CALLuser|
|
||||
if ($stage =~ /answered/i)
|
||||
{
|
||||
### Update the call in vicidial_3way_press_live
|
||||
$stmtA="UPDATE vicidial_3way_press_live SET status='ANSWERED' where call_3way_id='$calleridname' and status!='DEFEATED';";
|
||||
$stmtA="UPDATE vicidial_3way_press_live SET status='ANSWERED',call_channel='$channel' where call_3way_id='$calleridname' and status!='DEFEATED';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$affected_rowsA = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live answered UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;}
|
||||
|
||||
### Update the call in vicidial_3way_press_log
|
||||
$stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Answered: $SQLdate') where call_3way_id='$calleridname';";
|
||||
$stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Answered: $SQLdate'),call_channel='$channel' where call_3way_id='$calleridname';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$affected_rowsA = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log answered UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;}
|
||||
@@ -416,7 +417,7 @@ if ($stage =~ /accepted/i)
|
||||
if ($accepted_ct < 1)
|
||||
{
|
||||
### Update the call in vicidial_3way_press_live
|
||||
$stmtA = "UPDATE vicidial_3way_press_live SET status='ACCEPTED' where call_3way_id='$calleridname';";
|
||||
$stmtA = "UPDATE vicidial_3way_press_live SET status='ACCEPTED',call_channel='$channel' where call_3way_id='$calleridname';";
|
||||
my $UPDATEaffected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$UPDATEaffected_rows; &mysql_error_logging;
|
||||
if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live accepted UPDATE: |$UPDATEaffected_rows|$stmtA|"; &agi_output;}
|
||||
@@ -432,7 +433,7 @@ if ($stage =~ /accepted/i)
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$UNLOCKaffected_rows; &mysql_error_logging;
|
||||
|
||||
### Update the call in vicidial_3way_press_log
|
||||
$stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Accepted: $SQLdate') where call_3way_id='$calleridname';";
|
||||
$stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Accepted: $SQLdate'),call_channel='$channel' where call_3way_id='$calleridname';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$affected_rowsA = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log accepted UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;}
|
||||
@@ -472,7 +473,7 @@ if ($stage =~ /accepted/i)
|
||||
if ($AGILOG) {$agi_string = "-- vicidial_3way_press_live transfer UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;}
|
||||
|
||||
### Update the call in vicidial_3way_press_log
|
||||
$stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Transfer: ',NOW()) where call_3way_id='$calleridname';";
|
||||
$stmtA="UPDATE vicidial_3way_press_log SET result=CONCAT(result,'|Transfer: ',NOW()),call_transfer='Y' where call_3way_id='$calleridname';";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
$affected_rowsA = $dbhA->do($stmtA);
|
||||
if ($AGILOG) {$agi_string = "-- vicidial_3way_press_log transfer UPDATE: |$affected_rowsA|$stmtA|"; &agi_output;}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Agent 3-way Press-1 Calls DOC Started: 2023-11-13 Updated: 2023-12-28
|
||||
Agent 3-way Press-1 Calls DOC Started: 2023-11-13 Updated: 2024-01-08
|
||||
|
||||
|
||||
This document will go over how to set up Agent Screen 3-way calls with outside
|
||||
@@ -48,6 +48,13 @@ Hungup = Either the call timed out or another outside-user pressed '1' before th
|
||||
|
||||
|
||||
|
||||
Is there any way to tell if the outside-user is still on the phone call with the customer/agent?
|
||||
|
||||
Yes, the 'vicidial_3way_press_log' database table has a "call_channel" field that will store the Asterisk channel name in it after the call is answered, and that value together with the "server_ip" field will allow you to look up that channel in the 'live_sip_channels' database table to see if it is still active on the system. As for multi-call, you can look at the "call_transfer" field in the 'vicidial_3way_press_log' database table to see which outside-user call was transferred to the customer/agent session. If "call_transfer" is set to 'Y' then that call was the successfully transferred one.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SYSTEM SETTINGS DIALPLAN ENTRIES, PUT AT THE BOTTOM OF THE ENTRY!!! :
|
||||
-------------------------------------------------------------------------
|
||||
@@ -113,6 +120,7 @@ session_id VARCHAR(20),
|
||||
server_ip VARCHAR(15),
|
||||
session_id_3way VARCHAR(20) default '',
|
||||
status VARCHAR(40),
|
||||
call_channel VARCHAR(100) default '',
|
||||
index(call_date),
|
||||
index(caller_code),
|
||||
index(call_3way_id),
|
||||
@@ -132,6 +140,8 @@ session_id VARCHAR(20),
|
||||
server_ip VARCHAR(15),
|
||||
session_id_3way VARCHAR(20) default '',
|
||||
result TEXT,
|
||||
call_channel VARCHAR(100) default '',
|
||||
call_transfer ENUM('N','Y') default 'N',
|
||||
index(call_date),
|
||||
index(caller_code),
|
||||
index(call_3way_id),
|
||||
|
||||
@@ -5064,6 +5064,7 @@ session_id VARCHAR(20),
|
||||
server_ip VARCHAR(15),
|
||||
session_id_3way VARCHAR(20) default '',
|
||||
status VARCHAR(40),
|
||||
call_channel VARCHAR(100) default '',
|
||||
index(call_date),
|
||||
index(caller_code),
|
||||
index(call_3way_id),
|
||||
@@ -5083,6 +5084,8 @@ session_id VARCHAR(20),
|
||||
server_ip VARCHAR(15),
|
||||
session_id_3way VARCHAR(20) default '',
|
||||
result TEXT,
|
||||
call_channel VARCHAR(100) default '',
|
||||
call_transfer ENUM('N','Y') default 'N',
|
||||
index(call_date),
|
||||
index(caller_code),
|
||||
index(call_3way_id),
|
||||
@@ -5570,4 +5573,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues',
|
||||
|
||||
UPDATE system_settings set vdc_agent_api_active='1';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1703',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1704',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
|
||||
@@ -2579,3 +2579,13 @@ index(call_date)
|
||||
CREATE INDEX vdplpn on vicidial_3way_press_log (phone_number);
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1703',db_schema_update_date=NOW() where db_schema_version < 1703;
|
||||
|
||||
ALTER TABLE vicidial_3way_press_live ADD call_channel VARCHAR(100) default '';
|
||||
|
||||
ALTER TABLE vicidial_3way_press_log ADD call_channel VARCHAR(100) default '';
|
||||
ALTER TABLE vicidial_3way_press_log ADD call_transfer ENUM('N','Y') default 'N';
|
||||
|
||||
ALTER TABLE vicidial_3way_press_log_archive ADD call_channel VARCHAR(100) default '';
|
||||
ALTER TABLE vicidial_3way_press_log_archive ADD call_transfer ENUM('N','Y') default 'N';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1704',db_schema_update_date=NOW() where db_schema_version < 1704;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
# AST_3way_press_log_report.php
|
||||
#
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2024 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
# 231228-2204 - First build
|
||||
# 240108-1556 - Added channel/server display
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -430,6 +431,8 @@ else
|
||||
$Rlead_id=array();
|
||||
$Rphone_number=array();
|
||||
$Routbound_cid=array();
|
||||
$Rchannel=array();
|
||||
$Rserver_ip=array();
|
||||
$Rresult=array();
|
||||
$Rtransfer=array();
|
||||
|
||||
@@ -441,7 +444,7 @@ else
|
||||
$TOTdefeated=0;
|
||||
$TOTtransfer=0;
|
||||
|
||||
$stmt = "SELECT date_format(call_date, '%Y-%m-%d %H:%i:%s') as date,user,lead_id,phone_number,outbound_cid,result from ".$vicidial_3way_press_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' $user_SQL $phone_number_SQL order by call_date desc limit 100000";
|
||||
$stmt = "SELECT date_format(call_date, '%Y-%m-%d %H:%i:%s') as date,user,lead_id,phone_number,outbound_cid,result,call_channel,server_ip from ".$vicidial_3way_press_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' $user_SQL $phone_number_SQL order by call_date desc limit 100000";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rows_to_print = mysqli_num_rows($rslt);
|
||||
@@ -456,6 +459,8 @@ else
|
||||
$Rphone_number[$i] = $row[3];
|
||||
$Routbound_cid[$i] = $row[4];
|
||||
$Rresult[$i] = $row[5];
|
||||
$Rchannel[$i] = $row[6];
|
||||
$Rserver_ip[$i] = $row[7];
|
||||
$Rtransfer[$i] = 0;
|
||||
$i++;
|
||||
}
|
||||
@@ -485,7 +490,7 @@ else
|
||||
if (preg_match("/Transfer/",$Rresult[$i])) {$TOTtransfer++; $Rtransfer[$i]++;}
|
||||
else
|
||||
{$BD='<font color=red>'; $ED='</font>';}
|
||||
$file_output_data .= "\"".trim($Rcall_date[$i])."\",\"".trim($Rfull_name[$i])."\",\"".trim($Rlead_id[$i])."\",\"".trim($Rphone_number[$i])."\",\"".trim($Routbound_cid[$i])."\",\"".trim($Rtransfer[$i])."\",\"".trim($Rresult[$i])."\"\n";
|
||||
$file_output_data .= "\"".trim($Rcall_date[$i])."\",\"".trim($Rfull_name[$i])."\",\"".trim($Rlead_id[$i])."\",\"".trim($Rphone_number[$i])."\",\"".trim($Routbound_cid[$i])."\",\"".trim($Rchannel[$i])."\",\"".trim($Rserver_ip[$i])."\",\"".trim($Rtransfer[$i])."\",\"".trim($Rresult[$i])."\"\n";
|
||||
$Rcall_date[$i] = $BD.sprintf("%19s", $Rcall_date[$i]).$ED;
|
||||
$Rfull_name[$i] = "$Ruser[$i] - $Rfull_name[$i]";
|
||||
if (mb_strlen($Rfull_name[$i],'utf-8')>40)
|
||||
@@ -494,8 +499,14 @@ else
|
||||
$Rlead_id[$i] = $BD.sprintf("%-9s", $Rlead_id[$i]).$ED;
|
||||
$Rphone_number[$i] = $BD.sprintf("%-10s", $Rphone_number[$i]).$ED;
|
||||
$Routbound_cid[$i] = $BD.sprintf("%-10s", $Routbound_cid[$i]).$ED;
|
||||
if (mb_strlen($Rchannel[$i],'utf-8')>30)
|
||||
{$Rchannel[$i] = mb_substr($Rchannel[$i],0,27,'utf-8') . '...';}
|
||||
$Rchannel[$i] = $BD.sprintf("%-30s", $Rchannel[$i]).$ED;
|
||||
if (mb_strlen($Rserver_ip[$i],'utf-8')>15)
|
||||
{$Rserver_ip[$i] = mb_substr($Rserver_ip[$i],0,12,'utf-8') . '...';}
|
||||
$Rserver_ip[$i] = $BD.sprintf("%-15s", $Rserver_ip[$i]).$ED;
|
||||
$Rresult[$i] = $BD.sprintf("%-200s", $Rresult[$i]).$ED;
|
||||
$ASCII_text_data.="| $Rcall_date[$i] | $Rfull_name[$i] | $Rlead_id[$i] | $Rphone_number[$i] | $Routbound_cid[$i] | $Rresult[$i]\n";
|
||||
$ASCII_text_data.="| $Rcall_date[$i] | $Rfull_name[$i] | $Rlead_id[$i] | $Rphone_number[$i] | $Routbound_cid[$i] | $Rchannel[$i] | $Rserver_ip[$i] | $Rresult[$i]\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@@ -522,11 +533,11 @@ else
|
||||
$ASCII_text.="+------------+------------+\n";
|
||||
|
||||
$ASCII_text.="\n"._QXZ("Results Detail").":\n";
|
||||
$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+------------\n";
|
||||
$ASCII_text.="| "._QXZ("Date Time",19)." | "._QXZ("User Agent",43)." | "._QXZ("Lead",9)." | "._QXZ("Phone",10)." | "._QXZ("CID",10)." | "._QXZ("Results",20)."\n";
|
||||
$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+------------\n";
|
||||
$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+--------------------------------+-----------------+------------\n";
|
||||
$ASCII_text.="| "._QXZ("Date Time",19)." | "._QXZ("User Agent",43)." | "._QXZ("Lead",9)." | "._QXZ("Phone",10)." | "._QXZ("CID",10)." | "._QXZ("Channel",30)." | "._QXZ("Server",15)." | "._QXZ("Results",20)."\n";
|
||||
$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+--------------------------------+-----------------+------------\n";
|
||||
$ASCII_text.=$ASCII_text_data;
|
||||
$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+------------\n";
|
||||
$ASCII_text.="+---------------------+---------------------------------------------+-----------+------------+------------+--------------------------------+-----------------+------------\n";
|
||||
|
||||
$file_output .= "\""._QXZ("Results Summary").":\"\n";
|
||||
$file_output .= "\""._QXZ("TOTAL")."\",\"".trim($TOTtotal)."\"\n";
|
||||
@@ -538,7 +549,7 @@ else
|
||||
$file_output .= "\""._QXZ("Transfer")."\",\"".trim($TOTtransfer)."\"\n";
|
||||
$file_output .= "\n";
|
||||
$file_output .= "\""._QXZ("Results Detail").":\"\n";
|
||||
$file_output .= "\""._QXZ("Date Time")."\",\""._QXZ("User Agent")."\",\""._QXZ("Lead")."\",\""._QXZ("Phone")."\",\""._QXZ("CID")."\",\""._QXZ("Transfer")."\",\""._QXZ("Results")."\"\n";
|
||||
$file_output .= "\""._QXZ("Date Time")."\",\""._QXZ("User Agent")."\",\""._QXZ("Lead")."\",\""._QXZ("Phone")."\",\""._QXZ("CID")."\",\""._QXZ("Channel")."\",\""._QXZ("Server")."\",\""._QXZ("Transfer")."\",\""._QXZ("Results")."\"\n";
|
||||
$file_output .= $file_output_data;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user