From e54b78d5d1a41812957cb390f7e5acd684974819 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 3 Jul 2015 19:48:01 +0000 Subject: [PATCH] Added ability to use No Agent Call URL with the dispo_move_list.php script Fixed issue with AST_send_URL.pl git-svn-id: svn://192.168.202.10@2339 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 3 ++ bin/AST_send_URL.pl | 5 ++-- www/agc/dispo_move_list.php | 55 +++++++++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/UPGRADE b/UPGRADE index dfa21125..942a4905 100644 --- a/UPGRADE +++ b/UPGRADE @@ -88,6 +88,9 @@ OTHER CHANGES: 13. Added campaign option to allow you to set the number of seconds after a customer hangs up before the warning shows on the agent screen +14. Added ability to use No Agent Call URL with the dispo_move_list.php script + see script comments for instructions. + diff --git a/bin/AST_send_URL.pl b/bin/AST_send_URL.pl index 7a7f8e57..7191e5db 100644 --- a/bin/AST_send_URL.pl +++ b/bin/AST_send_URL.pl @@ -21,6 +21,7 @@ # 150114-2037 - Added list_name variable # 150429-0910 - Added campaign variables # 150609-1931 - Added list_description variable +# 150703-1542 - Fixed issue with list_id check # $|++; @@ -321,7 +322,7 @@ if (length($lead_id) > 0) } $sthA->finish(); - if ( (length($VAR_list_id) > 1) && ( ( (length($list_name) < 1) && ($add_lead_url =~ /--A--list_name--B--/) ) or ( (length($list_description) < 1) && ($add_lead_url =~ /--A--list_description--B--/) ) ) + if ( (length($VAR_list_id) > 1) && ( ( (length($list_name) < 1) && ($add_lead_url =~ /--A--list_name--B--/) ) or ( (length($list_description) < 1) && ($add_lead_url =~ /--A--list_description--B--/) ) ) ) { $stmtH = "SELECT list_name,list_description FROM vicidial_lists where list_id='$VAR_list_id';"; $sthA = $dbhA->prepare($stmtH) or die "preparing: ",$dbhA->errstr; @@ -648,7 +649,7 @@ if (length($lead_id) > 0) $sthA->finish(); } - if ( (length($VAR_list_id) > 1) && ( ( (length($list_name) < 1) && ($start_call_url =~ /--A--list_name--B--/) ) || ( (length($list_description) < 1) && ($start_call_url =~ /--A--list_description--B--/) ) ) + if ( (length($VAR_list_id) > 1) && ( ( (length($list_name) < 1) && ($start_call_url =~ /--A--list_name--B--/) ) || ( (length($list_description) < 1) && ($start_call_url =~ /--A--list_description--B--/) ) ) ) { $stmtH = "SELECT list_name,list_description FROM vicidial_lists where list_id='$VAR_list_id';"; $sthA = $dbhA->prepare($stmtH) or die "preparing: ",$dbhA->errstr; diff --git a/www/agc/dispo_move_list.php b/www/agc/dispo_move_list.php index 928dacb5..b4e4b70d 100644 --- a/www/agc/dispo_move_list.php +++ b/www/agc/dispo_move_list.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # This script is designed to be used in the "Dispo URL" field of a campaign # or in-group. It should take in the lead_id to check for the same lead_id @@ -18,6 +18,10 @@ # Example of what to put in the Dispo URL field: # VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=10411099&sale_status=SALE---SSALE---XSALE&reset_dialed=Y&log_to_file=1 # +# Example of what to put in the No Agent Call URL field: +# (user needs to be NOAGENTURL and pass needs to be set to the call_id) +# VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&user=NOAGENTURL&pass=--A--call_id--B--&new_list_id=10411099&sale_status=SALE---SSALE---XSALE&reset_dialed=Y&log_to_file=1 +# # Definable Fields: (other fields should be left as they are) # - log_to_file - (0,1) if set to 1, will create a log file in the agc directory # - sale_status - (SALE---XSALE) a triple-dash "---" delimited list of the statuses that are to be moved @@ -37,6 +41,7 @@ # 140811-0844 - Changed to use QXZ function for echoing text # 141118-1235 - Formatting changes for QXZ output # 141216-2110 - Added language settings lookups and user/pass variable standardization +# 150703-1453 - Added options so it would work with No-Agent Call URL # $api_script = 'deactivate'; @@ -168,18 +173,46 @@ if ($match_found > 0) $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); $server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip); - $auth=0; - $auth_message = user_authorization($user,$pass,'',0,0,0); - if ($auth_message == 'GOOD') - {$auth=1;} + if (preg_match("/NOAGENTURL/",$user)) + { + $PADlead_id = sprintf("%010s", $lead_id); + if ( (strlen($pass) > 15) and (preg_match("/$PADlead_id$/",$pass)) ) + { + $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); - $stmt="SELECT count(*) from vicidial_live_agents where user='$user';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_to_mysqli($stmt, $link); - $row=mysqli_fetch_row($rslt); - $authlive=$row[0]; + $stmt="SELECT count(*) from vicidial_log_extended where caller_code='$pass' and call_date > \"$four_hours_ago\";"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $authlive=$row[0]; + $auth=$row[0]; + if ($authlive < 1) + { + echo _QXZ("Call Not Found:")." 2|$user|$pass|$authlive|\n"; + exit; + } + } + else + { + echo _QXZ("Invalid Call ID:")." 1|$user|$pass|$PADlead_id|\n"; + exit; + } + } + else + { + $auth=0; + $auth_message = user_authorization($user,$pass,'',0,0,0); + if ($auth_message == 'GOOD') + {$auth=1;} - if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ($authlive==0)) + $stmt="SELECT count(*) from vicidial_live_agents where user='$user';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $authlive=$row[0]; + } + + if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ($authlive==0)) { echo _QXZ("Invalid Username/Password:")." |$user|$pass|$auth|$authlive|$auth_message|\n"; exit;