2006-05-12 snapshot
git-svn-id: svn://192.168.202.10@7 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# agi-VDADtransfer.agi version 0.3
|
||||
# agi-VDADtransfer.agi version 0.4
|
||||
#
|
||||
# runs when a call comes in from the VICIDIAL_auto_dialer. This script will
|
||||
# send the calls out to the reps that are logged in.
|
||||
#
|
||||
# if there are no available agents, then it will check every second until an agent becomes available,
|
||||
# if at the end of 20 seconds it has not found an agent it will hangup the call and mark it as dropped
|
||||
# if at the end of 10 seconds(default) it has not found an agent it will hangup the call and mark it as dropped
|
||||
#
|
||||
# You need to put lines similar to those below in your extensions.conf file:
|
||||
#
|
||||
@@ -17,8 +17,9 @@
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# changes:
|
||||
# 50322-1246 changed callerid handling to allow for custom callerid
|
||||
# 60119-1408 fixed calleridname issue with 1.2 tree for custom CID
|
||||
# 50322-1246 - changed callerid handling to allow for custom callerid
|
||||
# 60119-1408 - fixed calleridname issue with 1.2 tree for custom CID
|
||||
# 60503-1054 - Added safe harbor and drop second options from campaign
|
||||
#
|
||||
|
||||
$V = 1; # set to 1 for verbose mode
|
||||
@@ -216,7 +217,7 @@ if ($dbhA->has_selected_record)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### Grab call parameters from vicidial_auto_calls table
|
||||
$stmtA = "UPDATE vicidial_auto_calls set uniqueid='$unique_id', channel='$channel',status='LIVE' where callerid='$callerid' order by call_time desc limit 1;";
|
||||
$dbhA->query("$stmtA");
|
||||
my $affected_rows = $dbhA->get_affected_rows_length;
|
||||
@@ -239,6 +240,23 @@ if ($affected_rows > 0)
|
||||
}
|
||||
}
|
||||
|
||||
### Grab campaign values from the database
|
||||
$stmtA = "SELECT drop_call_seconds,safe_harbor_message,safe_harbor_exten FROM vicidial_campaigns where campaign_id = '$VDADcampaign';";
|
||||
$dbhA->query("$stmtA");
|
||||
if ($dbhA->has_selected_record)
|
||||
{
|
||||
$iter=$dbhA->create_record_iterator;
|
||||
while ( $record = $iter->each)
|
||||
{
|
||||
$DBdrop_call_seconds = "$record->[0]";
|
||||
$DBsafe_harbor_message = "$record->[1]";
|
||||
$DBsafe_harbor_exten = "$record->[2]";
|
||||
if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;}
|
||||
if ($DBsafe_harbor_message) {$safe_harbor_message = $DBsafe_harbor_message;}
|
||||
if ($DBsafe_harbor_exten) {$safe_harbor_exten = $DBsafe_harbor_exten;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','QUEUE','$VDADphone_code','$VDADphone','VDAD','N')";
|
||||
if($M){print STDERR "\n|$stmtA|\n";}
|
||||
@@ -385,35 +403,44 @@ $now_date = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$SQLdate = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$VDADvoicemail_ext = '';
|
||||
|
||||
$DROPexten = '';
|
||||
if ($drop_seconds < 1)
|
||||
{
|
||||
$drop_seconds = $DROP_TIME;
|
||||
|
||||
$stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;";
|
||||
if($M){print STDERR "\n\n|$stmtA|\n";}
|
||||
$dbhA->query("$stmtA");
|
||||
if ($dbhA->has_selected_record)
|
||||
if ($safe_harbor_message=='Y')
|
||||
{
|
||||
$iter=$dbhA->create_record_iterator;
|
||||
$rec_countCUSTDATA=0;
|
||||
while ( $record = $iter->each)
|
||||
$DROPexten = "$safe_harbor_exten";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "SELECT voicemail_ext FROM vicidial_campaigns where campaign_id = '$VDADcampaign' limit 1;";
|
||||
if($M){print STDERR "\n\n|$stmtA|\n";}
|
||||
$dbhA->query("$stmtA");
|
||||
if ($dbhA->has_selected_record)
|
||||
{
|
||||
$VDADvoicemail_ext = "$record->[0]";
|
||||
$VDADvoicemail_ext =~ s/\D//gi;
|
||||
}
|
||||
$iter=$dbhA->create_record_iterator;
|
||||
$rec_countCUSTDATA=0;
|
||||
while ( $record = $iter->each)
|
||||
{
|
||||
$VDADvoicemail_ext = "$record->[0]";
|
||||
$VDADvoicemail_ext =~ s/\D//gi;
|
||||
$DROPexten = "$voicemail_dump_exten$VDADvoicemail_ext";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### use manager middleware-app to connect the next call to the meetme room
|
||||
### use STDOUT to send call to proper DROP location
|
||||
$VHqueryCID = "VH$CIDdate$VDADconf_exten";
|
||||
|
||||
if (length($VDADvoicemail_ext)>0)
|
||||
{ ### if there is a voicemailbox defined then send the dropped call there instead of dropping it
|
||||
print STDERR "\nexiting the VDAD app, transferring call to VMAIL $VDADconf_exten\n";
|
||||
if (length($DROPexten)>0)
|
||||
{ ### if DROP extension is defined then send the dropped call there instead of hangup
|
||||
print STDERR "\nexiting the VDAD app, transferring call to $DROPexten\n";
|
||||
print "SET CONTEXT $ext_context\n";
|
||||
checkresult($result);
|
||||
print "SET EXTENSION $voicemail_dump_exten$VDADvoicemail_ext\n";
|
||||
print "SET EXTENSION $DROPexten\n";
|
||||
checkresult($result);
|
||||
print "SET PRIORITY 1\n";
|
||||
checkresult($result);
|
||||
|
||||
Reference in New Issue
Block a user