Updates to cm AGI script for extended fields

altered cm.agi script to skip lead updates for extended fields with non-digit responses
Added tabtwo format to CLI lead loader

git-svn-id: svn://192.168.202.10@1861 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2012-10-08 11:10:48 +00:00
parent 1dc89f3810
commit dff65806f6
3 changed files with 70 additions and 11 deletions
+25 -9
View File
@@ -41,7 +41,9 @@ if ($sec < 10) {$sec = "0$sec";}
$now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec";
$vicidial_list_fields = '|vendor_lead_code|source_id|phone_code|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|alt_phone|email|security_phrase|comments|rank|owner|status|user|q01|q02|q03|q04|q05|q06|q07|q08|q09|q10|q11|q12|q13|q14|q15|q16|q17|q18|q19|q20|';
$vicidial_list_fields = '|vendor_lead_code|source_id|phone_code|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|alt_phone|email|security_phrase|comments|rank|owner|status|user|q01|q02|q03|q04|q05|q06|q07|q08|q09|q10|q11|q12|q13|q14|q15|q16|q17|q18|q19|q20|q21|q22|q23|q24|q25|q26|q27|q28|q29|q30|q31|q32|q33|q34|q35|q36|q37|q38|q39|q40|q41|q42|q43|q44|q45|q46|q47|q48|q49|q50|q51|q52|q53|q54|q55|q56|q57|q58|q59|q60|q61|q62|q63|q64|q65|q66|q67|q68|q69|q70|q71|q72|q73|q74|q75|q76|q77|q78|q79|q80|q81|q82|q83|q84|q85|q86|q87|q88|q89|q90|q91|q92|q93|q94|q95|q96|q97|q98|q99|';
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
@@ -263,20 +265,34 @@ if ($outboundIVR > 0)
if ( (length($field)>2) && ($vicidial_list_fields =~ /\|$field\|/) )
{
$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;}
if ( ($field =~ /^q/i) && ($dtmf !~ /[0-9]/) )
{
if ($AGILOG) {$agi_string = "-- VL non-update: |$field|$dtmf|$lead_id|$context|"; &agi_output;}
}
else
{
$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;}
if ( ($field =~ /^q/i) && ($dtmf !~ /[0-9]/) )
{
if ($AGILOG) {$agi_string = "-- VL non-update: |$field|$dtmf|$lead_id|$context|"; &agi_output;}
}
else
{
$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');";
+1 -1
View File
@@ -49,7 +49,7 @@
$script = 'cm_lookup.agi';
$S='*';
$US='_';
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|status|entry_date|entry_list_id|modify_date|user|q01|q02|q03|q04|q05|q06|q07|q08|q09|q10|q11|q12|q13|q14|q15|q16|q17|q18|q19|q20|';
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|status|entry_date|entry_list_id|modify_date|user|q01|q02|q03|q04|q05|q06|q07|q08|q09|q10|q11|q12|q13|q14|q15|q16|q17|q18|q19|q20|q21|q22|q23|q24|q25|q26|q27|q28|q29|q30|q31|q32|q33|q34|q35|q36|q37|q38|q39|q40|q41|q42|q43|q44|q45|q46|q47|q48|q49|q50|q51|q52|q53|q54|q55|q56|q57|q58|q59|q60|q61|q62|q63|q64|q65|q66|q67|q68|q69|q70|q71|q72|q73|q74|q75|q76|q77|q78|q79|q80|q81|q82|q83|q84|q85|q86|q87|q88|q89|q90|q91|q92|q93|q94|q95|q96|q97|q98|q99|';
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -55,9 +55,10 @@
# 110929-1423 - Added new format for abbreviated timezone in owner(pipe30tz) and list creation options
# 120713-1009 - Added new --duplicate-tnm-delete option to check for a duplicate phone with different title and delete existing if found in same list
# 120907-1109 - Added vote17csv format
# 121005-0728 - Added twotab format
#
$version = '120907-1109';
$version = '121005-0728';
$secX = time();
$MT[0]='';
@@ -216,6 +217,9 @@ if (length($ARGV[0])>1)
print "vote17csv:\n";
print "Voter ID,County Code,Name Last,Gender,Race,Birth Date,Party Affiliation,Precinct,Congressional District,House District,Senate District,County Commission District,School Board District,Age Bracket,_2010_GEN,_2012_PRI_A_Date,Phone_10digit\n";
print "\"110306742\",\"DAD\",\"Da Silva Ramos\",\"F\",\"5\",\"06/12/1950\",\"DEM\",\"100\",\"23\",\"0\",\"0\",\"0\",\"0\",\"4\",\"A\",\"\",\"0033559433\"\n\n";
print "twotab:\n";
print "UniqueID,PhoneNumber\n";
print "110306742,3125556666\n\n";
print "dccsv43, dccsvref51, dccsv52 and dccsvref52:\n";
print "---format too confusing to list in the help screen---\n\n";
@@ -796,6 +800,45 @@ foreach(@FILES)
$format_set++;
}
# This is the format for the twotab lead files
#14234243,3125556677
if ( ($format =~ /twotab/) && ($format_set < 1) )
{
@name=@MT;
$raw_number =~ s/\'|\r|\n|\l//gi;
$raw_number =~ s/,|\t/\|/gi;
@m = split(/\|/, $raw_number);
$vendor_lead_code = $m[0];
$source_id = '';
$list_id = '995';
$phone_code = '1';
$phone_number = $m[1]; chomp($phone_number); $phone_number =~ s/\D//gi;
$USarea = substr($phone_number, 0, 3);
$title = '';
$full_name = '';
$first_name = '';
$last_name = '';
$middle_initial = '';
$address1 = '';
$address2 = '';
$address3 = '';
$city = '';
$state = '';
$province = '';
$postal_code = '';
$country = 'USA';
$gender = 'U';
$date_of_birth = '0000-00-00';
$alt_phone = '';
$email = '';
$security_phrase = '';
$comments = '';
$called_count = 0;
$status = 'NEW';
$format_set++;
}
# This is the format for the vote17csv lead files
# Voter ID,County Code,Name Last,Gender,Race,Birth Date,Party Affiliation,Precinct,Congressional District,House District,Senate District,County Commission District,School Board District,Age Bracket,_2010_GEN,_2012_PRI_A_Date,Phone_10digit
# "110555742","DAD","Bob Smith","F","5","06/14/1970","DEM","100","23","0","0","0","0","4","A","","8135559433"