Several small fixes

Changed cm.agi to allow inbound logging when lead is defined

git-svn-id: svn://192.168.202.10@1844 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2012-07-30 11:31:01 +00:00
parent b29de5a5cf
commit af9ad1aa02
4 changed files with 32 additions and 12 deletions
@@ -47,6 +47,7 @@
# 120517-1257 - Added CALLMENU timeout option
# 120706-1659 - Added Qualify SQL option
# 120719-1411 - Fixed issue with inbound IVR calls not showing up in real-time screen
# 120730-0727 - Fixed issue with non-populating phone number
#
$script = 'agi-VDAD_inbound_calltime_check.agi';
@@ -217,7 +218,7 @@ while(<STDIN>)
if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;}
if (/^agi_channel\:\s+(.*)$/) {$channel = $1;}
if (/^agi_extension\:\s+(.*)$/) {$extension = $1;}
if (/^agi_type\:\s+(.*)$/) {$type = $1;}
if (/^agi_type\:\s+(.*)$/) {$type = $1;}
if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;}
if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;}
}
@@ -253,6 +254,19 @@ if ($calleridname =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d|^Y\d\d\d\d\d\d\d\
if ($calleridname =~ /^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{$ingroupIVR=1;}
if (length($phone_number) < 6)
{
$stmtA = "SELECT phone_number FROM vicidial_list where lead_id='$lead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$phone_number = $aryA[0];
}
$sthA->finish();
}
$callerid = $calleridname;
}
else
+12 -8
View File
@@ -19,11 +19,12 @@
#exten => _XXXXX,1,AGI(cm.agi,INBOUND-----${EXTEN}-----postal_code)
#exten => _XXXXX,n,Goto(next_callmenu_here,s,1)
#
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 110525-2100 - First Build
# 111003-2150 - Added field to update
# 120730-0729 - Changed to allow inbound logging when lead is defined
#
$script = 'cm.agi';
@@ -176,6 +177,7 @@ $outboundIVR=0;
$fieldUPDATE=0;
if ($calleridname =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{
$phone_number = $callerid;
$callerid = $calleridname;
$outboundIVR=1;
@@ -195,6 +197,7 @@ elsif ($calleridname =~ /^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{
$lead_id = substr($calleridname, 10, 10);
$lead_id = ($lead_id + 0);
$phone_number = $callerid;
$callerid = $calleridname;
if ( (length($field)>2) && ($vicidial_list_fields =~ /\|$field\|/) )
@@ -266,15 +269,16 @@ if ($outboundIVR > 0)
if ($AGILOG) {$agi_string = "-- VL update: |$affected_rowsL|$field|$dtmf|$lead_id|$context|"; &agi_output;}
}
}
elsif ($fieldUPDATE > 0)
{
$stmtA = "UPDATE vicidial_list SET $field='$dtmf' where lead_id='$lead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VL update: |$affected_rowsL|$field|$dtmf|$lead_id|$context|"; &agi_output;}
}
else
{
if ($fieldUPDATE > 0)
{
$stmtA = "UPDATE vicidial_list SET $field='$dtmf' where lead_id='$lead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VL update: |$affected_rowsL|$field|$dtmf|$lead_id|$context|"; &agi_output;}
}
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,comment_a,comment_b,comment_d,comment_e) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$phone_number','$now_date','$channel_group','$dtmf','$context>$dtmf','$priority');";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
@@ -35,6 +35,7 @@
# 111103-0632 - Added MAXCAL as a drop status
# 111103-2003 - Added user_group restrictions for selecting in-groups
# 120224-0910 - Added HTML display option with bar graphs
# 120730-0724 - Small fix for HTML output
#
require("dbconnect.php");
@@ -1486,6 +1487,7 @@ $CSV_text3.="\"TOTAL:\",\"$TOTALcalls\"\n";
if ($report_display_type=="HTML")
{
$ct_ary=array();
$rslt=mysql_query($stmt, $link);
$high_ct=0; $i=0;
while ($row=mysql_fetch_row($rslt)) {
@@ -1744,7 +1746,7 @@ $CSV_text5.="\"TOTAL\",\"$TOTCATcalls\"\n";
if ($report_display_type=="HTML")
{
$ct_ary="";
$ct_ary=array();
$r=0; $i=0;
$high_ct=0;
while ($r < $statcats_to_print)
@@ -992,9 +992,9 @@ else
if ($file_download < 1)
{
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
$ASCII_text.="| TOTALS AGENTS:$hTOT_AGENTS | $hTOTcalls |$hTOTtimeTC |$hTOTALtime |$hTOTwait |$hTOTwaitpct |$hTOTtalk |$hTOTtalkpct |$hTOTdispo |$hTOTdispopct |$hTOTpause |$hTOTpausepct |$hTOTdead |$hTOTdeadpct |$hTOTcustomer | |$SUMstatusesHTML\n";
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
if ($AUTOLOGOUTflag > 0)
{echo " * denotes AUTOLOGOUT from timeclock\n";}
$ASCII_text.="\n\n</PRE>";