2006-05-12 snapshot
git-svn-id: svn://192.168.202.10@7 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# agi-VDADcloser_inboundCID.agi version 0.2
|
||||
# agi-VDADcloser_inboundCID.agi version 0.3
|
||||
#
|
||||
# runs when a call comes in from an inbound call. This script will
|
||||
# send the calls out to the closers that are logged in.
|
||||
# *** This version detects inbound callerID over PRI ***
|
||||
#
|
||||
# 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
|
||||
# if at the end of 360 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:
|
||||
#
|
||||
@@ -28,6 +28,9 @@
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# changes:
|
||||
# 60504-1241 - 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
|
||||
@@ -286,6 +289,25 @@ if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";}
|
||||
checkresult($result);
|
||||
print STDERR "callerID changed: $YqueryCID\n";
|
||||
|
||||
### 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','$new_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate')";
|
||||
$dbhA->query($stmtA);
|
||||
@@ -458,34 +480,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