From de3f459814c7ed6c9431977d390dbc7bd3b4d06b Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 27 Aug 2009 05:51:50 +0000 Subject: [PATCH] rewrote script handling in the agent interface small bug fixes git-svn-id: svn://192.168.202.10@1209 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 1 + agc_2-X/trunk/agi/agi-DID_route.agi | 31 +- agc_2-X/trunk/bin/ADMIN_audio_store_sync.pl | 4 +- agc_2-X/trunk/bin/AST_VDsales_export.pl | 52 ++- agc_2-X/trunk/www/agc/vdc_script_display.php | 355 +++++++++++++++++++ agc_2-X/trunk/www/agc/vicidial.php | 147 +++++--- agc_2-X/trunk/www/vicidial/AST_IVRstats.php | 2 + agc_2-X/trunk/www/vicidial/admin.php | 6 + 8 files changed, 511 insertions(+), 87 deletions(-) create mode 100644 agc_2-X/trunk/www/agc/vdc_script_display.php diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 6a70b6dd..6f529f35 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -201,6 +201,7 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom 50. Changed voicemail config to use phone password as voicemail password instead of just the voicemail ID as the password +51. Rewrote how scripts are displayed in the ViciDial agent interface diff --git a/agc_2-X/trunk/agi/agi-DID_route.agi b/agc_2-X/trunk/agi/agi-DID_route.agi index 1cdeedaf..d81adffa 100644 --- a/agc_2-X/trunk/agi/agi-DID_route.agi +++ b/agc_2-X/trunk/agi/agi-DID_route.agi @@ -18,6 +18,7 @@ # 90117-0756 - Added vicidial_did_log logging to database # 90214-0217 - Added 'default' did option, to send all non-matching calls to, enforced did_active setting # 90507-1145 - Added CALLMENU option +# 90825-2252 - Changed PHONE to route using dialplan number # $script = 'agi-DID_route.agi'; @@ -264,30 +265,18 @@ if ($did_route =~ /PHONE/) } $sthA->finish(); - if ($protocol =~ /EXTERNAL/) + ### format the remote server dialstring to get the call to the overflow agent meetme room + if( $did_server_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) { - ### format the remote server dialstring to get the call to the overflow agent meetme room - if( $did_server_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) - { - $a = leading_zero($1); - $b = leading_zero($2); - $c = leading_zero($3); - $d = leading_zero($4); - $ServerString = "$a$S$b$S$c$S$d$S"; - } - - $did_extension = "$ServerString$dialplan_number"; - $did_route = 'EXTEN'; + $a = leading_zero($1); + $b = leading_zero($2); + $c = leading_zero($3); + $d = leading_zero($4); + $ServerString = "$a$S$b$S$c$S$d$S"; } - else - { - #$AGI->exec("Dial", "$protocol/$phone|30"); - print "EXEC Dial \"$protocol/$phone|30\"\n"; - checkresult($result); - if ($AGILOG) {$agi_string = "Done dialing $protocol/$phone |$result|$pass|$fail|$stmtA|"; &agi_output;} - exit; - } + $did_extension = "$ServerString$dialplan_number"; + $did_route = 'EXTEN'; } diff --git a/agc_2-X/trunk/bin/ADMIN_audio_store_sync.pl b/agc_2-X/trunk/bin/ADMIN_audio_store_sync.pl index 8aaf26a8..a5af4e8f 100644 --- a/agc_2-X/trunk/bin/ADMIN_audio_store_sync.pl +++ b/agc_2-X/trunk/bin/ADMIN_audio_store_sync.pl @@ -200,7 +200,7 @@ else else { print "Can't find wget binary! Exiting...\n"; - exit + exit; } } } @@ -217,7 +217,7 @@ else else { print "Can't find curl binary! Exiting...\n"; - exit + exit; } } } diff --git a/agc_2-X/trunk/bin/AST_VDsales_export.pl b/agc_2-X/trunk/bin/AST_VDsales_export.pl index 8c90eee6..215b792a 100644 --- a/agc_2-X/trunk/bin/AST_VDsales_export.pl +++ b/agc_2-X/trunk/bin/AST_VDsales_export.pl @@ -23,6 +23,7 @@ # 90721-1314 - Added rank and owner as vicidial_list fields # 90731-0555 - Added call time scheme restriction # 90807-1632 - Fixed call time bug and call length bug +# 90825-1249 - Added without-camp and without-in options # $txt = '.txt'; @@ -96,10 +97,12 @@ if (length($ARGV[0])>1) print " [--date=YYYY-MM-DD] = date override\n"; print " [--filename=XXX] = Name to be used for file\n"; print " [--campaign=XXX] = Campaign that sales will be pulled from\n"; + print " [--without-camp=XXX] = Campaign that will be excluded from ALL\n"; print " [--sale-statuses=XXX-XXY] = Statuses that are deemed to be \"Sales\". Default SALE\n"; print " NOTE: To include all statuses in the export, use \"--sale-statuses=---ALL---\"\n"; print " [--output-format=XXX] = Format of file. Default \"pipe-standard\"\n"; print " [--with-inbound=XXX-XXY] = include the following inbound groups\n"; + print " [--without-in=XXX-XXY] = inbound groups that will be excluded from ALL\n"; print " [--calltime=XXX] = filter results to only include those calls during this call time\n"; print " [--ftp-transfer] = Send results file by FTP to another server\n"; print " [--ftp-audio-transfer] = Send associated audio files to FTP server, dated directories\n"; @@ -183,6 +186,19 @@ if (length($ARGV[0])>1) } $campaignSQL = "'$campaignSQL'"; } + if ($args =~ /--without-camp=/i) + { + # print "\n|$ARGS|\n\n"; + @data_in = split(/--without-camp=/,$args); + $NOTcampaign = $data_in[1]; + $NOTcampaign =~ s/ .*$//gi; + $NOTcampaignSQL = $NOTcampaign; + if ($NOTcampaignSQL =~ /-/) + { + $NOTcampaignSQL =~ s/-/','/gi; + } + $NOTcampaignSQL = "'$NOTcampaignSQL'"; + } if ($args =~ /--filename=/i) { # print "\n|$ARGS|\n\n"; @@ -214,6 +230,12 @@ if (length($ARGV[0])>1) $with_inbound = $data_in[1]; $with_inbound =~ s/ .*$//gi; } + if ($args =~ /--without-in=/i) + { + @data_in = split(/--without-in=/,$args); + $NOTwith_inbound = $data_in[1]; + $NOTwith_inbound =~ s/ .*$//gi; + } if ($args =~ /--calltime=/i) { # print "\n|$ARGS|\n\n"; @@ -398,12 +420,32 @@ else $close_statusesSQL = " and vicidial_closer_log.status IN($close_statusesSQL)"; } -$with_inboundSQL = $with_inbound; -$with_inboundSQL =~ s/-/','/gi; -$with_inboundSQL = "'$with_inboundSQL'"; + +if (length($with_inbound) < 2) + { + if (length($NOTwith_inbound) < 2) + {$with_inboundSQL = '';} + else + { + $with_inboundSQL = $NOTwith_inbound; + $with_inboundSQL =~ s/-/','/gi; + $with_inboundSQL = "vicidial_closer_log.campaign_id NOT IN('$with_inboundSQL')"; + } + } +else + { + $with_inboundSQL = $with_inbound; + $with_inboundSQL =~ s/-/','/gi; + $with_inboundSQL = "vicidial_closer_log.campaign_id IN('$with_inboundSQL')"; + } if (length($campaignSQL) < 2) - {$campaignSQL = "vicidial_log.campaign_id NOT IN('')";} + { + if (length($NOTcampaignSQL) < 2) + {$campaignSQL = "vicidial_log.campaign_id NOT IN('')";} + else + {$campaignSQL = "vicidial_log.campaign_id NOT IN($NOTcampaignSQL)";} + } else {$campaignSQL = "vicidial_log.campaign_id IN($campaignSQL)";} @@ -535,7 +577,7 @@ if (length($with_inboundSQL)>3) ########################################################################### ########### CURRENT DAY SALES GATHERING inbound-only: vicidial_closer_log ###### ########################################################################### - $stmtA = "select vicidial_closer_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,vicidial_list.email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_closer_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_closer_log.list_id,campaign_id,title,address3,last_local_call_time,xfercallid,closecallid,uniqueid,length_in_sec,queue_seconds,vicidial_list.list_id,vicidial_list.list_id,UNIX_TIMESTAMP(vicidial_closer_log.call_date),agent_alert_delay from vicidial_list,vicidial_closer_log,vicidial_users,vicidial_inbound_groups where campaign_id IN($with_inboundSQL) $close_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_closer_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_closer_log.user and vicidial_inbound_groups.group_id=vicidial_closer_log.campaign_id order by call_date;"; + $stmtA = "select vicidial_closer_log.user,first_name,last_name,address1,address2,city,state,postal_code,vicidial_list.phone_number,vicidial_list.email,security_phrase,vicidial_list.comments,call_date,vicidial_list.lead_id,vicidial_users.full_name,vicidial_closer_log.status,vicidial_list.vendor_lead_code,vicidial_list.source_id,vicidial_closer_log.list_id,campaign_id,title,address3,last_local_call_time,xfercallid,closecallid,uniqueid,length_in_sec,queue_seconds,vicidial_list.list_id,vicidial_list.list_id,UNIX_TIMESTAMP(vicidial_closer_log.call_date),agent_alert_delay from vicidial_list,vicidial_closer_log,vicidial_users,vicidial_inbound_groups where $with_inboundSQL $close_statusesSQL and call_date > '$shipdate 00:00:01' and call_date < '$shipdate 23:59:59' and vicidial_closer_log.lead_id=vicidial_list.lead_id and vicidial_users.user=vicidial_closer_log.user and vicidial_inbound_groups.group_id=vicidial_closer_log.campaign_id order by call_date;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; diff --git a/agc_2-X/trunk/www/agc/vdc_script_display.php b/agc_2-X/trunk/www/agc/vdc_script_display.php new file mode 100644 index 00000000..f7a8eccd --- /dev/null +++ b/agc_2-X/trunk/www/agc/vdc_script_display.php @@ -0,0 +1,355 @@ + LICENSE: AGPLv2 +# +# This script is designed display the contents of the SCRIPT tab in the agent interface +# +# CHANGELOG: +# 90824-1435 - First build of script +# + +$version = '2.2.0-1'; +$build = '90824-1435'; + +require("dbconnect.php"); + + +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} + $vendor_lead_code = $vendor_id; +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];} + elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];} +if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];} + elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["title"])) {$title=$_GET["title"];} + elseif (isset($_POST["title"])) {$title=$_POST["title"];} +if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} +if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];} + elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];} +if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} + elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} +if (isset($_GET["address1"])) {$address1=$_GET["address1"];} + elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];} +if (isset($_GET["address2"])) {$address2=$_GET["address2"];} + elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];} +if (isset($_GET["address3"])) {$address3=$_GET["address3"];} + elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];} +if (isset($_GET["city"])) {$city=$_GET["city"];} + elseif (isset($_POST["city"])) {$city=$_POST["city"];} +if (isset($_GET["state"])) {$state=$_GET["state"];} + elseif (isset($_POST["state"])) {$state=$_POST["state"];} +if (isset($_GET["province"])) {$province=$_GET["province"];} + elseif (isset($_POST["province"])) {$province=$_POST["province"];} +if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];} + elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];} +if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];} + elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];} +if (isset($_GET["gender"])) {$gender=$_GET["gender"];} + elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];} +if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];} + elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];} +if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];} + elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];} +if (isset($_GET["email"])) {$email=$_GET["email"];} + elseif (isset($_POST["email"])) {$email=$_POST["email"];} +if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];} + elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];} +if (isset($_GET["comments"])) {$comments=$_GET["comments"];} + elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["pass"])) {$pass=$_GET["pass"];} + elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];} + elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];} +if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];} + elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];} +if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];} + elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];} +if (isset($_GET["closer"])) {$closer=$_GET["closer"];} + elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} + elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} +if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];} + elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];} +if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} + elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} +if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];} + elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];} +if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];} + elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];} +if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];} + elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];} +if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} + elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} +if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];} + elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];} +if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];} + elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];} +if (isset($_GET["phone"])) {$phone=$_GET["phone"];} + elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];} +if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} + elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} +if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];} + elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];} +if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];} + elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];} +if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];} + elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];} +if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];} + elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];} +if (isset($_GET["rank"])) {$rank=$_GET["rank"];} + elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];} +if (isset($_GET["owner"])) {$owner=$_GET["owner"];} + elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];} +if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];} + elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];} +if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];} + elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];} +if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];} + elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];} +if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];} + elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];} +if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];} + elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];} +if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];} + elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];} + +header ("Content-type: text/html; charset=utf-8"); +header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header ("Pragma: no-cache"); // HTTP/1.0 + +$txt = '.txt'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +$MT[0]=''; +$agents='@agents'; + +$IFRAME=0; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $timeclock_end_of_day = $row[1]; + $agentonly_callback_campaign_lock = $row[2]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $user=ereg_replace("[^-_0-9a-zA-Z]","",$user); + $pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass); + $length_in_sec = ereg_replace("[^0-9]","",$length_in_sec); + $phone_code = ereg_replace("[^0-9]","",$phone_code); + $phone_number = ereg_replace("[^0-9]","",$phone_number); + } +else + { + $user = ereg_replace("'|\"|\\\\|;","",$user); + $pass = ereg_replace("'|\"|\\\\|;","",$pass); + } + + +# default optional vars if not set +if (!isset($format)) {$format="text";} + if ($format == 'debug') {$DB=1;} +if (!isset($ACTION)) {$ACTION="refresh";} +if (!isset($query_date)) {$query_date = $NOW_DATE;} + +$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;"; +if ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + +if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) + { + echo "Invalid Username/Password: |$user|$pass|\n"; + exit; + } +else + { + # do nothing for now + } + +if ($format=='debug') + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "VICIDiaL Script Display Script"; + echo "\n"; + echo "\n"; + echo "\n"; + } + +if (strlen($in_script) < 1) + {$call_script = $camp_script;} +else + {$call_script = $in_script;} + +$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$script_name = $row[0]; +$script_text = stripslashes($row[1]); + +if (eregi("iframe src",$script_text)) + { + $IFRAME=1; + $lead_id = eregi_replace(' ','+',$lead_id); + $vendor_id = eregi_replace(' ','+',$vendor_id); + $vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code); + $list_id = eregi_replace(' ','+',$list_id); + $gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now); + $phone_code = eregi_replace(' ','+',$phone_code); + $phone_number = eregi_replace(' ','+',$phone_number); + $title = eregi_replace(' ','+',$title); + $first_name = eregi_replace(' ','+',$first_name); + $middle_initial = eregi_replace(' ','+',$middle_initial); + $last_name = eregi_replace(' ','+',$last_name); + $address1 = eregi_replace(' ','+',$address1); + $address2 = eregi_replace(' ','+',$address2); + $address3 = eregi_replace(' ','+',$address3); + $city = eregi_replace(' ','+',$city); + $state = eregi_replace(' ','+',$state); + $province = eregi_replace(' ','+',$province); + $postal_code = eregi_replace(' ','+',$postal_code); + $country_code = eregi_replace(' ','+',$country_code); + $gender = eregi_replace(' ','+',$gender); + $date_of_birth = eregi_replace(' ','+',$date_of_birth); + $alt_phone = eregi_replace(' ','+',$alt_phone); + $email = eregi_replace(' ','+',$email); + $security_phrase = eregi_replace(' ','+',$security_phrase); + $comments = eregi_replace(' ','+',$comments); + $user = eregi_replace(' ','+',$user); + $pass = eregi_replace(' ','+',$pass); + $campaign = eregi_replace(' ','+',$campaign); + $phone_login = eregi_replace(' ','+',$phone_login); + $phone_pass = eregi_replace(' ','+',$phone_pass); + $fronter = eregi_replace(' ','+',$fronter); + $closer = eregi_replace(' ','+',$closer); + $group = eregi_replace(' ','+',$group); + $channel_group = eregi_replace(' ','+',$channel_group); + $SQLdate = eregi_replace(' ','+',$SQLdate); + $epoch = eregi_replace(' ','+',$epoch); + $uniqueid = eregi_replace(' ','+',$uniqueid); + $customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel); + $customer_server_ip = eregi_replace(' ','+',$customer_server_ip); + $server_ip = eregi_replace(' ','+',$server_ip); + $SIPexten = eregi_replace(' ','+',$SIPexten); + $session_id = eregi_replace(' ','+',$session_id); + $phone = eregi_replace(' ','+',$phone); + $parked_by = eregi_replace(' ','+',$parked_by); + $dispo = eregi_replace(' ','+',$dispo); + $dialed_number = eregi_replace(' ','+',$dialed_number); + $dialed_label = eregi_replace(' ','+',$dialed_label); + $source_id = eregi_replace(' ','+',$source_id); + $rank = eregi_replace(' ','+',$rank); + $owner = eregi_replace(' ','+',$owner); + $camp_script = eregi_replace(' ','+',$camp_script); + $in_script = eregi_replace(' ','+',$in_script); + $script_width = eregi_replace(' ','+',$script_width); + $script_height = eregi_replace(' ','+',$script_height); + $fullname = eregi_replace(' ','+',$fullname); + } + +$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text); +$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text); +$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text); +$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text); +$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text); +$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text); +$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text); +$script_text = eregi_replace('--A--title--B--',"$title",$script_text); +$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text); +$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text); +$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text); +$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text); +$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text); +$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text); +$script_text = eregi_replace('--A--city--B--',"$city",$script_text); +$script_text = eregi_replace('--A--state--B--',"$state",$script_text); +$script_text = eregi_replace('--A--province--B--',"$province",$script_text); +$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text); +$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text); +$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text); +$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text); +$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text); +$script_text = eregi_replace('--A--email--B--',"$email",$script_text); +$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text); +$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text); +$script_text = eregi_replace('--A--user--B--',"$user",$script_text); +$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text); +$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text); +$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text); +$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text); +$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text); +$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text); +$script_text = eregi_replace('--A--group--B--',"$group",$script_text); +$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text); +$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text); +$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text); +$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text); +$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text); +$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text); +$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text); +$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text); +$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text); +$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text); +$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text); +$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text); +$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text); +$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text); +$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text); +$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text); +$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text); +$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text); +$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text); +$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text); +$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text); +$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text); +$script_text = eregi_replace("\n","
",$script_text); +$script_text = stripslashes($script_text); + + +echo "\n"; +echo "\n"; +echo "
\n"; +if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) + { echo "
";} +echo "
$script_name
\n"; +echo "$script_text\n"; +if ( ($IFRAME < 1) and ($ScrollDIV > 0) ) + { echo "
";} +echo "
\n"; + +exit; + +?> diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index ea69817a..e4d6342f 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -7,6 +7,7 @@ # - vdc_db_query.php: Updates information in the database # - manager_send.php: Sends manager actions to the DB for execution # - conf_exten_check.php: time sync and status updater, calls in queue +# - vdc_script_display.php: displays script with variables # # CHANGELOG # 50607-1426 - First Build of VICIDIAL web client basic login process finished @@ -246,10 +247,11 @@ # 90808-0117 - Fixed manual dial calls today bug, added last_state_change to vicidial_live_agents # 90812-0046 - Added no-delete-sessions = 1 as default, unused sessions cleared out at timeclock end of day # 90814-0829 - Moved mute button next to hotkeys button +# 90827-0133 - Reworked Script display code # -$version = '2.2.0-224'; -$build = '90814-0829'; +$version = '2.2.0-225'; +$build = '90827-0133'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=61; $one_mysql_log=0; @@ -2028,7 +2030,7 @@ else $server_ip_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S"; ##### grab the datails of all active scripts in the system - $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; + $stmt="SELECT script_id,script_name FROM vicidial_scripts WHERE active='Y' order by script_id limit 1000;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01051',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2039,17 +2041,12 @@ else $row=mysql_fetch_row($rslt); $MMscriptid[$e] =$row[0]; $MMscriptname[$e] = urlencode($row[1]); - $row[2] = stripslashes($row[2]); - $MMscripttext[$e] = urlencode($row[2]); $MMscriptids = "$MMscriptids'$MMscriptid[$e]',"; $MMscriptnames = "$MMscriptnames'$MMscriptname[$e]',"; - $MMscripttexts = "$MMscripttexts'$MMscripttext[$e]',"; $e++; } $MMscriptids = substr("$MMscriptids", 0, -1); $MMscriptnames = substr("$MMscriptnames", 0, -1); - $MMscripttexts = substr("$MMscripttexts", 0, -1); - } } @@ -2240,10 +2237,10 @@ $CCAL_OUT .= ""; var hotkeys = new Array(); $h) - { - echo "hotkeys['$HKhotkey[$h]'] = \"$HKstatus[$h] ----- $HKstatus_name[$h]\";\n"; - $h++; - } + { + echo "hotkeys['$HKhotkey[$h]'] = \"$HKstatus[$h] ----- $HKstatus_name[$h]\";\n"; + $h++; + } ?> var HKdispo_display = 0; var HKbutton_allowed = 1; @@ -2251,18 +2248,10 @@ $CCAL_OUT .= ""; var scriptnames = new Array(); $h) - { - echo "scriptnames['$MMscriptid[$h]'] = \"$MMscriptname[$h]\";\n"; - $h++; - } - ?> - var scripttexts = new Array(); - $h) - { - echo "scripttexts['$MMscriptid[$h]'] = \"$MMscripttext[$h]\";\n"; - $h++; - } + { + echo "scriptnames['$MMscriptid[$h]'] = \"$MMscriptname[$h]\";\n"; + $h++; + } ?> var decoded = ''; var view_scripts = ''; @@ -2516,6 +2505,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var agent_dial_owner_only = ''; var agent_display_dialable_leads = ''; var no_empty_session_warnings = ''; + var script_width = ''; + var script_height = ''; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -4655,6 +4646,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} "&owner=" + document.vicidial_form.owner.value + '' + "&camp_script=" + campaign_script + '' + "&in_script=" + CalL_ScripT_id + '' + + "&script_width=" + script_width + '' + + "&script_height=" + script_height + '' + + "&fullname=" + LOGfullname + '' + webform_session; var regWFspace = new RegExp(" ","ig"); @@ -4698,16 +4692,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if ( (view_scripts == 1) && (campaign_script.length > 0) ) { - // test code for scripts output - URLDecode(scriptnames[campaign_script],'NO'); - var textname = decoded; - URLDecode(scripttexts[campaign_script],'YES'); - var texttext = decoded; - var regWFplus = new RegExp("\\+","ig"); - textname = textname.replace(regWFplus, ' '); - texttext = texttext.replace(regWFplus, ' '); - var testscript = "" + textname + "\n\n

