2006-05-12 snapshot
git-svn-id: svn://192.168.202.10@7 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# agi-VDADcloser_PHONE.agi version 0.2
|
||||
# agi-VDADcloser_PHONE.agi version 0.3
|
||||
#
|
||||
# runs when a call comes in from a VICIDIAL fronter from a foreign location. This script will
|
||||
# send the calls out to the closers that are logged in. Customer data is not supplied aside from phone number,
|
||||
@@ -8,7 +8,7 @@
|
||||
# lookup the customer info from the foreign server as an alternate to doing the lookup in this script
|
||||
#
|
||||
# if there are no available agents, then it will check every second until an agent becomes available,
|
||||
# if at the end of 360 seconds it has not found an agent it will hangup the call and mark it as dropped or
|
||||
# if at the end of 360 seconds(default) it has not found an agent it will hangup the call and mark it as dropped or
|
||||
# if voicemail is defined, the call will go to voicemail
|
||||
#
|
||||
# You need to put lines similar to those below in your extensions.conf file:
|
||||
@@ -36,6 +36,9 @@
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# changes:
|
||||
# 60504-1243 - Added drop second/message/exten options from inbound_group
|
||||
#
|
||||
|
||||
$V = 1; # set to 1 for verbose mode
|
||||
$M = 1; # set to 1 for 2 line messages mode
|
||||
@@ -263,6 +266,25 @@ if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";}
|
||||
$VDADlead_id = "$new_lead_id";
|
||||
$VDADfronter = "$ref_agent";
|
||||
|
||||
### Grab inbound_group values from the database
|
||||
$stmtA = "SELECT drop_call_seconds,drop_message,drop_exten FROM vicidial_inbound_groups where group_id = '$channel_group';";
|
||||
$dbhA->query("$stmtA");
|
||||
if ($dbhA->has_selected_record)
|
||||
{
|
||||
$iter=$dbhA->create_record_iterator;
|
||||
while ( $record = $iter->each)
|
||||
{
|
||||
$DBdrop_call_seconds = "$record->[0]";
|
||||
$DBdrop_message = "$record->[1]";
|
||||
$DBdrop_exten = "$record->[2]";
|
||||
if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;}
|
||||
if ($DBdrop_message) {$drop_message = $DBdrop_message;}
|
||||
if ($DBdrop_exten) {$drop_exten = $DBdrop_exten;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
### insert a LIVE record to the vicidial_auto_calls table
|
||||
$stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group','LIVE','$CIDlead_id','$uniqueid','$callerid','$channel','$VDADphone_code','$VDADphone','$SQLdate')";
|
||||
$dbhA->query($stmtA);
|
||||
@@ -440,35 +462,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 = '360';
|
||||
$drop_seconds = $DROP_TIME;
|
||||
|
||||
$stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' limit 1;";
|
||||
if($M){print STDERR "\n\n|$stmtA|\n";}
|
||||
$dbhA->query("$stmtA");
|
||||
if ($dbhA->has_selected_record)
|
||||
if ($drop_message=='Y')
|
||||
{
|
||||
$iter=$dbhA->create_record_iterator;
|
||||
$rec_countCUSTDATA=0;
|
||||
while ( $record = $iter->each)
|
||||
$DROPexten = "$drop_exten";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "SELECT voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group' 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### get ready to hangup dropped call
|
||||
### 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