Added AMD actions for call menu and in-group

git-svn-id: svn://192.168.202.10@1931 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2013-02-11 02:01:25 +00:00
parent 6b174c3953
commit 23244cee01
9 changed files with 212 additions and 48 deletions
+3
View File
@@ -164,6 +164,9 @@ OTHER CHANGES:
setting is set properly for the version you have installed on that
server.
34. Added campaign options to send answering machine detected calls to a
Call Menu or In-Group.
+60 -20
View File
@@ -44,6 +44,7 @@
# 110926-1902 - Added extended logging and additional waitforsilence options
# 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible
# 130108-1808 - Changes for Asterisk 1.8 compatibility
# 130210-1113 - Added options for CALLMENU|INGROUP cpd_amd_actions
#
$script = 'VD_amd.agi';
@@ -115,7 +116,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT agi_output,asterisk_version FROM servers where server_ip = '$VARserver_ip';";
$stmtA = "SELECT agi_output,asterisk_version,ext_context FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -125,6 +126,8 @@ if ($sthArows > 0)
@aryA = $sthA->fetchrow_array;
$DBagi_output = $aryA[0];
$asterisk_version = $aryA[1];
$DBext_context = $aryA[2];
if ($DBext_context) {$ext_context = $DBext_context;}
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
@@ -283,23 +286,6 @@ else
$AGI->stream_file('sip-silence');
########## FIND ext_context from the servers table ##########
$stmtA = "SELECT ext_context FROM servers where server_ip = '$VARserver_ip';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$DBext_context = $aryA[0];
if ($DBext_context) {$ext_context = $DBext_context;}
$rec_count++;
}
$sthA->finish();
########## FIND vicidial_auto_calls record ##########
$stmtA = "SELECT campaign_id,phone_code,phone_number FROM vicidial_auto_calls where callerid='$callerid' order by auto_call_id desc limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -393,7 +379,7 @@ else
}
### Grab vmail forward message values from the database
$stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename FROM vicidial_campaigns where campaign_id = '$VD_campaign_id' limit 1;";
$stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu FROM vicidial_campaigns where campaign_id = '$VD_campaign_id' limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -406,13 +392,16 @@ else
$waitforsilence_options = $aryA[2];
$survey_recording = $aryA[3];
$campaign_rec_filename = $aryA[4];
$cpd_amd_action = $aryA[5];
$amd_inbound_group = $aryA[6];
$amd_callmenu = $aryA[7];
$sthA->finish();
}
else
{
$sthA->finish();
### Grab vmail forward message values from the database
$stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename FROM vicidial_campaigns where closer_campaigns LIKE \"% $VD_campaign_id %\" order by campaign_id limit 1;";
$stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu FROM vicidial_campaigns where closer_campaigns LIKE \"% $VD_campaign_id %\" order by campaign_id limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -425,6 +414,9 @@ else
$waitforsilence_options = $aryA[2];
$survey_recording = $aryA[3];
$campaign_rec_filename = $aryA[4];
$cpd_amd_action = $aryA[5];
$amd_inbound_group = $aryA[6];
$amd_callmenu = $aryA[7];
$sthA->finish();
}
else
@@ -763,6 +755,54 @@ else
sleep($waitforsilence_seconds);
}
### if call menu or in-group method
if ($cpd_amd_action =~ /CALLMENU|INGROUP/)
{
$DROPexten='';
if ($cpd_amd_action =~ /CALLMENU/)
{
$DROPexten = 's';
$ext_context = $amd_callmenu;
}
if ($cpd_amd_action =~ /INGROUP/)
{ # 90009*CL_uk3survy_*8301*10000123*universal*7275551212*1234*"
$fronter='VDAMD';
$DROPexten = "90009*$amd_inbound_group$S$S$VD_lead_id$S$S$VD_phone_number$S$fronter$S";
}
if (length($DROPexten)>0)
{
$stmtA = "UPDATE vicidial_log set status='AMDXFR' where uniqueid='$uniqueid' and lead_id='$VD_lead_id' order by call_date desc limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_log AMDXFR update: |$affected_rows|$uniqueid|"; &agi_output;}
$stmtA = "UPDATE vicidial_list set status='AMDXFR' where lead_id='$VD_lead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list AMDXFR update: |$affected_rows|$uniqueid|"; &agi_output;}
$AGI->stream_file('sip-silence');
$AGI->stream_file('sip-silence');
$AGI->stream_file('sip-silence');
$AGI->stream_file('sip-silence');
if ($AGILOG) {$agi_string = "exiting the VD_AMD app, transferring call to $DROPexten:$ext_context"; &agi_output;}
print "SET CONTEXT $ext_context\n";
$result = <STDIN>;
checkresult($result);
print "SET EXTENSION $DROPexten\n";
$result = <STDIN>;
checkresult($result);
print "SET PRIORITY 1\n";
$result = <STDIN>;
checkresult($result);
exit;
}
}
### play messages
if ($DB_am_message_exten =~ /\|/)
{
+5 -4
View File
@@ -102,6 +102,7 @@
# 121125-0035 - Added Other Campaign DNC option
# 130108-1806 - Changes for Asterisk 1.8 compatibility
# 130124-1853 - Issue #637 fix <karlb>
# 130210-1013 - Added options for CALLMENU|INGROUP cpd_amd_actions
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -1070,7 +1071,7 @@ if ($call_handle_method =~ /REMIND/)
$AGI->stream_file('sip-silence');
############# BEGIN CPD AMD SECTION ############################
if ($cpd_amd_action =~ /DISPO|MESSAGE/)
if ($cpd_amd_action =~ /DISPO|MESSAGE|CALLMENU|INGROUP/)
{
$stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result NOT IN('Voice','Unknown','???','') and status='NEW';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
@@ -1128,7 +1129,7 @@ if ($call_handle_method =~ /SURVEY/)
$AGI->stream_file('sip-silence');
############# BEGIN CPD AMD SECTION ############################
if ($cpd_amd_action =~ /DISPO|MESSAGE/)
if ($cpd_amd_action =~ /DISPO|MESSAGE|CALLMENU|INGROUP/)
{
$stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result NOT IN('Voice','Unknown','???','') and status='NEW';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
@@ -1922,7 +1923,7 @@ while ($drop_timer <= $DROP_TIME)
}
############# BEGIN CPD AMD SECTION ############################
if ($cpd_amd_action =~ /DISPO|MESSAGE/)
if ($cpd_amd_action =~ /DISPO|MESSAGE|CALLMENU|INGROUP/)
{
$stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result NOT IN('Voice','Unknown','???','') and status='NEW';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
@@ -3569,7 +3570,7 @@ sub cpd_end_call
$drop_seconds = $DROP_TIME;
}
if ( ($cpd_amd_action =~ /MESSAGE/) && ($cpd_result !~ /Fax/i) )
if ( ($cpd_amd_action =~ /MESSAGE|CALLMENU|INGROUP/) && ($cpd_result !~ /Fax/i) )
{
$DROPexten = "8320";
$AMDSTATUS_set = $AGI->set_variable('AMDSTATUS', "CPDMACHINE");
+26 -2
View File
@@ -8,17 +8,18 @@
#
# This program only needs to be run by one server
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 110425-0853 - First Build
# 110506-1516 - Added DIDs, IVRs, in-groups(queues), campaigns(queues) and all-alias to the sync options
# 111203-0737 - Added queue key options for in-group ID and ALLQ
# 121115-1908 - Added CLI options for alternate QM MySQL connection information
# 130131-2225 - Added key-id-wipe options
#
# constants
$version = '121115-1908';
$version = '130131-2225';
$US='__';
$MT[0]='';
$CLIQMDB_host=0;
@@ -53,6 +54,7 @@ if (length($ARGV[0])>1)
print " [--all-alias-sync] = will sync all queues in QM into the default \"00 All Queues\" alias\n";
print " [--key-id-ig] = will ensure that the queue has the in-group id set as a key\n";
print " [--key-id-allq] = will ensure that the queue has \"ALLQ\" id set as a key\n";
print " [--key-id-wipe] = will start with a blank queue key before the other key options\n";
print " [--qm-db-server=XXX] = alternate QM mysql server\n";
print " [--qm-db-dbname=XXX] = alternate QM mysql database name\n";
print " [--qm-db-login=XXX] = alternate QM mysql server login account\n";
@@ -131,6 +133,11 @@ if (length($ARGV[0])>1)
$SYNC_campaigns=1;
if ($Q < 1) {print "\n----- CAMPAIGN SYNC -----\n\n";}
}
if ($args =~ /--key-id-wipe/i)
{
$KEY_wipe=1;
if ($Q < 1) {print "\n----- QUEUE KEY WIPE -----\n\n";}
}
if ($args =~ /--key-id-ig/i)
{
$KEY_ingroup=1;
@@ -725,6 +732,20 @@ if ($SYNC_ingroups > 0)
if ($KEY_allq > 0)
{$visibility_keySEARCH .= " and visibility_key LIKE \"%ALLQ%\"";}
if ($KEY_wipe > 0)
{
$visibility_keySEARCH='';
if ( ($KEY_ingroup > 0) && ($KEY_allq > 0) )
{$visibility_keySEARCH = " and visibility_key = '$Vid[$i] ALLQ'";}
else
{
if ($KEY_ingroup > 0)
{$visibility_keySEARCH .= " and visibility_key ='$Vid[$i]'";}
if ($KEY_allq > 0)
{$visibility_keySEARCH .= " and visibility_key ='ALLQ'";}
}
}
### Find if queue exists with id and description identical
$stmtB = "SELECT count(*) FROM code_possibili where composizione_coda='$Vid[$i]' and nome_coda='$Vdescription[$i]' and q_direction='inbound' $visibility_keySEARCH;";
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
@@ -793,6 +814,9 @@ if ($SYNC_ingroups > 0)
}
$sthB->finish();
if ($KEY_wipe > 0)
{$visibility_key='';}
if (length($visibility_key) < 2)
{
if ($KEY_ingroup > 0)
+1
View File
@@ -10,6 +10,7 @@ A - Answering Machine - Agent-defined Answering Machine
AA - Answering Machine Auto - Dialer-defined Answering Machine
AM - Answering Machine Sent to Mesg - AMD(Answering Machine Detection) call sent to a message to be played
AL - Answering Machine Msg Played - AMD(Answering Machine Detection) call sent to a message and message has been played
AMDXFR - Answering Machine Transfer to Call Menu or In-Group
AFAX - Fax Machine Auto - Dialer-defined Fax Machine
B - Busy - Agent-defined Busy signal
AB - Busy Auto - Carrier-received Busy signal
+5 -3
View File
@@ -756,7 +756,7 @@ vtiger_search_category VARCHAR(100) default 'LEAD',
vtiger_create_call_record ENUM('Y','N','DISPO') default 'Y',
vtiger_create_lead_record ENUM('Y','N') default 'Y',
vtiger_screen_login ENUM('Y','N','NEW_WINDOW') default 'Y',
cpd_amd_action ENUM('DISABLED','DISPO','MESSAGE') default 'DISABLED',
cpd_amd_action ENUM('DISABLED','DISPO','MESSAGE','CALLMENU','INGROUP') default 'DISABLED',
agent_allow_group_alias ENUM('Y','N') default 'N',
default_group_alias VARCHAR(30) default '',
vtiger_search_dead ENUM('DISABLED','ASK','RESURRECT') default 'ASK',
@@ -865,7 +865,9 @@ safe_harbor_audio_field VARCHAR(30) default 'DISABLED',
pause_after_next_call ENUM('ENABLED','DISABLED') default 'DISABLED',
owner_populate ENUM('ENABLED','DISABLED') default 'DISABLED',
use_other_campaign_dnc VARCHAR(8) default '',
allow_emails ENUM('Y','N') default 'N'
allow_emails ENUM('Y','N') default 'N',
amd_inbound_group VARCHAR(20) default '',
amd_callmenu VARCHAR(50) default ''
);
CREATE TABLE vicidial_lists (
@@ -3094,4 +3096,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1339',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1340',db_schema_update_date=NOW();
+6
View File
@@ -303,3 +303,9 @@ ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
ALTER TABLE vicidial_email_log MODIFY message text character set utf8;
UPDATE system_settings SET db_schema_version='1339',db_schema_update_date=NOW() where db_schema_version < 1339;
ALTER TABLE vicidial_campaigns MODIFY cpd_amd_action ENUM('DISABLED','DISPO','MESSAGE','CALLMENU','INGROUP') default 'DISABLED';
ALTER TABLE vicidial_campaigns ADD amd_inbound_group VARCHAR(20) default '';
ALTER TABLE vicidial_campaigns ADD amd_callmenu VARCHAR(50) default '';
UPDATE system_settings SET db_schema_version='1340',db_schema_update_date=NOW() where db_schema_version < 1340;
@@ -173,6 +173,13 @@ UPDATE AN EXISTING INBOUND EMAIL ACCOUNT||
INBOUND EMAIL ACCOUNT LISTINGS||
UNREAD EMAILS||
Un-handled Emails||
Setting this to INGROUP will send an answering machine to an inbound group. Setting this to CALLMENU will send an answering machine to a Call Menu in the system||
AMD send to Action||
This option allows you to define whether a call is sent to the AMD Action when an answering machine is detected. If this is set to N, then the call will be hung up as soon as it is determined to be an answering machine. Default is N||
AMD Inbound Group||
If CPD AMD Action is set to INGROUP, then this is the Inbound Group that the call will be sent to if an answering machine is detected||
AMD Call Menu||
If CPD AMD Action is set to CALLMENU, then this is the Call Menu that the call will be sent to if an answering machine is detected||
############################################################ CLIENT
+89 -9
View File
File diff suppressed because one or more lines are too long