\n\n" + texttext; - document.getElementById("ScriptContents").innerHTML = testscript; + load_script_contents(); } if (get_call_launch == 'SCRIPT') @@ -4999,16 +4984,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if ( (view_scripts == 1) && (campaign_script.length > 0) ) { - // test code for scripts output - URLDecode(scriptnames[campaign_script],'NO'); - var textname = decoded; - URLDecode(scripttexts[campaign_script],'YES'); - var texttext = decoded; - var regWFplus = new RegExp("\\+","ig"); - textname = textname.replace(regWFplus, ' '); - texttext = texttext.replace(regWFplus, ' '); - var testscript = "" + textname + "\n\n

\n\n" + texttext; - document.getElementById("ScriptContents").innerHTML = testscript; + load_script_contents(); } if (get_call_launch == 'SCRIPT') @@ -5193,7 +5169,50 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // ################################################################################ -// Check to see if there is a call being sent from the auto-dialer to agent conf +// pull the script contents sending the webform variables to the script display script + function load_script_contents() + { + var new_script_content = null; + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + NeWscript_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ScrollDIV=1&" + web_form_vars; + xmlhttp.open('POST', 'vdc_script_display.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(NeWscript_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + new_script_content = xmlhttp.responseText; + document.getElementById("ScriptContents").innerHTML = new_script_content; + } + } + delete xmlhttp; + } + } + + +// ################################################################################ +// Alternate phone number change function alt_phone_change(APCphone,APCcount,APCleadID,APCactive) { @@ -5614,6 +5633,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} "&owner=" + document.vicidial_form.owner.value + '' + "&camp_script=" + campaign_script + '' + "&in_script=" + CalL_ScripT_id + '' + + "&script_width=" + script_width + '' + + "&script_height=" + script_height + '' + + "&fullname=" + LOGfullname + '' + webform_session; var regWFspace = new RegExp(" ","ig"); @@ -5639,16 +5661,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if ( (view_scripts == 1) && (CalL_ScripT_id.length > 0) ) { - // test code for scripts output - URLDecode(scriptnames[CalL_ScripT_id],'NO'); - var textname = decoded; - URLDecode(scripttexts[CalL_ScripT_id],'YES'); - var texttext = decoded; - var regWFplus = new RegExp("\\+","ig"); - textname = textname.replace(regWFplus, ' '); - texttext = texttext.replace(regWFplus, ' '); - var testscript = "" + textname + "\n\n

\n\n" + texttext; - document.getElementById("ScriptContents").innerHTML = testscript; + load_script_contents(); } if (CalL_AutO_LauncH == 'SCRIPT') @@ -5764,6 +5777,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} "&owner=" + document.vicidial_form.owner.value + '' + "&camp_script=" + campaign_script + '' + "&in_script=" + CalL_ScripT_id + '' + + "&script_width=" + script_width + '' + + "&script_height=" + script_height + '' + + "&fullname=" + LOGfullname + '' + webform_session; var regWFspace = new RegExp(" ","ig"); @@ -7188,12 +7204,15 @@ encoded=utf8_decode(xtest); var SCserver_ip = server_ip; var SCSIPexten = extension; var SCsession_id = session_id; + var SCdispo = LeaDDispO; var SCdialed_number = dialed_number; var SCdialed_label = dialed_label; var SCrank = document.vicidial_form.rank.value; var SCowner = document.vicidial_form.owner.value; var SCcamp_script = campaign_script; var SCin_script = CalL_ScripT_id; + var SCscript_width = script_width; + var SCscript_height = script_height; var SCweb_vars = LIVE_web_vars; if (encoded.match(RGiframe)) @@ -7237,12 +7256,15 @@ encoded=utf8_decode(xtest); SCcustomer_zap_channel = SCcustomer_zap_channel.replace(RGplus,'+'); SCserver_ip = SCserver_ip.replace(RGplus,'+'); SCSIPexten = SCSIPexten.replace(RGplus,'+'); + SCdispo = SCdispo.replace(RGplus,'+'); SCdialed_number = SCdialed_number.replace(RGplus,'+'); SCdialed_label = SCdialed_label.replace(RGplus,'+'); SCrank = SCrank.replace(RGplus,'+'); SCowner = SCowner.replace(RGplus,'+'); SCcamp_script = SCcamp_script.replace(RGplus,'+'); SCin_script = SCin_script.replace(RGplus,'+'); + SCscript_width = SCscript_width.replace(RGplus,'+'); + SCscript_height = SCscript_height.replace(RGplus,'+'); SCweb_vars = SCweb_vars.replace(RGplus,'+'); } @@ -7287,12 +7309,15 @@ encoded=utf8_decode(xtest); var RGserver_ip = new RegExp("--A--server_ip--B--","g"); var RGSIPexten = new RegExp("--A--SIPexten--B--","g"); var RGsession_id = new RegExp("--A--session_id--B--","g"); + var RGdispo = new RegExp("--A--dispo--B--","g"); var RGdialed_number = new RegExp("--A--dialed_number--B--","g"); var RGdialed_label = new RegExp("--A--dialed_label--B--","g"); var RGrank = new RegExp("--A--rank--B--","g"); var RGowner = new RegExp("--A--owner--B--","g"); var RGcamp_script = new RegExp("--A--camp_script--B--","g"); var RGin_script = new RegExp("--A--in_script--B--","g"); + var RGscript_width = new RegExp("--A--script_width--B--","g"); + var RGscript_height = new RegExp("--A--script_height--B--","g"); var RGweb_vars = new RegExp("--A--web_vars--B--","g"); encoded = encoded.replace(RGvendor_lead_code, SCvendor_lead_code); @@ -7336,12 +7361,15 @@ encoded=utf8_decode(xtest); encoded = encoded.replace(RGserver_ip, SCserver_ip); encoded = encoded.replace(RGSIPexten, SCSIPexten); encoded = encoded.replace(RGsession_id, SCsession_id); + encoded = encoded.replace(RGdispo, SCdispo); encoded = encoded.replace(RGdialed_number, SCdialed_number); encoded = encoded.replace(RGdialed_label, SCdialed_label); encoded = encoded.replace(RGrank, SCrank); encoded = encoded.replace(RGowner, SCowner); encoded = encoded.replace(RGcamp_script, SCcamp_script); encoded = encoded.replace(RGin_script, SCin_script); + encoded = encoded.replace(RGscript_width, SCscript_width); + encoded = encoded.replace(RGscript_height, SCscript_height); encoded = encoded.replace(RGweb_vars, SCweb_vars); } decoded=encoded; // simple no ? @@ -8623,7 +8651,8 @@ else