diff --git a/UPGRADE b/UPGRADE index 3a0ae72d..7323a219 100644 --- a/UPGRADE +++ b/UPGRADE @@ -67,13 +67,41 @@ OTHER CHANGES: 4. Added several security changes to the admin interface, including freezing a user's account for 15 minutes after 10 failed login attempts. -5. Added 3 new reports to the admin interface: url log, lagged log and - user group login reports +5. Added 4 new reports to the admin interface: url log, lagged log, user group + login and dial log reports 6. Added new AST_phone_update.pl --agent-lookup flag to allow for logging of the IP address of the agent's SIP or IAX phone connection. Can be enabled as a crontab entry to perform the lookups on each asterisk server. +7. Added optional encrypted passwords capability within the system. If enabled, + all user passwords must be converted to encrypted passwords. To use this + you need to have this CPAN module installed on your web servers: + + cpan> install Crypt::Eksblowfish::Bcrypt + + To enable, first go to the Admin -> System Settings page and manually + confirm that Password Encryption is DISABLED (fifth item from the top) + + Then, just run the following CLI script: (run in test mode first!) + /usr/share/astguiclient/ADMIN_bcrypt_convert.pl --debugX --test + + For more information on Encrypted Passwords, read the + ENCRYPTED_PASSWORDS.txt document in the docs directory + +8. If you are using the agi-phone_monitor script for agent monitoring, then + the following dialplan lines need to be added to the same place where + you put the original dialplan additions necessary for this feature + to work: (it is shown in context in the 2.6 upgrade instructions below) + + ; quiet entry, listen-only, exit-on-dtmf conferences for VICIDIAL (listen) + exten => _588600XXX,1,Dial(${TRUNKblind}/56${EXTEN:2},55) + exten => _588600XXX,n,Hangup() + + ; barge, exit-on-dtmf conferences for VICIDIAL (barge) + exten => _598600XXX,1,Dial(${TRUNKblind}/57${EXTEN:2},55) + exten => _598600XXX,n,Hangup() + @@ -270,6 +298,14 @@ OTHER CHANGES: exten => _578600XXX,n,Meetme(${EXTEN:2},X) exten => _578600XXX,n,Hangup() + ; quiet entry, listen-only, exit-on-dtmf conferences for VICIDIAL (listen) + exten => _588600XXX,1,Dial(${TRUNKblind}/56${EXTEN:2},55) + exten => _588600XXX,n,Hangup() + + ; barge, exit-on-dtmf conferences for VICIDIAL (barge) + exten => _598600XXX,1,Dial(${TRUNKblind}/57${EXTEN:2},55) + exten => _598600XXX,n,Hangup() + [up_monitor] exten => h,1,AGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}) diff --git a/agi/agi-phone_monitor.agi b/agi/agi-phone_monitor.agi index 620fdcd2..04bd002b 100644 --- a/agi/agi-phone_monitor.agi +++ b/agi/agi-phone_monitor.agi @@ -28,6 +28,7 @@ # CHANGELOG # 130401-0724 - First build # 130520-1013 - Added PLOGIN lookup option and no-prompt extension feature +# 130710-1658 - Small change to allow non-hangup between agent calls # &get_time_now; @@ -373,9 +374,9 @@ else # use double-star prefix to go through native bridge IAX path $VDADremDIALstr = "$S$S$a$S$b$S$c$S$d$S"; } - $barge_listen_prefix = '56'; + $barge_listen_prefix = '58'; if($barge_listen =~ /BARGE/) - {$barge_listen_prefix = '57';} + {$barge_listen_prefix = '59';} $VDADremDIALstr .= "$barge_listen_prefix$VDADconf_exten"; if ($api_log =~ /Y/) diff --git a/bin/ADMIN_bcrypt_convert.pl b/bin/ADMIN_bcrypt_convert.pl new file mode 100644 index 00000000..81c9f1d0 --- /dev/null +++ b/bin/ADMIN_bcrypt_convert.pl @@ -0,0 +1,306 @@ +#!/usr/bin/perl +# +# ADMIN_bcrypt_convert.pl version 2.8 +# +# Bcrypt password hashing conversion script to be used for authentication +# +# This script is to be run once to convert the plaintext passwords into bcrypt +# password hashes. +# +# IMPORTANT !!!!!!!!!!!!! +# The Crypt::Eksblowfish::Bcrypt perl module is REQUIRED for this script +# +# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# +# +# CHANGES +# +# 130704-2041 - First build +# + +$T=0; +$update_override=0; +$clear_plaintext_pass=0; +$DB=1; +$DBX=0; + +use DBI; +use Crypt::Eksblowfish::Bcrypt qw(en_base64); + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "Bcrypt password hashing conversion script to be used for authentication\n"; + print "IMPORTANT!!! RUN FIRST WITH THE --test FLAG TO MAKE SURE IT WORKS!!!\n"; + print "\n"; + print "allowed run time options:\n"; + print " [--salt=XXX] = overide the system salt\n"; + print " [--cost=XX] = overide the system cost\n"; + print " [--test] = testing mode only, no database updates\n"; + print " [--update-override] = override existing system settings\n"; + print " [--clear-plaintext-pass] = set plaintext passwords to blank while updating users\n"; + print " [--debug] = enable debugging output\n"; + print " [--debugX] = enable extra debugging output\n"; + print " [--help] = this help screen\n"; + print "\n"; + + exit; + } + else + { + if ($args =~ /--debug/i) + { + $DB=1; + if ($DB > 0) {print "\n----- DEBUGGING OUTPUT ENABLED: $DB -----\n";} + } + if ($args =~ /--debugX/i) + { + $DBX=1; + if ($DB > 0) {print "\n----- EXTRA DEBUGGING OUTPUT ENABLED: $DBX -----\n";} + } + if ($args =~ /--test/i) + { + $T=1; + open(testfile, ">/etc/vicidial_bcrypt.test") || die "can't open /etc/vicidial_bcrypt.test: $!\n"; + print testfile "TEST RUN"; + close(testfile); + + if ($DB > 0) {print "\n----- TESTING MODE ENABLED: $T -----\n";} + } + if ($args =~ /--update-override/i) + { + $update_override=1; + if ($DB > 0) {print "\n----- UPDATE OVERRIDE ENABLED: $update_override -----\n";} + } + if ($args =~ /--clear-plaintext-pass/i) + { + $clear_plaintext_pass=1; + if ($DB > 0) {print "\n----- CLEAR PLAINTEXT PASSWORDS: $clear_plaintext_pass -----\n";} + } + if ($args =~ /--salt=/i) + { + @data_in = split(/--salt=/,$args); + $CLIsalt = $data_in[1]; + $CLIsalt =~ s/ .*//gi; + if (length($CLIsalt) eq 16) + { + $newCLIsalt = en_base64($CLIsalt); + if ($DB > 0) + {print "\n----- ENCRYPTING SALT OVERRIDE: $CLIsalt -----\n";} + $CLIsalt = $newCLIsalt; + } + if (length($CLIsalt) ne 22) + { + if ($DB > 0) + {print "\n----- INVALID SALT OVERRIDE, USING DEFAULT: $CLIsalt -----\n\n";} + $CLIsalt = ''; + } + else + { + if ($DB > 0) + {print "\n----- SALT OVERRIDE: $CLIsalt -----\n\n";} + } + } + if ($args =~ /--cost=/i) + { + @data_in = split(/--cost=/,$args); + $CLIcost = $data_in[1]; + $CLIcost =~ s/ .*//gi; + if ($DB > 0) + {print "\n----- COST OVERRIDE: $CLIcost -----\n\n";} + } + } + } +else + { + print "NO INPUT, NOTHING TO DO, EXITING...\n"; + exit; + } +### end parsing run-time options ### + +if ( ($T < 1) && (!-e "/etc/vicidial_bcrypt.test") ) + { + print "YOU MUST RUN THIS IN TEST MODE FIRST, EXITING...\n"; + exit; + } + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +##### Get the settings from system_settings ##### +$stmtA = "SELECT pass_hash_enabled,pass_key,pass_cost FROM system_settings;"; +# print "$stmtA\n"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $pass_hash_enabled = $aryA[0]; + $pass_key = $aryA[1]; + $pass_cost = $aryA[2]; + if (length($pass_key) eq 16) + {$newpass_key = en_base64($pass_key);} + } +$sthA->finish(); +if ($DBX > 0) {print "SYSTEM SETTINGS: |$pass_hash_enabled|$pass_key|$newpass_key|$pass_cost|\n";} + +if ( (length($pass_key) > 15) && ($pass_hash_enabled > 0) && ($update_override < 1) ) + { + print "System already set for encryption. If you still want to run this script you must use the update override flag.\n"; + exit; + } + +if (length($CLIsalt) > 0) + { + if ($DBX > 0) {print "SALT OVERRIDDEN: |$pass_key|$newpass_key|$CLIsalt|\n";} + $salt = $CLIsalt; + } +else + {$salt = $newpass_key;} + +if (length($CLIcost) > 0) + { + if ($DBX > 0) {print "COST OVERRIDDEN: |$pass_cost|$CLIcost|\n";} + $cost = $CLIcost; + } +else + {$cost = $pass_cost;} +while (length($cost) < 2) + {$cost = "0$cost";} + +$stmtA = "SELECT user,pass,full_name from vicidial_users;"; +if($DBX){print STDERR "\n|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$i=0; +while ($sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $user[$i] = $aryA[0]; + $pass[$i] = $aryA[1]; + $full_name[$i] = $aryA[2]; + $only_pass_hash[$i] = ''; + $i++; + } +$sthA->finish(); + +if ($DB > 0) {print "$i USERS FOUND IN YOUR SYSTEM\n";} + + + +# Set the cost to $cost and append a NUL +$settings = '$2a$'.$cost.'$'.$salt; + +if ($DB > 0) {print "STARTING BCRYPT PROCESS\n";} + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl timing of less than one second +($START_s_hires, $START_usec) = gettimeofday(); + +$i=0; +while ($sthArows > $i) + { + # Encrypt it + $pass_hash = Crypt::Eksblowfish::Bcrypt::bcrypt($pass[$i], $settings); + $pass_hash_length = length($pass_hash); + $only_pass_hash[$i] = substr($pass_hash,29,31); + if ($DB > 0) {print "PASS HASH: |$user[$i]|$pass[$i]|$full_name[$i]|$pass_hash_length|$pass_hash|$only_pass_hash[$i]|\n";} + $i++; + } + +($END_s_hires, $END_usec) = gettimeofday(); +$START_time = $START_s_hires . '.' . sprintf("%06s", $START_usec); +$END_time = $END_s_hires . '.' . sprintf("%06s", $END_usec); +$RUN_time = ($END_time - $START_time); +$RUN_time = sprintf("%.6f", $RUN_time); +if ($DBX > 0) + {print "TOTAL bcrypt time: |$RUN_time ($END_time - $START_time)|\n";} + + + +if ($DB > 0) {print "STARTING USER RECORD UPDATES\n";} + +$passSQL=''; +if ($clear_plaintext_pass > 0) + {$passSQL=",pass=''";} + +$TOTALaffected_rows=0; +$i=0; +while ($sthArows > $i) + { + $affected_rows=0; + $stmtA = "UPDATE vicidial_users set pass_hash='$only_pass_hash[$i]' $passSQL where user='$user[$i]';"; + if ($T < 1) + {$affected_rows = $dbhA->do($stmtA);} # or die "Couldn't execute query:|$stmtA|\n"; + $TOTALaffected_rows = ($TOTALaffected_rows + $affected_rows); + + if ($DB > 0) {print "USER UPDATE: |$user[$i]|$pass[$i]|$full_name[$i]|$only_pass_hash[$i]|$affected_rows|\n";} + if ($DBX > 0) {print "SQL: |$stmtA|\n";} + $i++; + } + +if ( ($T < 1) && ($TOTALaffected_rows > 0) ) + { + open(keyfile, ">/etc/vicidial.key") || die "can't open /etc/vicidial.key: $!\n"; + print keyfile "$salt"; + close(keyfile); + + $stmtA = "UPDATE system_settings set pass_hash_enabled='1';"; + $affected_rows = $dbhA->do($stmtA); + if ($DB > 0) {print "BCRYPT SET TO ENABLED ON YOUR SYSTEM: |$affected_rows|$stmtA|\n";} + } + + +if ($DB > 0) {print "BCRYPT PROCESSES COMPLETE: $TOTALaffected_rows USERS UPDATED\n";} + +exit; diff --git a/bin/AST_VDauto_dial.pl b/bin/AST_VDauto_dial.pl index af066d1c..e8e119e6 100644 --- a/bin/AST_VDauto_dial.pl +++ b/bin/AST_VDauto_dial.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDauto_dial.pl version 2.6 +# AST_VDauto_dial.pl version 2.8 # # DESCRIPTION: # Places auto_dial calls on the VICIDIAL dialer system @@ -25,7 +25,7 @@ # It is good practice to keep this program running by placing the associated # KEEPALIVE script running every minute to ensure this program is always running # -# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 # # CHANGELOG: # 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds @@ -111,6 +111,7 @@ # 120831-1503 - Added vicidial_dial_log outbound call logging # 121124-2249 - Added Other Campaign DNC option # 121129-1840 - Fix for issue #600 +# 130706-2024 - Added disable_auto_dial system option # @@ -409,6 +410,7 @@ while($one_day_interval > 0) $alt_log_login = $aryA[4]; $alt_log_pass = $aryA[5]; $tables_use_alt_log_db = $aryA[6]; + $disable_auto_dial = $aryA[7]; } $sthA->finish(); @@ -972,7 +974,7 @@ while($one_day_interval > 0) foreach(@DBIPcampaign) { $calls_placed=0; - if ( ($DBIPdial_method[$user_CIPct] =~ /MANUAL|INBOUND_MAN/) || ($outbound_autodial_active < 1) ) + if ( ($DBIPdial_method[$user_CIPct] =~ /MANUAL|INBOUND_MAN/) || ($outbound_autodial_active < 1) || ($disable_auto_dial > 1) ) { $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: MANUAL DIAL CAMPAIGN, NO DIALING"; &event_logger; diff --git a/bin/AST_VDauto_dial_FILL.pl b/bin/AST_VDauto_dial_FILL.pl index e53363a9..e8fe39c7 100644 --- a/bin/AST_VDauto_dial_FILL.pl +++ b/bin/AST_VDauto_dial_FILL.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDauto_dial_FILL.pl version 2.6 +# AST_VDauto_dial_FILL.pl version 2.8 # # DESCRIPTION: # Places auto_dial calls on the VICIDIAL dialer system across all servers only @@ -34,6 +34,7 @@ # 110922-1203 - Added logging of last calltime to campaign # 120831-1502 - Added vicidial_dial_log outbound call logging # 130227-1604 - Cleanup of staggered code, resetting of variables and arrays +# 130706-2024- Added disable_auto_dial system option # ### begin parsing run-time options ### @@ -285,7 +286,7 @@ while($one_day_interval > 0) $sthA->finish(); ##### Get maximum calls per second that this process can send out - $stmtA = "SELECT outbound_calls_per_second FROM system_settings;"; + $stmtA = "SELECT outbound_calls_per_second,outbound_autodial_active,disable_auto_dial FROM system_settings;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -293,6 +294,8 @@ while($one_day_interval > 0) { @aryA = $sthA->fetchrow_array; $outbound_calls_per_second = $aryA[0]; + $outbound_autodial_active = $aryA[1]; + $disable_auto_dial = $aryA[2]; } $sthA->finish(); @@ -306,133 +309,90 @@ while($one_day_interval > 0) $event_string.="CAMPAIGNS WITH TRUNK SHORTAGE: $camp_counter| TOTAL SHORTAGE: $total_shortage"; &event_logger; - - - ################################################################################## - ##### START LOOP IF THERE ARE BALANCE SERVERS AND THERE ARE SHORTAGES - ################################################################################## - if ( ($balance_servers > 0) && ($camp_counter > 0) ) + if (($outbound_autodial_active < 1) || ($disable_auto_dial > 1) ) { - $camp_CIPct = 0; - foreach(@DBfill_campaign) + $event_string="SYSTEM AUTO-DIAL DISABLED, NO DIALING: |$outbound_autodial_active|$disable_auto_dial|"; + &event_logger; + } + else + { + ################################################################################## + ##### START LOOP IF THERE ARE BALANCE SERVERS AND THERE ARE SHORTAGES + ################################################################################## + if ( ($balance_servers > 0) && ($camp_counter > 0) ) { - $calls_placed=0; - $camp_counter=0; - $DB_balance_fill=0; - $VAC_balance_fill=0; - $AVAIL_balance_servers=0; - $DBfill_tally[$camp_CIPct]=0; - - ### grab the dial_level and multiply by active agents to get your goalcalls - $DBIPadlevel[$camp_CIPct]=0; - $stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code,auto_alt_dial,queue_priority,use_custom_cid FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $rec_count=0; - $active_only=0; - while ($sthArows > $rec_count) + $camp_CIPct = 0; + foreach(@DBfill_campaign) { - @aryA = $sthA->fetchrow_array; - $DBIPdialtimeout[$camp_CIPct] = $aryA[0]; - $DBIPdialprefix[$camp_CIPct] = $aryA[1]; - $DBIPcampaigncid[$camp_CIPct] = $aryA[2]; - $DBIPactive[$camp_CIPct] = $aryA[3]; - $DBIPvdadexten[$camp_CIPct] = $aryA[4]; - $omit_phone_code = $aryA[5]; - $DBIPautoaltdial[$camp_CIPct] = $aryA[6]; - $DBIPqueue_priority[$camp_CIPct] = $aryA[7]; - $DBIPuse_custom_cid[$camp_CIPct] = $aryA[8]; + $calls_placed=0; + $camp_counter=0; + $DB_balance_fill=0; + $VAC_balance_fill=0; + $AVAIL_balance_servers=0; + $DBfill_tally[$camp_CIPct]=0; - if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$camp_CIPct] = 1;} - else {$DBIPomitcode[$camp_CIPct] = 0;} + ### grab the dial_level and multiply by active agents to get your goalcalls + $DBIPadlevel[$camp_CIPct]=0; + $stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code,auto_alt_dial,queue_priority,use_custom_cid FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + $active_only=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBIPdialtimeout[$camp_CIPct] = $aryA[0]; + $DBIPdialprefix[$camp_CIPct] = $aryA[1]; + $DBIPcampaigncid[$camp_CIPct] = $aryA[2]; + $DBIPactive[$camp_CIPct] = $aryA[3]; + $DBIPvdadexten[$camp_CIPct] = $aryA[4]; + $omit_phone_code = $aryA[5]; + $DBIPautoaltdial[$camp_CIPct] = $aryA[6]; + $DBIPqueue_priority[$camp_CIPct] = $aryA[7]; + $DBIPuse_custom_cid[$camp_CIPct] = $aryA[8]; - $rec_count++; - } - $sthA->finish(); + if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$camp_CIPct] = 1;} + else {$DBIPomitcode[$camp_CIPct] = 0;} - $stmtA = "SELECT balance_trunk_fill FROM vicidial_campaign_stats where campaign_id='$DBfill_campaign[$camp_CIPct]';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $DB_balance_fill = $aryA[0]; - } - $sthA->finish(); + $rec_count++; + } + $sthA->finish(); - $stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $VAC_balance_fill = $aryA[0]; - } - $sthA->finish(); - $DBfill_current_balance[$camp_CIPct] = "$VAC_balance_fill"; + $stmtA = "SELECT balance_trunk_fill FROM vicidial_campaign_stats where campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DB_balance_fill = $aryA[0]; + } + $sthA->finish(); - $event_string=" CAMPAIGN: $DBfill_campaign[$camp_CIPct]\n"; - $event_string.="DB_balance_fill: $DB_balance_fill VAC_balance_fill: $VAC_balance_fill\n"; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $VAC_balance_fill = $aryA[0]; + } + $sthA->finish(); + $DBfill_current_balance[$camp_CIPct] = "$VAC_balance_fill"; - $DBfill_needed[$camp_CIPct] = ($DBfill_shortage[$camp_CIPct] - $VAC_balance_fill); - $event_string.="Additional Balance Calls Needed For This Campaign: $DBfill_needed[$camp_CIPct]\n"; + $event_string=" CAMPAIGN: $DBfill_campaign[$camp_CIPct]\n"; + $event_string.="DB_balance_fill: $DB_balance_fill VAC_balance_fill: $VAC_balance_fill\n"; + + $DBfill_needed[$camp_CIPct] = ($DBfill_shortage[$camp_CIPct] - $VAC_balance_fill); + $event_string.="Additional Balance Calls Needed For This Campaign: $DBfill_needed[$camp_CIPct]\n"; - ##### Get a listing of the servers in the campaign that have shortages of trunks - $full_servers='|'; - $full_serversSQL=''; - $stmtA = "SELECT server_ip FROM vicidial_campaign_server_stats where update_time > '$XDSQLdate' and local_trunk_shortage > 0 and campaign_id='$DBfill_campaign[$camp_CIPct]';"; - $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; - $full_servers .= "$aryA[0]|"; - $full_serversSQL .= "'$aryA[0]',"; - $rec_count++; - } - $sthA->finish(); - chop($full_serversSQL); - if (length($full_serversSQL)<6) {$full_serversSQL="''";} - $event_string.="SERVERS WITH TRUNK FULL for $DBfill_campaign[$camp_CIPct]: $full_servers |$full_serversSQL|"; - &event_logger; - - ##### Check if there are any balance-enabled servers outside of the ones with trunk shortage - $stmtA = "SELECT count(*) FROM servers where vicidial_balance_active = 'Y' and server_ip NOT IN($full_serversSQL);"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $AVAIL_balance_servers = $aryA[0]; - } - $sthA->finish(); - - ################################################################################## - ##### CONTINUE IF THERE ARE BALANCE SERVERS AVAILABLE THAT ARE NOT IN TRUNK SHORTAGE - ################################################################################## - if ($AVAIL_balance_servers > 0) - { - $event_string="Balance Servers available: $AVAIL_balance_servers"; - &event_logger; - - $DB_camp_servers=0; - @DB_camp_server_server_ip=@MT; - @DB_camp_server_max_vicidial_trunks=@MT; - @DB_camp_server_balance_trunks_offlimits=@MT; - @DB_camp_server_dedicated_trunks=@MT; - @DB_camp_server_trunk_restriction=@MT; - @DB_NONcamp_server_dedicated_trunks=@MT; - @DB_camp_server_available=@MT; - @DB_camp_server_trunks_to_dial=@MT; - ##### Get the trunk settings for the campaign across all servers - $stmtA = "SELECT server_ip,max_vicidial_trunks,balance_trunks_offlimits,vicidial_balance_rank FROM servers where vicidial_balance_active = 'Y' and server_ip NOT IN($full_serversSQL) order by vicidial_balance_rank desc, server_ip;"; + ##### Get a listing of the servers in the campaign that have shortages of trunks + $full_servers='|'; + $full_serversSQL=''; + $stmtA = "SELECT server_ip FROM vicidial_campaign_server_stats where update_time > '$XDSQLdate' and local_trunk_shortage > 0 and campaign_id='$DBfill_campaign[$camp_CIPct]';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -440,186 +400,203 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DB_camp_server_server_ip[$DB_camp_servers] = $aryA[0]; - $DB_camp_server_max_vicidial_trunks[$DB_camp_servers] = $aryA[1]; - $DB_camp_server_balance_trunks_offlimits[$DB_camp_servers] = $aryA[2]; - $DB_camp_servers++; + $full_servers .= "$aryA[0]|"; + $full_serversSQL .= "'$aryA[0]',"; $rec_count++; } $sthA->finish(); + chop($full_serversSQL); + if (length($full_serversSQL)<6) {$full_serversSQL="''";} + $event_string.="SERVERS WITH TRUNK FULL for $DBfill_campaign[$camp_CIPct]: $full_servers |$full_serversSQL|"; + &event_logger; - - ################################################################################## - ##### LOOP THROUGH SERVERS, CALCULATE TRUNKS FOR EACH FOR THIS CAMPAIGN - ################################################################################## - $server_CIPct = 0; - foreach(@DB_camp_server_server_ip) + ##### Check if there are any balance-enabled servers outside of the ones with trunk shortage + $stmtA = "SELECT count(*) FROM servers where vicidial_balance_active = 'Y' and server_ip NOT IN($full_serversSQL);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) { - $DB_camp_server_dedicated_trunks[$server_CIPct]=0; - $DB_camp_server_trunk_restriction[$server_CIPct]=0; - $DB_NONcamp_server_dedicated_trunks[$server_CIPct]=0; - $SERVER_CAMP_temp_avail[$server_CIPct]=0; - $SERVER_CAMP_temp_tally[$server_CIPct]=0; - ##### Get the campaign-specific trunk settings for the campaign on this server - $stmtA = "SELECT dedicated_trunks,trunk_restriction FROM vicidial_server_trunks where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $DB_camp_server_dedicated_trunks[$server_CIPct] = $aryA[0]; - $DB_camp_server_trunk_restriction[$server_CIPct] = $aryA[1]; - } - $sthA->finish(); + @aryA = $sthA->fetchrow_array; + $AVAIL_balance_servers = $aryA[0]; + } + $sthA->finish(); - ##### Get the campaign-specific dedicated trunks count for other campaigns on this server - $stmtA = "SELECT sum(dedicated_trunks) FROM vicidial_server_trunks where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id NOT IN('$DBfill_campaign[$camp_CIPct]');"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $DB_NONcamp_server_dedicated_trunks[$server_CIPct] = $aryA[0]; - } - $sthA->finish(); - - $VAC_server_camp=0; - $VAC_server_NONcamp=0; - - $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $VAC_server_BALcamp = $aryA[0]; - } - $sthA->finish(); - - $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $VAC_server_camp = $aryA[0]; - } - $sthA->finish(); - - $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id!='$DBfill_campaign[$camp_CIPct]';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) - { - @aryA = $sthA->fetchrow_array; - $VAC_server_NONcamp = $aryA[0]; - } - $sthA->finish(); - - if($DB) {print "VAC CALLS: |$VAC_server_camp|$VAC_server_NONcamp|$VAC_server_BALcamp|\n";} - if($DB) {print "SETTINGS: |$DB_camp_server_dedicated_trunks[$server_CIPct]|$DB_camp_server_max_vicidial_trunks[$server_CIPct]|$DB_camp_server_balance_trunks_offlimits[$server_CIPct]||\n";} - - if ($DB_camp_server_trunk_restriction[$server_CIPct] =~ /MAXIMUM_LIMIT/) - { - $DB_camp_server_available[$server_CIPct] = $DB_camp_server_dedicated_trunks[$server_CIPct]; - } - else - { - $DB_camp_server_available[$server_CIPct] = ( ($DB_camp_server_max_vicidial_trunks[$server_CIPct] - $DB_camp_server_balance_trunks_offlimits[$server_CIPct]) - $DB_NONcamp_server_dedicated_trunks[$server_CIPct]); - } - $SERVER_CAMP_temp_tally[$server_CIPct] = ($DBfill_needed[$camp_CIPct] - $DBfill_tally[$camp_CIPct]); - $SERVER_CAMP_temp_avail[$server_CIPct] = ( ($DB_camp_server_max_vicidial_trunks[$server_CIPct] - $VAC_server_camp) - $VAC_server_NONcamp); - $DB_camp_server_available[$server_CIPct] = ($DB_camp_server_available[$server_CIPct] - $VAC_server_BALcamp); - if ($DB_camp_server_available[$server_CIPct] < 0) {$DB_camp_server_available[$server_CIPct]=0;} - - if($DB) {print "TEMPVALS: |$SERVER_CAMP_temp_tally[$server_CIPct]|$SERVER_CAMP_temp_avail[$server_CIPct]|$DB_camp_server_available[$server_CIPct]||\n";} - if ($DB_camp_server_available[$server_CIPct] >= $SERVER_CAMP_temp_tally[$server_CIPct]) - {$DB_camp_server_trunks_to_dial[$server_CIPct] = $SERVER_CAMP_temp_tally[$server_CIPct];} - else - {$DB_camp_server_trunks_to_dial[$server_CIPct] = $DB_camp_server_available[$server_CIPct];} - - if ($SERVER_CAMP_temp_avail[$server_CIPct] < $DB_camp_server_trunks_to_dial[$server_CIPct]) - {$DB_camp_server_trunks_to_dial[$server_CIPct] = $SERVER_CAMP_temp_avail[$server_CIPct];} - - $DBfill_tally[$camp_CIPct] = ($DBfill_tally[$camp_CIPct] + $DB_camp_server_trunks_to_dial[$server_CIPct]); - - $event_string=" Server: $DB_camp_server_server_ip[$server_CIPct] AVAIL: $DB_camp_server_available[$server_CIPct] DIAL: $DB_camp_server_trunks_to_dial[$server_CIPct]"; - $event_string.=" Campaign Dial Fill tally: $DBfill_tally[$camp_CIPct]/$DBfill_needed[$camp_CIPct]"; + ################################################################################## + ##### CONTINUE IF THERE ARE BALANCE SERVERS AVAILABLE THAT ARE NOT IN TRUNK SHORTAGE + ################################################################################## + if ($AVAIL_balance_servers > 0) + { + $event_string="Balance Servers available: $AVAIL_balance_servers"; &event_logger; - - $stmtA = "SELECT count(*) FROM vicidial_live_agents where campaign_id='$DBfill_campaign[$camp_CIPct]' and status NOT IN('PAUSED');"; + $DB_camp_servers=0; + @DB_camp_server_server_ip=@MT; + @DB_camp_server_max_vicidial_trunks=@MT; + @DB_camp_server_balance_trunks_offlimits=@MT; + @DB_camp_server_dedicated_trunks=@MT; + @DB_camp_server_trunk_restriction=@MT; + @DB_NONcamp_server_dedicated_trunks=@MT; + @DB_camp_server_available=@MT; + @DB_camp_server_trunks_to_dial=@MT; + ##### Get the trunk settings for the campaign across all servers + $stmtA = "SELECT server_ip,max_vicidial_trunks,balance_trunks_offlimits,vicidial_balance_rank FROM servers where vicidial_balance_active = 'Y' and server_ip NOT IN($full_serversSQL) order by vicidial_balance_rank desc, server_ip;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $LVA_count=0; - if ($sthArows > 0) + $rec_count=0; + while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $LVA_count = $aryA[0]; + $DB_camp_server_server_ip[$DB_camp_servers] = $aryA[0]; + $DB_camp_server_max_vicidial_trunks[$DB_camp_servers] = $aryA[1]; + $DB_camp_server_balance_trunks_offlimits[$DB_camp_servers] = $aryA[2]; + $DB_camp_servers++; + $rec_count++; } $sthA->finish(); - if ($LVA_count > 0) + + ################################################################################## + ##### LOOP THROUGH SERVERS, CALCULATE TRUNKS FOR EACH FOR THIS CAMPAIGN + ################################################################################## + $server_CIPct = 0; + foreach(@DB_camp_server_server_ip) { - ################################################################################## - ##### PLACE THE CALLS - ################################################################################## - $event_string="$DBfill_campaign[$camp_CIPct] $DB_camp_server_server_ip[$server_CIPct]: CALLING"; - &event_logger; - $call_CMPIPct=0; - $lead_id_call_list='|'; - my $UDaffected_rows=0; - if ($call_CMPIPct < $DB_camp_server_trunks_to_dial[$server_CIPct]) + $DB_camp_server_dedicated_trunks[$server_CIPct]=0; + $DB_camp_server_trunk_restriction[$server_CIPct]=0; + $DB_NONcamp_server_dedicated_trunks[$server_CIPct]=0; + $SERVER_CAMP_temp_avail[$server_CIPct]=0; + $SERVER_CAMP_temp_tally[$server_CIPct]=0; + ##### Get the campaign-specific trunk settings for the campaign on this server + $stmtA = "SELECT dedicated_trunks,trunk_restriction FROM vicidial_server_trunks where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) { - $stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DB_camp_server_trunks_to_dial[$server_CIPct];"; - print "|$stmtA|\n"; - $UDaffected_rows = $dbhA->do($stmtA); - print "hopper rows updated to QUEUE: |$UDaffected_rows|\n"; + @aryA = $sthA->fetchrow_array; + $DB_camp_server_dedicated_trunks[$server_CIPct] = $aryA[0]; + $DB_camp_server_trunk_restriction[$server_CIPct] = $aryA[1]; + } + $sthA->finish(); - if ($UDaffected_rows) + ##### Get the campaign-specific dedicated trunks count for other campaigns on this server + $stmtA = "SELECT sum(dedicated_trunks) FROM vicidial_server_trunks where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id NOT IN('$DBfill_campaign[$camp_CIPct]');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DB_NONcamp_server_dedicated_trunks[$server_CIPct] = $aryA[0]; + } + $sthA->finish(); + + $VAC_server_camp=0; + $VAC_server_NONcamp=0; + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $VAC_server_BALcamp = $aryA[0]; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $VAC_server_camp = $aryA[0]; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id!='$DBfill_campaign[$camp_CIPct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $VAC_server_NONcamp = $aryA[0]; + } + $sthA->finish(); + + if($DB) {print "VAC CALLS: |$VAC_server_camp|$VAC_server_NONcamp|$VAC_server_BALcamp|\n";} + if($DB) {print "SETTINGS: |$DB_camp_server_dedicated_trunks[$server_CIPct]|$DB_camp_server_max_vicidial_trunks[$server_CIPct]|$DB_camp_server_balance_trunks_offlimits[$server_CIPct]||\n";} + + if ($DB_camp_server_trunk_restriction[$server_CIPct] =~ /MAXIMUM_LIMIT/) + { + $DB_camp_server_available[$server_CIPct] = $DB_camp_server_dedicated_trunks[$server_CIPct]; + } + else + { + $DB_camp_server_available[$server_CIPct] = ( ($DB_camp_server_max_vicidial_trunks[$server_CIPct] - $DB_camp_server_balance_trunks_offlimits[$server_CIPct]) - $DB_NONcamp_server_dedicated_trunks[$server_CIPct]); + } + $SERVER_CAMP_temp_tally[$server_CIPct] = ($DBfill_needed[$camp_CIPct] - $DBfill_tally[$camp_CIPct]); + $SERVER_CAMP_temp_avail[$server_CIPct] = ( ($DB_camp_server_max_vicidial_trunks[$server_CIPct] - $VAC_server_camp) - $VAC_server_NONcamp); + $DB_camp_server_available[$server_CIPct] = ($DB_camp_server_available[$server_CIPct] - $VAC_server_BALcamp); + if ($DB_camp_server_available[$server_CIPct] < 0) {$DB_camp_server_available[$server_CIPct]=0;} + + if($DB) {print "TEMPVALS: |$SERVER_CAMP_temp_tally[$server_CIPct]|$SERVER_CAMP_temp_avail[$server_CIPct]|$DB_camp_server_available[$server_CIPct]||\n";} + if ($DB_camp_server_available[$server_CIPct] >= $SERVER_CAMP_temp_tally[$server_CIPct]) + {$DB_camp_server_trunks_to_dial[$server_CIPct] = $SERVER_CAMP_temp_tally[$server_CIPct];} + else + {$DB_camp_server_trunks_to_dial[$server_CIPct] = $DB_camp_server_available[$server_CIPct];} + + if ($SERVER_CAMP_temp_avail[$server_CIPct] < $DB_camp_server_trunks_to_dial[$server_CIPct]) + {$DB_camp_server_trunks_to_dial[$server_CIPct] = $SERVER_CAMP_temp_avail[$server_CIPct];} + + $DBfill_tally[$camp_CIPct] = ($DBfill_tally[$camp_CIPct] + $DB_camp_server_trunks_to_dial[$server_CIPct]); + + $event_string=" Server: $DB_camp_server_server_ip[$server_CIPct] AVAIL: $DB_camp_server_available[$server_CIPct] DIAL: $DB_camp_server_trunks_to_dial[$server_CIPct]"; + $event_string.=" Campaign Dial Fill tally: $DBfill_tally[$camp_CIPct]/$DBfill_needed[$camp_CIPct]"; + &event_logger; + + + $stmtA = "SELECT count(*) FROM vicidial_live_agents where campaign_id='$DBfill_campaign[$camp_CIPct]' and status NOT IN('PAUSED');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $LVA_count=0; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $LVA_count = $aryA[0]; + } + $sthA->finish(); + + if ($LVA_count > 0) + { + ################################################################################## + ##### PLACE THE CALLS + ################################################################################## + $event_string="$DBfill_campaign[$camp_CIPct] $DB_camp_server_server_ip[$server_CIPct]: CALLING"; + &event_logger; + $call_CMPIPct=0; + $lead_id_call_list='|'; + my $UDaffected_rows=0; + if ($call_CMPIPct < $DB_camp_server_trunks_to_dial[$server_CIPct]) { - $lead_id=''; $phone_code=''; $phone_number=''; $called_count=''; - while ($call_CMPIPct < $UDaffected_rows) + $stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DB_camp_server_trunks_to_dial[$server_CIPct];"; + print "|$stmtA|\n"; + $UDaffected_rows = $dbhA->do($stmtA); + print "hopper rows updated to QUEUE: |$UDaffected_rows|\n"; + + if ($UDaffected_rows) { - $stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='QUEUE' and user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' order by priority desc,hopper_id LIMIT 1;"; - print "|$stmtA|\n"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $rec_countCUSTDATA=0; - if ($sthArows > 0) + $lead_id=''; $phone_code=''; $phone_number=''; $called_count=''; + while ($call_CMPIPct < $UDaffected_rows) { - @aryA = $sthA->fetchrow_array; - $lead_id = $aryA[0]; - $alt_dial = $aryA[1]; - } - $sthA->finish(); - - if ($lead_id_call_list =~ /\|$lead_id\|/) - { - print "!!!!!!!!!!!!!!!!duplicate lead_id for this run: |$lead_id| $lead_id_call_list\n"; - if ($SYSLOG) - { - open(DUPout, ">>$PATHlogs/VDAD_DUPLICATE.$file_date") - || die "Can't open $PATHlogs/VDAD_DUPLICATE.$file_date: $!\n"; - print DUPout "$now_date-----$lead_id_call_list-----$lead_id\n"; - close(DUPout); - } - } - else - { - $stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id';"; - # print "|$stmtA|\n"; - $UQaffected_rows = $dbhA->do($stmtA); - # print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n"; - - $stmtA = "SELECT list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,address3,alt_phone,called_count,security_phrase FROM vicidial_list where lead_id='$lead_id';"; + $stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='QUEUE' and user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' order by priority desc,hopper_id LIMIT 1;"; + print "|$stmtA|\n"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -627,397 +604,428 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $list_id = $aryA[0]; - $gmt_offset_now = $aryA[1]; - $called_since_last_reset = $aryA[2]; - $phone_code = $aryA[3]; - $phone_number = $aryA[4]; - $address3 = $aryA[5]; - $alt_phone = $aryA[6]; - $called_count = $aryA[7]; - $security_phrase = $aryA[8]; - - $rec_countCUSTDATA++; + $lead_id = $aryA[0]; + $alt_dial = $aryA[1]; } $sthA->finish(); - if ($rec_countCUSTDATA) + if ($lead_id_call_list =~ /\|$lead_id\|/) { - $campaign_cid_override=''; - ### gather list_id overrides - $stmtA = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';"; + print "!!!!!!!!!!!!!!!!duplicate lead_id for this run: |$lead_id| $lead_id_call_list\n"; + if ($SYSLOG) + { + open(DUPout, ">>$PATHlogs/VDAD_DUPLICATE.$file_date") + || die "Can't open $PATHlogs/VDAD_DUPLICATE.$file_date: $!\n"; + print DUPout "$now_date-----$lead_id_call_list-----$lead_id\n"; + close(DUPout); + } + } + else + { + $stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id';"; + # print "|$stmtA|\n"; + $UQaffected_rows = $dbhA->do($stmtA); + # print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n"; + + $stmtA = "SELECT list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,address3,alt_phone,called_count,security_phrase FROM vicidial_list where lead_id='$lead_id';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArowsL=$sthA->rows; - if ($sthArowsL > 0) + $sthArows=$sthA->rows; + $rec_countCUSTDATA=0; + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $campaign_cid_override = $aryA[0]; + $list_id = $aryA[0]; + $gmt_offset_now = $aryA[1]; + $called_since_last_reset = $aryA[2]; + $phone_code = $aryA[3]; + $phone_number = $aryA[4]; + $address3 = $aryA[5]; + $alt_phone = $aryA[6]; + $called_count = $aryA[7]; + $security_phrase = $aryA[8]; + + $rec_countCUSTDATA++; } $sthA->finish(); - ### update called_count - $called_count++; - if ($called_since_last_reset =~ /^Y/) + if ($rec_countCUSTDATA) { - if ($called_since_last_reset =~ /^Y$/) {$CSLR = 'Y1';} - else + $campaign_cid_override=''; + ### gather list_id overrides + $stmtA = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsL=$sthA->rows; + if ($sthArowsL > 0) { - $called_since_last_reset =~ s/^Y//gi; - $called_since_last_reset++; - $CSLR = "Y$called_since_last_reset"; + @aryA = $sthA->fetchrow_array; + $campaign_cid_override = $aryA[0]; } - } - else {$CSLR = 'Y';} + $sthA->finish(); - $LLCT_DATE_offset = ($LOCAL_GMT_OFF - $gmt_offset_now); - $LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) ); - ($Lsec,$Lmin,$Lhour,$Lmday,$Lmon,$Lyear,$Lwday,$Lyday,$Lisdst) = localtime($LLCT_DATE_offset_epoch); - $Lyear = ($Lyear + 1900); - $Lmon++; - if ($Lmon < 10) {$Lmon = "0$Lmon";} - if ($Lmday < 10) {$Lmday = "0$Lmday";} - if ($Lhour < 10) {$Lhour = "0$Lhour";} - if ($Lmin < 10) {$Lmin = "0$Lmin";} - if ($Lsec < 10) {$Lsec = "0$Lsec";} - $LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec"; - - if ( ($alt_dial =~ /ALT|ADDR3|X/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT|ADDR|X/) ) - { - if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT/) ) + ### update called_count + $called_count++; + if ($called_since_last_reset =~ /^Y/) { - $alt_phone =~ s/\D//gi; - $phone_number = $alt_phone; - } - if ( ($alt_dial =~ /ADDR3/) && ($DBIPautoaltdial[$user_CIPct] =~ /ADDR3/) ) - { - $address3 =~ s/\D//gi; - $phone_number = $address3; - } - if ( ($alt_dial =~ /^X/) && ($DBIPautoaltdial[$user_CIPct] =~ /^X/) ) - { - if ($alt_dial =~ /LAST/) - { - $stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' order by alt_phone_count desc limit 1;"; - } + if ($called_since_last_reset =~ /^Y$/) {$CSLR = 'Y1';} else { - $Talt_dial = $alt_dial; - $Talt_dial =~ s/\D//gi; - $stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Talt_dial';"; + $called_since_last_reset =~ s/^Y//gi; + $called_since_last_reset++; + $CSLR = "Y$called_since_last_reset"; } + } + else {$CSLR = 'Y';} + + $LLCT_DATE_offset = ($LOCAL_GMT_OFF - $gmt_offset_now); + $LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) ); + ($Lsec,$Lmin,$Lhour,$Lmday,$Lmon,$Lyear,$Lwday,$Lyday,$Lisdst) = localtime($LLCT_DATE_offset_epoch); + $Lyear = ($Lyear + 1900); + $Lmon++; + if ($Lmon < 10) {$Lmon = "0$Lmon";} + if ($Lmday < 10) {$Lmday = "0$Lmday";} + if ($Lhour < 10) {$Lhour = "0$Lhour";} + if ($Lmin < 10) {$Lmin = "0$Lmin";} + if ($Lsec < 10) {$Lsec = "0$Lsec";} + $LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec"; + + if ( ($alt_dial =~ /ALT|ADDR3|X/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT|ADDR|X/) ) + { + if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT/) ) + { + $alt_phone =~ s/\D//gi; + $phone_number = $alt_phone; + } + if ( ($alt_dial =~ /ADDR3/) && ($DBIPautoaltdial[$user_CIPct] =~ /ADDR3/) ) + { + $address3 =~ s/\D//gi; + $phone_number = $address3; + } + if ( ($alt_dial =~ /^X/) && ($DBIPautoaltdial[$user_CIPct] =~ /^X/) ) + { + if ($alt_dial =~ /LAST/) + { + $stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' order by alt_phone_count desc limit 1;"; + } + else + { + $Talt_dial = $alt_dial; + $Talt_dial =~ s/\D//gi; + $stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Talt_dial';"; + } + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $phone_code = $aryA[0]; + $phone_number = $aryA[1]; + $phone_number =~ s/\D//gi; + } + $sthA->finish(); + } + + $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';"; + } + else + { + $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';"; + } + if ($staggered < 1) + { + $affected_rows = $dbhA->do($stmtA); + } + else + { + $vl_updates[$staggered_ct] = $stmtA; + } + + $stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; + $affected_rows = $dbhA->do($stmtA); + + $CCID_on=0; $CCID=''; + $local_DEF = 'Local/'; + $local_AMP = '@'; + $Local_out_prefix = '9'; + $Local_dial_timeout = '60'; + if ($DBIPdialtimeout[$camp_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$camp_CIPct];} + $Local_dial_timeout = ($Local_dial_timeout * 1000); + if (length($DBIPdialprefix[$camp_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$camp_CIPct]";} + if (length($DBIPvdadexten[$camp_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$camp_CIPct]";} + else {$VDAD_dial_exten = "$answer_transfer_agent";} + + if (length($DBIPcampaigncid[$camp_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$camp_CIPct]"; $CCID_on++;} + if (length($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} + if ($DBIPuse_custom_cid[$camp_CIPct] =~ /Y/) + { + $temp_CID = $security_phrase; + $temp_CID =~ s/\D//gi; + if (length($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} + } + if ($DBIPuse_custom_cid[$camp_CIPct] =~ /AREACODE/) + { + $temp_CID=''; + $temp_vcca=''; + $temp_ac = substr("$phone_number", 0, 3); + $stmtA = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$DBfill_campaign[$camp_CIPct]' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $phone_code = $aryA[0]; - $phone_number = $aryA[1]; - $phone_number =~ s/\D//gi; + $temp_vcca = $aryA[0]; + $sthA->finish(); + + $stmtA="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$DBfill_campaign[$camp_CIPct]' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + $affected_rows = $dbhA->do($stmtA); } - $sthA->finish(); + $temp_CID = $temp_vcca; + $temp_CID =~ s/\D//gi; + if (length($temp_CID) > 6) + {$CCID = "$temp_CID"; $CCID_on++;} } - $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';"; - } - else - { - $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';"; - } - if ($staggered < 1) - { - $affected_rows = $dbhA->do($stmtA); - } - else - { - $vl_updates[$staggered_ct] = $stmtA; - } + if ($DBIPdialprefix[$camp_CIPct] =~ /x/i) {$Local_out_prefix = '';} - $stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; - $affected_rows = $dbhA->do($stmtA); - - $CCID_on=0; $CCID=''; - $local_DEF = 'Local/'; - $local_AMP = '@'; - $Local_out_prefix = '9'; - $Local_dial_timeout = '60'; - if ($DBIPdialtimeout[$camp_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$camp_CIPct];} - $Local_dial_timeout = ($Local_dial_timeout * 1000); - if (length($DBIPdialprefix[$camp_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$camp_CIPct]";} - if (length($DBIPvdadexten[$camp_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$camp_CIPct]";} - else {$VDAD_dial_exten = "$answer_transfer_agent";} - - if (length($DBIPcampaigncid[$camp_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$camp_CIPct]"; $CCID_on++;} - if (length($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;} - if ($DBIPuse_custom_cid[$camp_CIPct] =~ /Y/) - { - $temp_CID = $security_phrase; - $temp_CID =~ s/\D//gi; - if (length($temp_CID) > 6) - {$CCID = "$temp_CID"; $CCID_on++;} - } - if ($DBIPuse_custom_cid[$camp_CIPct] =~ /AREACODE/) - { - $temp_CID=''; - $temp_vcca=''; - $temp_ac = substr("$phone_number", 0, 3); - $stmtA = "SELECT outbound_cid FROM vicidial_campaign_cid_areacodes where campaign_id='$DBfill_campaign[$camp_CIPct]' and areacode='$temp_ac' and active='Y' order by call_count_today limit 1;"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - if ($sthArows > 0) + if ($RECcount) { - @aryA = $sthA->fetchrow_array; - $temp_vcca = $aryA[0]; - $sthA->finish(); + if ( (length($RECprefix)>0) && ($called_count < $RECcount) ) + {$Local_out_prefix .= "$RECprefix";} + } + $PADlead_id = sprintf("%010s", $lead_id); while (length($PADlead_id) > 10) {chop($PADlead_id);} - $stmtA="UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='$DBfill_campaign[$camp_CIPct]' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; + if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;} + + $lead_id_call_list .= "$lead_id|"; + + if (length($alt_dial)<1) {$alt_dial='MAIN';} + + ### whether to omit phone_code or not + if ($DBIPomitcode[$camp_CIPct] > 0) + {$Ndialstring = "$Local_out_prefix$phone_number";} + else + {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} + + if (length($ext_context) < 1) {$ext_context='default';} + ### use manager middleware-app to connect the next call to the meetme room + # VmmddhhmmssLLLLLLLLL + $VqueryCID = "V$CIDdate$PADlead_id"; + if ($CCID_on) {$CIDstring = "\"$VqueryCID\" <$CCID>";} + else {$CIDstring = "$VqueryCID";} + + if ($staggered < 1) + { + ### insert a NEW record to the vicidial_manager table to be processed + $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DB_camp_server_server_ip[$server_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','VDACnote: $DBfill_campaign[$camp_CIPct]|$lead_id|$phone_code|$phone_number|OUTBALANCE|$alt_dial|$DBIPqueue_priority[$camp_CIPct]')"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| number call dialed|$DBfill_campaign[$camp_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|$alt_dial|"; + &event_logger; + + ### insert a SENT record to the vicidial_auto_calls table + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('$DB_camp_server_server_ip[$server_CIPct]','$DBfill_campaign[$camp_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUTBALANCE','$alt_dial','$DBIPqueue_priority[$camp_CIPct]')"; + $affected_rows = $dbhA->do($stmtA); + $calls_placed++; + + ### insert log record into vicidial_dial_log table + $stmtA = "INSERT INTO vicidial_dial_log SET caller_code='$VqueryCID',lead_id='$lead_id',server_ip='$DB_camp_server_server_ip[$server_CIPct]',call_date='$SQLdate',extension='$VDAD_dial_exten',channel='$local_DEF$Ndialstring$local_AMP$ext_context',timeout='$Local_dial_timeout',outbound_cid='$CIDstring',context='$ext_context';"; $affected_rows = $dbhA->do($stmtA); } - $temp_CID = $temp_vcca; - $temp_CID =~ s/\D//gi; - if (length($temp_CID) > 6) - {$CCID = "$temp_CID"; $CCID_on++;} - } + else + { + ##### create dummy records to have their server_ip filled in at the stagger section + $vm_inserts[$staggered_ct] = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','XXXXXXXXXXXXXXX','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','VDACnote: $DBfill_campaign[$camp_CIPct]|$lead_id|$phone_code|$phone_number|OUTBALANCE|$alt_dial|$DBIPqueue_priority[$camp_CIPct]')"; - if ($DBIPdialprefix[$camp_CIPct] =~ /x/i) {$Local_out_prefix = '';} + $vac_inserts[$staggered_ct] = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('XXXXXXXXXXXXXXX','$DBfill_campaign[$camp_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUTBALANCE','$alt_dial','$DBIPqueue_priority[$camp_CIPct]')"; - if ($RECcount) - { - if ( (length($RECprefix)>0) && ($called_count < $RECcount) ) - {$Local_out_prefix .= "$RECprefix";} - } - $PADlead_id = sprintf("%010s", $lead_id); while (length($PADlead_id) > 10) {chop($PADlead_id);} + $st_logged[$staggered_ct] = "$phone_number|$DBfill_campaign[$camp_CIPct]|$VqueryCID|$gmt_offset_now|$alt_dial|"; - if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;} + $vddl_inserts[$staggered_ct] = "INSERT INTO vicidial_dial_log SET caller_code='$VqueryCID',lead_id='$lead_id',server_ip='XXXXXXXXXXXXXXX',call_date='$SQLdate',extension='$VDAD_dial_exten',channel='$local_DEF$Ndialstring$local_AMP$ext_context',timeout='$Local_dial_timeout',outbound_cid='$CIDstring',context='$ext_context';"; - $lead_id_call_list .= "$lead_id|"; + $calls_placed++; + $staggered_ct++; + } - if (length($alt_dial)<1) {$alt_dial='MAIN';} - - ### whether to omit phone_code or not - if ($DBIPomitcode[$camp_CIPct] > 0) - {$Ndialstring = "$Local_out_prefix$phone_number";} - else - {$Ndialstring = "$Local_out_prefix$phone_code$phone_number";} - - if (length($ext_context) < 1) {$ext_context='default';} - ### use manager middleware-app to connect the next call to the meetme room - # VmmddhhmmssLLLLLLLLL - $VqueryCID = "V$CIDdate$PADlead_id"; - if ($CCID_on) {$CIDstring = "\"$VqueryCID\" <$CCID>";} - else {$CIDstring = "$VqueryCID";} - - if ($staggered < 1) - { - ### insert a NEW record to the vicidial_manager table to be processed - $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DB_camp_server_server_ip[$server_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','VDACnote: $DBfill_campaign[$camp_CIPct]|$lead_id|$phone_code|$phone_number|OUTBALANCE|$alt_dial|$DBIPqueue_priority[$camp_CIPct]')"; - $affected_rows = $dbhA->do($stmtA); - - $event_string = "| number call dialed|$DBfill_campaign[$camp_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|$alt_dial|"; - &event_logger; - - ### insert a SENT record to the vicidial_auto_calls table - $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('$DB_camp_server_server_ip[$server_CIPct]','$DBfill_campaign[$camp_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUTBALANCE','$alt_dial','$DBIPqueue_priority[$camp_CIPct]')"; - $affected_rows = $dbhA->do($stmtA); - $calls_placed++; - - ### insert log record into vicidial_dial_log table - $stmtA = "INSERT INTO vicidial_dial_log SET caller_code='$VqueryCID',lead_id='$lead_id',server_ip='$DB_camp_server_server_ip[$server_CIPct]',call_date='$SQLdate',extension='$VDAD_dial_exten',channel='$local_DEF$Ndialstring$local_AMP$ext_context',timeout='$Local_dial_timeout',outbound_cid='$CIDstring',context='$ext_context';"; - $affected_rows = $dbhA->do($stmtA); - } - else - { - ##### create dummy records to have their server_ip filled in at the stagger section - $vm_inserts[$staggered_ct] = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','XXXXXXXXXXXXXXX','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','VDACnote: $DBfill_campaign[$camp_CIPct]|$lead_id|$phone_code|$phone_number|OUTBALANCE|$alt_dial|$DBIPqueue_priority[$camp_CIPct]')"; - - $vac_inserts[$staggered_ct] = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('XXXXXXXXXXXXXXX','$DBfill_campaign[$camp_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUTBALANCE','$alt_dial','$DBIPqueue_priority[$camp_CIPct]')"; - - $st_logged[$staggered_ct] = "$phone_number|$DBfill_campaign[$camp_CIPct]|$VqueryCID|$gmt_offset_now|$alt_dial|"; - - $vddl_inserts[$staggered_ct] = "INSERT INTO vicidial_dial_log SET caller_code='$VqueryCID',lead_id='$lead_id',server_ip='XXXXXXXXXXXXXXX',call_date='$SQLdate',extension='$VDAD_dial_exten',channel='$local_DEF$Ndialstring$local_AMP$ext_context',timeout='$Local_dial_timeout',outbound_cid='$CIDstring',context='$ext_context';"; - - $calls_placed++; - $staggered_ct++; - } - - if ($staggered < 1) - { - ### sleep for 2.5 hundredths of a second to not flood the server with new calls - # usleep(1*25*1000); - usleep(1*$per_call_delay*1000); + if ($staggered < 1) + { + ### sleep for 2.5 hundredths of a second to not flood the server with new calls + # usleep(1*25*1000); + usleep(1*$per_call_delay*1000); + } } } + $call_CMPIPct++; } - $call_CMPIPct++; } } } + else + { + $event_string.="No Agents logged in, not dialing"; + &event_logger; + } + + $server_CIPct++; } - else - { - $event_string.="No Agents logged in, not dialing"; - &event_logger; - } - - $server_CIPct++; } - } - else - { - $event_string.="No Balance Servers available that do not have a shortage"; - &event_logger; - } - - - ############################################################################### - ###### BEGIN - experimental balanced FILL dialing ($staggered) - ############################################################################### - if ( ($staggered > 0) && ($staggered_ct > 0) ) - { - $staggered_fill=0; - $stmtA = "SELECT count(*),vicidial_balance_rank FROM servers where vicidial_balance_active = 'Y' group by vicidial_balance_rank order by vicidial_balance_rank desc;"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $st_ct=0; - while ($sthArows > $st_ct) + else { - @aryA = $sthA->fetchrow_array; - $ST_count[$st_ct] = $aryA[0]; - $ST_rank[$st_ct] = $aryA[1]; - $st_ct++; + $event_string.="No Balance Servers available that do not have a shortage"; + &event_logger; } - $sthA->finish(); - ##### gather available trunks on all servers and place calls - $staggered_rank_ct=0; - while ( ($st_ct > $staggered_rank_ct) && ($staggered_ct > $staggered_fill) ) + + ############################################################################### + ###### BEGIN - experimental balanced FILL dialing ($staggered) + ############################################################################### + if ( ($staggered > 0) && ($staggered_ct > 0) ) { - $stmtA = "SELECT server_ip FROM servers where vicidial_balance_rank='$ST_rank[$staggered_rank_ct]' and vicidial_balance_active = 'Y' order by server_ip LIMIT $ST_count[$staggered_rank_ct];"; + $staggered_fill=0; + $stmtA = "SELECT count(*),vicidial_balance_rank FROM servers where vicidial_balance_active = 'Y' group by vicidial_balance_rank order by vicidial_balance_rank desc;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArowsSIPS=$sthA->rows; - $TOTAL_available=0; - $st_si_ct=0; - while ($sthArowsSIPS > $st_si_ct) + $sthArows=$sthA->rows; + $st_ct=0; + while ($sthArows > $st_ct) { @aryA = $sthA->fetchrow_array; - $ST_server_ip[$st_si_ct] = $aryA[0]; - - $io=0; - foreach(@DB_camp_server_server_ip) - { - if ( ($DB_camp_server_server_ip[$io] =~ /$ST_server_ip[$st_si_ct]/) && (length($DB_camp_server_server_ip[$io]) == length($ST_server_ip[$st_si_ct])) ) - { - $ST_available[$st_si_ct] = $SERVER_CAMP_temp_avail[$io]; - $ST_tally[$st_si_ct] = $SERVER_CAMP_temp_tally[$io]; - $TOTAL_available = ($TOTAL_available + $ST_available[$st_si_ct]); - } - $io++; - } - $st_si_ct++; + $ST_count[$st_ct] = $aryA[0]; + $ST_rank[$st_ct] = $aryA[1]; + $st_ct++; } $sthA->finish(); - ##### place calls - $failsafe_ct=0; - $RANK_calls_placed=0; - $st_si_loop=0; - $TEMP_server_ip = ''; - $TEMP_vm_insert = ''; - $TEMP_vac_insert = ''; - $TEMP_vl_update = ''; - $TEMP_st_logged = ''; - $TEMP_vddl_inserts = ''; - $TEMP_vm_insert = ''; - $TEMP_vac_insert = ''; - $TEMP_vddl_inserts = ''; - - while ( ($TOTAL_available > $RANK_calls_placed) && ($failsafe_ct < 99999) && ($staggered_fill <= $staggered_ct) ) + ##### gather available trunks on all servers and place calls + $staggered_rank_ct=0; + while ( ($st_ct > $staggered_rank_ct) && ($staggered_ct > $staggered_fill) ) { - $TEMP_server_ip = $ST_server_ip[$st_si_loop]; - - $TEMP_vm_insert = $vm_inserts[$staggered_fill]; - $TEMP_vac_insert = $vac_inserts[$staggered_fill]; - $TEMP_vl_update = $vl_updates[$staggered_fill]; - $TEMP_st_logged = $st_logged[$staggered_fill]; - $TEMP_vddl_inserts = $vddl_inserts[$staggered_fill]; - - $TEMP_vm_insert =~ s/XXXXXXXXXXXXXXX/$TEMP_server_ip/gi; - $TEMP_vac_insert =~ s/XXXXXXXXXXXXXXX/$TEMP_server_ip/gi; - $TEMP_vddl_inserts =~ s/XXXXXXXXXXXXXXX/$TEMP_server_ip/gi; - - if (length($TEMP_vm_insert) > 20) + $stmtA = "SELECT server_ip FROM servers where vicidial_balance_rank='$ST_rank[$staggered_rank_ct]' and vicidial_balance_active = 'Y' order by server_ip LIMIT $ST_count[$staggered_rank_ct];"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsSIPS=$sthA->rows; + $TOTAL_available=0; + $st_si_ct=0; + while ($sthArowsSIPS > $st_si_ct) { - $affected_rows_vl = $dbhA->do($TEMP_vl_update); - $affected_rows_vm = $dbhA->do($TEMP_vm_insert); - $affected_rows_vac = $dbhA->do($TEMP_vac_insert); - $affected_rows_vddl = $dbhA->do($TEMP_vddl_inserts); + @aryA = $sthA->fetchrow_array; + $ST_server_ip[$st_si_ct] = $aryA[0]; + + $io=0; + foreach(@DB_camp_server_server_ip) + { + if ( ($DB_camp_server_server_ip[$io] =~ /$ST_server_ip[$st_si_ct]/) && (length($DB_camp_server_server_ip[$io]) == length($ST_server_ip[$st_si_ct])) ) + { + $ST_available[$st_si_ct] = $SERVER_CAMP_temp_avail[$io]; + $ST_tally[$st_si_ct] = $SERVER_CAMP_temp_tally[$io]; + $TOTAL_available = ($TOTAL_available + $ST_available[$st_si_ct]); + } + $io++; + } + $st_si_ct++; + } + $sthA->finish(); + + ##### place calls + $failsafe_ct=0; + $RANK_calls_placed=0; + $st_si_loop=0; + $TEMP_server_ip = ''; + $TEMP_vm_insert = ''; + $TEMP_vac_insert = ''; + $TEMP_vl_update = ''; + $TEMP_st_logged = ''; + $TEMP_vddl_inserts = ''; + $TEMP_vm_insert = ''; + $TEMP_vac_insert = ''; + $TEMP_vddl_inserts = ''; + + while ( ($TOTAL_available > $RANK_calls_placed) && ($failsafe_ct < 99999) && ($staggered_fill <= $staggered_ct) ) + { + $TEMP_server_ip = $ST_server_ip[$st_si_loop]; + + $TEMP_vm_insert = $vm_inserts[$staggered_fill]; + $TEMP_vac_insert = $vac_inserts[$staggered_fill]; + $TEMP_vl_update = $vl_updates[$staggered_fill]; + $TEMP_st_logged = $st_logged[$staggered_fill]; + $TEMP_vddl_inserts = $vddl_inserts[$staggered_fill]; + + $TEMP_vm_insert =~ s/XXXXXXXXXXXXXXX/$TEMP_server_ip/gi; + $TEMP_vac_insert =~ s/XXXXXXXXXXXXXXX/$TEMP_server_ip/gi; + $TEMP_vddl_inserts =~ s/XXXXXXXXXXXXXXX/$TEMP_server_ip/gi; + + if (length($TEMP_vm_insert) > 20) + { + $affected_rows_vl = $dbhA->do($TEMP_vl_update); + $affected_rows_vm = $dbhA->do($TEMP_vm_insert); + $affected_rows_vac = $dbhA->do($TEMP_vac_insert); + $affected_rows_vddl = $dbhA->do($TEMP_vddl_inserts); + } + + $event_string = "| number call stagger dialed|$TEMP_server_ip|$staggered_fill|$staggered_ct|$affected_rows_vm|$affected_rows_vac|$affected_rows_vl|$affected_rows_vddl $TEMP_st_logged"; + &event_logger; + + ### sleep for 2.5 hundredths of a second to not flood the server with new calls + # usleep(1*25*1000); + usleep(1*$per_call_delay*1000); + + $RANK_calls_placed++; + $staggered_fill++; + $failsafe_ct++; + $st_si_loop++; + if ($st_si_loop >= $st_si_ct) + {$st_si_loop=0;} } - $event_string = "| number call stagger dialed|$TEMP_server_ip|$staggered_fill|$staggered_ct|$affected_rows_vm|$affected_rows_vac|$affected_rows_vl|$affected_rows_vddl $TEMP_st_logged"; - &event_logger; - - ### sleep for 2.5 hundredths of a second to not flood the server with new calls - # usleep(1*25*1000); - usleep(1*$per_call_delay*1000); - - $RANK_calls_placed++; - $staggered_fill++; - $failsafe_ct++; - $st_si_loop++; - if ($st_si_loop >= $st_si_ct) - {$st_si_loop=0;} + $staggered_rank_ct++; } - - $staggered_rank_ct++; } + $staggered_ct=0; + @ST_server_ip=@MT; + @ST_available=@MT; + @ST_tally=@MT; + @vm_inserts=@MT; + @vac_inserts=@MT; + @vl_updates=@MT; + @st_logged=@MT; + @vddl_inserts=@MT; + ############################################################################### + ###### END - experimental balanced FILL dialing ($staggered) + ############################################################################### + + + $temp_balance_total = ($DBfill_current_balance[$camp_CIPct] + $DBfill_tally[$camp_CIPct]); + if ($DB) {print "CURRENT FILL: $temp_balance_total = ($DBfill_current_balance[$camp_CIPct] + $DBfill_tally[$camp_CIPct])\n";} + $stmtA = "UPDATE vicidial_campaign_stats SET balance_trunk_fill='$temp_balance_total' where campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $affected_rows = $dbhA->do($stmtA); + + if ($calls_placed > 0) + { + $stmtA="UPDATE vicidial_campaigns SET campaign_calldate='$now_date' where campaign_id='$DBfill_campaign[$camp_CIPct]';"; + $affected_rows = $dbhA->do($stmtA); + $calls_placed=0; + } + + $camp_CIPct++; } - $staggered_ct=0; - @ST_server_ip=@MT; - @ST_available=@MT; - @ST_tally=@MT; - @vm_inserts=@MT; - @vac_inserts=@MT; - @vl_updates=@MT; - @st_logged=@MT; - @vddl_inserts=@MT; - ############################################################################### - ###### END - experimental balanced FILL dialing ($staggered) - ############################################################################### - - $temp_balance_total = ($DBfill_current_balance[$camp_CIPct] + $DBfill_tally[$camp_CIPct]); - if ($DB) {print "CURRENT FILL: $temp_balance_total = ($DBfill_current_balance[$camp_CIPct] + $DBfill_tally[$camp_CIPct])\n";} - $stmtA = "UPDATE vicidial_campaign_stats SET balance_trunk_fill='$temp_balance_total' where campaign_id='$DBfill_campaign[$camp_CIPct]';"; + } + ################################################################################## + ##### END LOOP IF THERE ARE BALANCE SERVERS AND THERE ARE SHORTAGES + ################################################################################## + else + { + if ($DB) {print "No Balance servers or no shortages\n";} + $stmtA = "UPDATE vicidial_campaign_stats SET balance_trunk_fill='0';"; $affected_rows = $dbhA->do($stmtA); - if ($calls_placed > 0) - { - $stmtA="UPDATE vicidial_campaigns SET campaign_calldate='$now_date' where campaign_id='$DBfill_campaign[$camp_CIPct]';"; - $affected_rows = $dbhA->do($stmtA); - $calls_placed=0; - } - - $camp_CIPct++; + $event_string.="No Balance Servers available or No Shortages"; + &event_logger; } - } - ################################################################################## - ##### END LOOP IF THERE ARE BALANCE SERVERS AND THERE ARE SHORTAGES - ################################################################################## - else - { - if ($DB) {print "No Balance servers or no shortages\n";} - $stmtA = "UPDATE vicidial_campaign_stats SET balance_trunk_fill='0';"; - $affected_rows = $dbhA->do($stmtA); - - $event_string.="No Balance Servers available or No Shortages"; - &event_logger; - } - diff --git a/bin/AST_VDhopper.pl b/bin/AST_VDhopper.pl index 9d967677..ff6de703 100644 --- a/bin/AST_VDhopper.pl +++ b/bin/AST_VDhopper.pl @@ -953,11 +953,11 @@ while ($sthArows > $rec_count) print "DELETING $num_to_delete LEADS FROM THE HOPPER. |$affected_rows|\n"; } } - if ($DB) { print "\n"; } + if ($DB) {print "\n";} } if (length($use_other_campaign_dnc[$rec_count]) > 0) { - print "OTHER CAMPAIGN DNC SELECTED: $use_other_campaign_dnc[$rec_count]\n"; + if ($DB) {print "OTHER CAMPAIGN DNC SELECTED: $use_other_campaign_dnc[$rec_count]\n";} } $rec_count++; } diff --git a/docs/ENCRYPTED_PASSWORDS.txt b/docs/ENCRYPTED_PASSWORDS.txt new file mode 100644 index 00000000..10f2e43c --- /dev/null +++ b/docs/ENCRYPTED_PASSWORDS.txt @@ -0,0 +1,63 @@ +ENCRYPTED PASSWORDS DOC Started: 2013-07-09 Updated: 2013-07-09 + + +NOTE: THIS FEATURE IS OPTIONAL, AND SHOULD ONLY BE ACTIVATED AFTER YOUR SYSTEM + HAS BEEN INSTALLED, CONFIGURED AND TESTED! + + + +INSTALL: + +Perl CPAN module required for Password Encryption to function: +NOTE: this must be installed on all webservers if you have more than one + +On the Linux command line of your webserver(s), type the following: + +cpan +install Crypt::Eksblowfish::Bcrypt +quit + +Then, go to the admin web interface Admin -> System Settings page and manually +confirm that Password Encryption is DISABLED (fifth item from the top) + +Then, run the following CLI script: (run in test mode first!) + /usr/share/astguiclient/ADMIN_bcrypt_convert.pl --debugX --test + +Then if no errors are shown, run the same script above WITHOUT the --test flag. +NOTE: If you also want to clear the plaintext passwords from the users table, +you can run the above script with the --clear-plaintext-pass flag + +Now if you go back to the admin web interface Admin -> System Settings page, you +should see that Password Encryption is now ENABLED. + +You should not have to do anything else to use fully encrypted passwords on your +system. + + + +DESCRIPTION: + +This new optional feature is part of the security enhancements that have been +made to the Vicidial Contact Center System in our 2.8 development branch. After +consulting with security experts, we added several new security features to the +web interfaces and closed several security vulnerabilities as well. + +The first major change was protecting against most SQL injection attacks. The +second major change was locking a user's account for 15 minutes after 10 failed +login attempts, which removes the vulnerability of the system to brute force +password attacks. Password encryption is the third major change, which protects +user passwords even if the system is compromised and the users database table is +downloaded. + +We use the Bcrypt hashing algorithm, which allows for variable rates of +calculating the hash from a password and a salt. This variable "cost" is +definable in the system before you activate password encryption, and this is +what allows bcrypt to increase the complexity of the hash as computer systems +improve calculation ability, which makes Bcrypt the ideal choice for a system +that could be installed for many years. + +All password checking goes through the bp.pl perl script to generate the Bcrypt +hash that checks against the vicidial_users table password hash if Password +Encryption is enabled on your system. + +NOTES: Enabling Password Encryption will force case-sensitive passwords diff --git a/docs/REQUIRED_APPS_INSTALL.txt b/docs/REQUIRED_APPS_INSTALL.txt index 1b98f2ba..5cf5b1c3 100644 --- a/docs/REQUIRED_APPS_INSTALL.txt +++ b/docs/REQUIRED_APPS_INSTALL.txt @@ -88,6 +88,8 @@ install Mail::Message install IO::Socket::SSL install MIME::Base64 install MIME::QuotedPrint +install Crypt::Eksblowfish::Bcrypt + quit diff --git a/docs/SCRATCH_INSTALL.txt b/docs/SCRATCH_INSTALL.txt index ff85cfaf..d31b1790 100644 --- a/docs/SCRATCH_INSTALL.txt +++ b/docs/SCRATCH_INSTALL.txt @@ -462,6 +462,7 @@ following modules first: (say YES if asked to install prerequisites) - install IO::Socket::SSL - install MIME::Base64 - install MIME::QuotedPrint + - install Crypt::Eksblowfish::Bcrypt - then quit cpan, you are done 5. Go to http://asterisk.gnuinter.net/ and download the asterisk-perl module (backup link: http://download.vicidial.com/packages/asterisk-perl-0.08.tar.gz) diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 571348d8..f6194b5c 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -1523,7 +1523,8 @@ allow_emails ENUM('0','1') default '0', level_8_disable_add ENUM('0','1') default '0', pass_hash_enabled ENUM('0','1') default '0', pass_key VARCHAR(100) default '', -pass_cost TINYINT(2) UNSIGNED default '2' +pass_cost TINYINT(2) UNSIGNED default '2', +disable_auto_dial ENUM('0','1') default '0' ) ENGINE=MyISAM; CREATE TABLE vicidial_campaigns_list_mix ( @@ -3136,4 +3137,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='1352',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1353',db_schema_update_date=NOW(); diff --git a/extras/upgrade_2.8.sql b/extras/upgrade_2.8.sql index 7516ddd1..652a2cf9 100644 --- a/extras/upgrade_2.8.sql +++ b/extras/upgrade_2.8.sql @@ -24,3 +24,7 @@ CREATE INDEX phone_ip ON vicidial_user_log (phone_ip); CREATE INDEX vuled ON vicidial_user_log (event_date); UPDATE system_settings SET db_schema_version='1352',db_schema_update_date=NOW() where db_schema_version < 1352; + +ALTER TABLE system_settings ADD disable_auto_dial ENUM('0','1') default '0'; + +UPDATE system_settings SET db_schema_version='1353',db_schema_update_date=NOW() where db_schema_version < 1353; diff --git a/install.pl b/install.pl index 862861e3..f8446f7d 100644 --- a/install.pl +++ b/install.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# install.pl version 2.6 +# install.pl version 2.8 # # Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 # @@ -29,6 +29,7 @@ # 121027-1750 - Added svn logging information # 121215-2059 - Added keepalive option E for email process # 130108-1853 - Added Asterisk 1.8 option with default conf files copy +# 130705-1805 - Added bp.pl script to the agc web dir # ############################################ @@ -2632,6 +2633,7 @@ if ($PATHconf !~ /\/etc\/astguiclient.conf/) `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHhome/* `; `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHagi/* `; `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/agc/dbconnect.php `; + `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/agc/bp.pl `; `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/vicidial/dbconnect.php `; `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/vicidial/listloader.pl `; `sed -i 's/$PATHconfDEFAULT/$PATHconfEREG/g' $PATHweb/vicidial/listloader_super.pl `; diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.8.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.8.txt index d6838687..0b416743 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.8.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.8.txt @@ -1,6 +1,210 @@ ############################################################ ADMIN Active Outbound Holiday Definitions for this Record|| Modify Call Time State Holiday|| +Last Login Info|| +This shows the last login attempt date and time, and if there has been a recent failed login attempt. If this modify user form is submitted, then the failed login attempt counter will be reset and the agent can immediately attempt to log in again. If an agent has 10 failed login attempts in a row then they cannot attempt to log in again for at least 15 minutes unless their account is manually reset|| +Disable Auto-Dial|| +This option is only editable by a system administrator. It will not remove any options from the management web interface, but it will prevent any auto-dialing of leads from happening on the system. Only Manual Dial outbound calls triggered directly by agents will function if this option is enabled. Default is 0 for inactive|| +Auto-dialing has been disabled on this system|| +Password and Full Name each need to be at least 2 characters in length|| +PASSWORD IS ENCRYPTED, ONLY ENTER IN A PASSWORD BELOW IF YOU WANT TO CHANGE IT|| +Password Encryption|| +To log back in|| +click here|| +Dial Log Report|| +ADD NEW AGENT CONFERENCE|| +ADDING NEW SERVER TRUNK RECORD|| +ADDING NEW AGENT CONFERENCE|| +ADDING SYSTEM STATUSES|| +ADDING STATUS CATEGORY|| +ADDING QC STATUS CODE|| +MODIFY AGENT CONFERENCE|| +MODIFY SYSTEM SETTINGS|| +MODIFY SYSTEM STATUSES|| +MODIFY STATUS CATEGORY|| +MODIFY QC STATUS CODE|| +MODIFY SERVER TRUNK RECORD|| +MODIFY CONFERENCE|| +MODIFY SYSTEM SETTINGS|| +MODIFY SYSTEM STATUSES|| +MODIFY STATUS CATEGORIES|| +MODIFY QC STATUS CODE|| +DELETE AGENT CONFERENCE|| +DELETE SERVER TRUNK RECORD|| +DELETE AGENT CONFERENCE|| +ADMIN CHANGE LOG|| +USER ADMIN CHANGE LOG|| +SECTION ADMIN CHANGE LOG|| +DETAIL ADMIN CHANGE LOG|| +ADMIN REPORT LOG|| +USER ADMIN REPORT LOG|| +DETAIL ADMIN REPORT LOG|| +AGENT CONFERENCE LIST|| +USERS TABLE|| +CAMPAIGNS TABLE|| +LISTS TABLE|| +INBOUND_GROUPS TABLE|| +CALL MENU TABLE|| +REMOTE_AGENTS TABLE|| +This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length|| +This field is where you put the users password. Must be at least 2 characters in length. A strong user password should be at least 8 characters in length and have lower case and upper case letters as well as at least one number|| +This field is where you put the users full name. Must be at least 2 characters in length|| +User Level|| +This menu is where you select the users user level. Must be a level of 1 to log into the agent screen, Must be level greater than 2 to log in as a closer, Must be user level 8 or greater to get into admin web section|| +This menu is where you select the users group that this user will belong to. There are several agent screen features that can be controlled through user group settings. If this field is left blank then the user cannot log in to the agent screen|| +Here is where you can set a default phone login value for when the user logs into the agent screen. This value will populate the phone_login automatically when the user logs in with their user-pass-campaign in the agent login screen|| +Here is where you can set a default phone pass value for when the user logs into the agent screen. This value will populate the phone_pass automatically when the user logs in with their user-pass-campaign in the agent login screen|| +This field defines whether the user is active in the system and can log in as an agent or manager. Default is Y|| +Hot Keys Active|| +This option if set to 1 allows the user to use the Hot Keys quick-dispositioning function in the agent screen|| +This option allows an agent to manually enter a new lead into the system and call them. This also allows the calling of any phone number from their agent screen and puts that call into their session. Use this option with caution|| +Agent Recording|| +This option can prevent an agent from doing any recordings after they log in to the agent screen. This option must be on for the agent screen to follow the campaign recording settings|| +Agent Transfers|| +This option can prevent an agent from opening the transfer - conference session in the agent screen. If this is disabled, the agent cannot third party call or blind transfer any calls|| +Agent Recording Override|| +This option will override whatever the option is in the campaign for recording. DISABLED will not override the campaign recording setting. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and reduce system load|| +This field shows whether the agent has web browser alerts enabled for when calls come into their agent screen session. Default is 0 for NO|| +This field gives you the ability to allow agent browser alerts to be enabled by the agent for when calls come into their agent screen session. Default is 0 for NO|| +This option if set to 1 allows the user to delete lists from the system|| +This option if set to 1 allows the user to delete campaigns from the system|| +This option if set to 1 allows the user to delete Inbound Groups from the system|| +This option if set to 1 allows the user to delete remote agents from the system|| +This option if set to 1 allows the user to load lead lists into the list table by way of the web based lead loader|| +This option allows the user to be able to delete lead filters from the system|| +This option allows the user to be able to delete call times records and state call times records from the system|| +This option allows the user to view the system web reports|| +This option allows the account to be used with the agent and non-agent API commands|| +This setting if set to 1 will allow a manager to remove phone numbers from the DNC lists in the system|| +This option will allow you to force a campaign calling stats refresh, even if the campaign is not active|| +select the first leads loaded into the list table|| +select the last leads loaded into the list table|| +This is the minimum number of leads the hopper loading script tries to keep in the hopper table for this campaign. If running VDhopper script every minute, make this slightly greater than the number of leads you go through in a minute|| +Setting this to Y will allow the system to automatically adjust the hopper based off the settings you have in your campaign. The formula it uses to do this is|| +Setting this to Y will allow the system to automatically remove excess leads from the hopper. Default is Y|| +This is where you set how many lines the system should use per active agent. zero 0 means auto dialing is off and the agents will click to dial each number. Otherwise the system will keep dialing lines equal to active agents multiplied by the dial level to arrive at how many lines this campaign on each server should allow. The ADAPT OVERRIDE checkbox allows you to force a new dial level even though the dial method is in an ADAPT mode. This is useful if there is a dramatic shift in the quality of leads and you want to drastically change the dial_level manually|| +This feature allows for agents to access extended alternate phone numbers for leads beyond the standard Alt Phone and Address3 fields that can be used in the agent screen for phone numbers beyond the main phone number. The Extended phone numbers can be dialed automatically using the Auto-Alt-Dial feature in the Campaign settings, but enabling this Agent Screen feature will also allow for the agent to call these numbers from their agent screen as well as edit their information. This feature is in development and is not currently available|| +This field is where you select the status to be used for Not Interested. If DNC is used and the campaign is set to use DNC then the phone number will be automatically added to the internal DNC list and possibly the campaign-specific DNC list if that is enabled in the campaign|| +orders by the random update value in the live_agents table|| +orders by the user_level of the agent as defined in the users table a higher user_level will receive more calls|| +This field allows you to leave out the phone_code field while dialing within the system. For instance if you are dialing in the UK from the UK you would have 44 in as your phone_code field for all leads, but you just want to dial 10 digits in your dial plan extensions.conf to place calls instead of 44 then 10 digits. Default is N|| +This field allows for the sending of a custom callerid number on the outbound calls. This is the number that would show up on the callerid of the person you are calling. The default is UNKNOWN. If you are using T1 or E1s to dial out this option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on, this will not work with Robbed-bit service -RBS- circuits. This will also work through most VOIP -SIP or IAX trunks- providers that allow dynamic outbound callerID. The custom callerID only applies to calls placed for the campaign directly, any 3rd party calls or transfers will not send the custom callerID. NOTE: Sometimes putting UNKNOWN or PRIVATE in the field will yield the sending of your default callerID number by your carrier with the calls. You may want to test this and put 0000000000 in the callerid field instead if you do not want to send you CallerID|| +When set to Y, this option allows you to use the security_phrase field in the list table as the CallerID to send out when placing for each specific lead. If this field has no CID in it then the Campaign CallerID defined above will be used instead. This option will disable the list CallerID Override if there is a CID present in the security_phrase field. Default is N. When set to AREACODE you have the ability to go into the AC-CID submenu and define multiple callerids to be used per areacode|| +This field allows for a custom recording extension to be used with the system. This allows you to use different extensions depending upon how long you want to allow a maximum recording and what type of codec you want to record in. The default exten is 8309 which if you follow the SCRATCH_INSTALL examples will record in the WAV format for up to one hour. Another option included in the examples is 8310 which will record in GSM format for up to one hour. The recording time can be lengthened by raising the setting in the Server Modification screen in the Admin section|| +These fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the agent screen will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, have the agent use the CONSULTATIVE checkbox, which does not work for third party non-agent consultative calls. For those just have the agent click the Dial With Customer button. Then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to an AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER, for instance if you want to do a call to a special IVR you have set to extension 83900 you would put AXFER83900 in the number-to-dial field|| +Allows agents to select a pause code when they click on the PAUSE button in the agent screen. Pause codes are definable per campaign at the bottom of the campaign view detail screen and they are stored in the agent_log table. Default is N. FORCE will force the agents to choose a PAUSE code if they click on the PAUSE button|| +The default list_id to be used when an agent places a manual call and a new lead record is created in the list table. Default is 999. This field can contain digits only|| +This defines what is sent out as the outbound callerID number from 3-way calls placed by the agent, CAMPAIGN uses the custom campaign callerID, CUSTOMER uses the number of the customer that is active on the agents screen and AGENT_PHONE uses the callerID for the phone that the agent is logged into. AGENT_CHOOSE allows the agent to choose which callerID to use for 3-way calls from a list of choices. CUSTOM_CID will use the Custom CID that is defined in the security_phrase field of the list table for the lead|| +If Vtiger integration is enabled in the system settings then this setting will define where the vtiger_search.php page will search for the phone number that was entered. There are 4 options that can be used in this field: LEAD- This option will search through the Vtiger leads only, ACCOUNT- This option will search through the Vtiger accounts and all contacts and sub-contacts for the phone number, VENDOR- This option will only search through the Vtiger vendors, ACCTID- This option works only for accounts and it will take the list vendor_lead_code field and try to search for the Vtiger account ID. If unsuccessful it will try any other methods listed that you have selected. Multiple options can be used for each search, but on large databases this is not recommended. Default is LEAD. UNIFIED_CONTACT- This option will use the beta Vtiger 5.1.0 feature to search by phone number and bring up a search page in Vtiger|| +If Vtiger integration is enabled in the system settings then this setting will define whether the user is logged into the Vtiger interface automatically when they login to the agent screen. Default is Y. The NEW_WINDOW option will open a new window upon login to the agent screen|| +If Vtiger integration is enabled in the system settings then this setting will define whether the status of the Vtiger Account will be updated with the status of the call after it has been dispositioned. Default is N|| +This is the custom address that clicking on the WEB FORM button in the agent screen will take you to for calls that come in on this list. If you want to use custom fields in a web form address, you need to add &CF_uses_custom_fields=Y as part of your URL|| +Internal DNC List|| +This is the color that displays in the agent client app when a call comes in on this group. It must be between 2 and 7 characters long. If this is a hex color definition you must remember to put a # at the beginning of the string or the agent screen will not work properly|| +This determines whether this inbound group is available to take calls. If this is set to inactive then the After Hours Action will be used on any calls coming into it|| +This is the custom address that clicking on the WEB FORM button in the agent screen will take you to for calls that come in on this group. If you want to use custom fields in a web form address, you need to add &CF_uses_custom_fields=Y as part of your URL|| +orders by the random update value in the live_agents table|| +orders by the user_level of the agent as defined in the users table a higher user_level will receive more calls|| +This field determines whether the inbound agent would have the fronter name - if there is one - displayed in the Status field when the call comes to the agent|| +These four fields allow for you to have two sets of Transfer Conference and DTMF presets. When the call or campaign is loaded, the agent screen will show two buttons on the transfer-conference frame and auto-populate the number-to-dial and the send-dtmf fields when pressed. If you want to allow Consultative Transfers, a fronter to a closer, have the agent use the CONSULTATIVE checkbox, which does not work for third party agent screen consultative calls. For those just have the agent click the Dial With Customer button. Then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to an AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER, for instance if you want to do a call to a special IVR you have set to extension 83900 you would put AXFER83900 in the number-to-dial field|| +This field allows for the overriding of the campaign call recording setting. This setting can be overridden by the user recording override setting. DISABLED will not override the campaign recording setting. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording|| +This the type of route that you set the DID to use. EXTEN will send calls to the extension entered below, VOICEMAIL will send calls directly to the voicemail box entered below, AGENT will send calls to an agent if they are logged in, PHONE will send the call to a phones entry selected below, IN_GROUP will send calls directly to the specified inbound group. Default is EXTEN. CALLMENU will send the call to the defined Call Menu|| +If AGENT is selected as the DID Route, then this is the Agent that calls will be sent to|| +If IN_GROUP is selected as the DID Route, then this is the call handling method used for these calls. CID will add a new lead record with every call using the CallerID as the phone number, CIDLOOKUP will attempt to lookup the phone number by the CallerID in the entire system, CIDLOOKUPRL will attempt to lookup the phone number by the CallerID in only one specified list, CIDLOOKUPRC will attempt to lookup the phone number by the CallerID in all of the lists that belong to the specified campaign, CLOSER is specified for Closer calls, ANI will add a new lead record with every call using the ANI as the phone number, ANILOOKUP will attempt to lookup the phone number by the ANI in the entire system, ANILOOKUPRL will attempt to lookup the phone number by the ANI in only one specified list, XDIGITID will prompt the caller for an X digit code before the call will be put into the queue, VIDPROMPT will prompt the caller for their ID number and will create a new lead record with the CallerID as the phone number and the ID as the Vendor ID, VIDPROMPTLOOKUP will attempt to lookup the ID in the entire system, VIDPROMPTLOOKUPRL will attempt to lookup the vendor ID by the ID in only one specified list, VIDPROMPTLOOKUPRC will attempt to lookup the vendor ID by the ID in all of the lists that belong to the specified campaign. Default is CID. If a CIDLOOKUP method is used with ALT, it will search the alt_phone field for the phone number if no matches are found for the main phone number. If a CIDLOOKUP method is used with ADDR3, it will search the address3 field for the phone number if no matches are found for the main phone number and optionally the alt_phone field|| +This is the starting User ID that is used when the remote agent entries are inserted into the system. If the Number of Lines is set higher than 1, this number is incremented by one until each line has an entry. Make sure you create a new user account with a user level of 4 or great if you want them to be able to use the vdremote.php page for remote web access of this account|| +Through the use of custom campaign statuses, you can have statuses that only exist for a specific campaign. The Status must be 1-8 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in the system as a disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a catogy that can be used for statistical analysis|| +Through the use of custom campaign hot keys, agents that use the agent web-client can hang up and disposition calls just by pressing a single key on their keyboard|| +If the Agent Pause Codes Active field is set to active then the agents will be able to select from these pause codes when they click on the PAUSE button on their screens. This data is then stored in the agent log. The Pause code must contain only letters and numbers and be less than 7 characters long. The pause code name can be no longer than 30 characters|| +This is the short name of a User group, try not to use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters|| +This is the description of the user group max of 40 characters|| +This option allows you to not let an agent log in to the agent interface if they have not logged into the timeclock. Default is N. There is an option to exempt admin users, levels 8 and 9|| +This option defines whether the agent will be able to see their call log for calls handled through the agent screen. Default is N for no or disabled|| +This option if set to Y will set the height and width of the agent screen to the size of the web browser window without any allowance for the Agents View, Calls in Queue View or Calls in Session view. Default is N for no or disabled|| +This is the short name of a Script. This needs to be a unique identifier. Try not to use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters|| +This is the title of a Script. This is a short summary of the script. max 50 characters, minimum of 2 characters. There should be no spaces or punctuation of any kind in theis field|| +This is where you can place comments for an agent screen Script such as -changed to free upgrade on Sept 23-. max 255 characters, minimum of 2 characters|| +This is where you place the content of an agent screen Script. Minimum of 2 characters. You can have customer information be auto-populated in this script using|| +where field is one of the following fieldnames|| +You can also use an iframe to load a separate window within the SCRIPT tab, here is an example with prepopulated variables|| +This is the short name of a Lead Filter. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters|| +This is where you can place comments for a Filter such as -calls all California leads-. max 255 characters, minimum of 2 characters|| +This is the short name of a Call Time Definition. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters|| +This is where you can place comments for a Call Time Definition such as -10am to 4pm with extra call state restrictions-. max 255 characters|| +This is the short name of a system Shift Definition. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters|| +This utility allows you to upload audio files to the web server so that they can be distributed to all of the system servers in a multi-server cluster. An important note, only two audio file types will work, .wav files that are PCM Mono 16bit 8k and .gsm files that are 8bit 8k. Please verify that your files are properly formatted before uploading them here|| +This is a more descriptive name of the Music On Hold entry. This is a short summary of the Music On Hold context and will show as a comment in the musiconhold conf file. max 255 characters, minimum of 2 characters|| +This is the actual Text To Speech data field that is sent to Cepstral for creation of the audio file to be played to the customer. you can use Speech Synthesis Markup Language -SSML- in this field, for example, <break time='1000ms'/> for a 1 second break. You can also use several variables such as first name, last name and title as system variables just like you do in a Script: --A--first_name--B--. If you have static audio files that you want to use based upon the value of one of the fields you can use those as well with C and D tags. The file names must be all lower case and they must be 8k 16bit pcm wav files. The field name must be the same but without the .wav in the filename. For example --C----A--address3--B----D-- would first find the value for address3, then it would try to find an audio file matching that value to put it into the prompt. Here is a list of the available variables|| +The basic web-based lead loader is designed simply to take a lead file - up to 8MB in size - that is either tab or pipe delimited and load it into the list table. The lead loader allows for field choosing and TXT- Plain Text, CSV- Comma Separated Values and XLS- Excel file formats. The lead loader does not do data validation, but it does allow you to check for duplicates in itself, within the campaign or within the entire system. Also, make sure that you have created the list that these leads are to be under so that you can use them. Here is a list of the fields in their proper order for the lead files|| +The layout of the file you are loading. "Standard Format" uses the pre-defined standard file format. "Custom layout" allows the user to define the layout of the file themselves. "Custom template" is a hybrid of the previous two options, which allows the user to use a custom format they have defined previously and saved using the Custom Template Maker|| +The login used for the phone user to login to the client applications, like the agent screen|| +The difference from Greenwich Mean time, or ZULU time where the phone is located. DO NOT ADJUST FOR DAYLIGHT SAVINGS TIME. This is used by the campaign to accurately display the system time and customer time, as well as accurately log when events happen|| +Agent Default User|| +This is to place a default value in the agent user field whenever this phone user opens the client app. Leave blank for no user|| +Agent Default Pass|| +This is to place a default value in the agent password field whenever this phone user opens the client app. Leave blank for no pass|| +Agent Default Campaign|| +This is to place a default value in the agent screen campaign field whenever this phone user opens the client app. Leave blank for no campaign|| +Agent Park Exten|| +This is the default Parking extension for client app. Verify that a different one works before you change this|| +Agent Park File|| +This is the default agent screen park extension file name for the client apps. Verify that a different one works before you change this. limited to 10 characters|| +This is the dial plan context that the agent screen, primarily uses. It is assumed that all numbers dialed by the client apps are using this context so it is a good idea to make sure this is the most wide context possible. verify with extensions.conf file before changing. default is default|| +This is the dial plan context that this phone will use to dial out. If you are running a call center and you do not want your agents to be able to dial out outside of the agent screen applicaiton for example, then you would set this field to a dialplan context that does not exist, something like agent-nodial. default is default|| +Not used anymore|| +Agent Default URL|| +This is the web address of the page used to do custom agent Web Form queries. default testing address is defined in the database schema|| +This is set to true if the call_log step is in place in the extensions.conf file for all outbound and hang up 'h' extensions to log all calls. This should always be 1 because it is manditory for many of the system features to work properly|| +Set to true to have client apps use the Asterisk Central Queue system. Required for the system to work and recommended for all phones|| +If enabled the agent screen will dial the next number on the list automatically upon disposition of a call unless they selected to PAUSE AGENT DIALING on the disposition screen|| +If enabled the agent screen will stop whatever recording is going on after each call has been dispositioned. Useful if you are doing a lot of recording or you are using a web form to trigger recording|| +If enabled, the server will send messages to the SIP phone to display on the phone display screen when logged into the agent web interface. Feature only works with SIP phones and requires sipsak application to be installed on the web server. Default is 0|| +If populated, and the Template ID is set to --NONE-- then the contents of this field are used as the conf file entries for this phone. generate conf files for this phones server must be set to Y for this to work. This field should NOT contain the [extension] line, that will be automatically generated|| +The ID of the group alias used by agents to dial out calls from the agent interface with different Caller IDs. no spaces or other special characters allowed. Must be between 2 and 20 characters in length|| +Max Trunks|| +This field will determine the maximum number of lines that the auto-dialer will attempt to call on this server. If you want to dedicate two full PRI T1s to outbound dialing on a server then you would set this to 46. Any inbound or manual dial calls will be counted against this total as well. Default is 96|| +auto dial extension|| +The default extension if none is present in the campaign to send calls to for auto dialing. Default is|| +Setting this option to Y will enable logging of all system related scripts to their text log files. Setting this to N will stop writing logs to files for these processes, also the screen logging of asterisk will be disabled if this is set to N when Asterisk is started. Default is Y|| +Setting this option to NONE will disable output from all system related AGI scripts. Setting this to STDERR will send the AGI output to the Asterisk CLI. Setting this to FILE will send the output to a file in the logs directory. Setting this to BOTH will send output to both the Asterisk CLI and a log file. Default is FILE|| +Balance Dialing|| +Setting this field to Y will allow the server to place balance calls for campaigns in the system so that the defined dial level can be met even if there are no agents logged into that campaign on this server. Default is N|| +Balance Rank|| +This field allows you to set the order in which this server is to be used for balance dialing, if balance dialing is enabled. The server with the highest rank will be used first in placing Balance fill calls. Default is 0|| +Balance Offlimits|| +This setting defines the number of trunks to not allow the balance dialing processes to use. For example if you have 40 max trunks and balance offlimits is set to 10 you will only be able to use 30 trunk lines for balance dialing. Default is 0|| +Some systems require setting up telephony servers in pairs. This setting is where you can put the server IP of another server that this server is twinned with. Default is empty for disabled|| +If Asterisk is not running on this server, or if the dialing processes should not be using this server, or if are only using this server for other scripts like the hopper loading script you would want to set this to N. Default is Y|| +Setting this option to N will prevent agents from being able to log in to this server through the agent screen. This is very useful when using a phone login load balanced setup. Default is Y|| +If you would like the system to auto-generate asterisk conf files based upon the phones entries, carrier entries and load balancing setup within the system then set this to Y. Default is Y|| +Recording Limit|| +This field is where you set the maximum number of minutes that a call recording initiated by the system can be. Default is 60 minutes|| +This field is used if you have not selected a template to use, and it is where you can enter in the specific account settings to be used for this carrier. If you will be taking in inbound calls from this carrier trunk you might want to set the context=trunkinbound within this field so that you can use the DID handling process within the system|| +This field is where you put the meetme conference dialplan number. It is also recommended that the meetme number in meetme.conf matches this number for each entry. This is for the conferences in the astGUIclient user screen and is used for leave-3way-call functionality in the system|| +Server Trunks allows you to restrict the outgoing lines that are used on this server for campaign dialing on a per-campaign basis. You have the option to reserve a specific number of lines to be used by only one campaign as well as allowing that campaign to run over its reserved lines into whatever lines remain open, as long at the total lines used by the system on this server is less than the Max Trunks setting. Not having any of these records will allow the campaign that dials the line first to have as many lines as it can get under the Max Trunks setting|| +Agent Disable Display|| +This field is used to select when to show an agent notices when their session has been disabled by the system, a manager action or by an external measure. The NOT_ACTIVE setting will disable the message on the agents screen. The LIVE_AGENT setting will only display the disabled message when the agents auto_calls record has been removed, such as during a force logout or emergency logout. Default is ALL|| +If set to 1, this will allow the sipsak phones table setting to work if the phone is set to the SIP protocol. The server will send messages to the SIP phone to display on the phone display when logged into the system. This feature only works with SIP phones and requires sipsak application to be installed on the web server that the agent is logged into. Default is 0|| +This menu allows you to choose the format of the date and time that shows up at the top of the agent screen. The options for this setting are: default is|| +This menu allows you to choose the format of the customer date and time that shows up at the top of the Customer Information section of the agent screen. The options for this setting are: default is|| +This menu allows you to choose the format of the customer phone number that shows up in the status section of the agent screen. The options for this setting are: default is|| +This is the web directory that your administation web content, like admin.php, are in. To figure out your Admin web directory, it is everything that is between the domain name and the admin.php in the URL on this page, without the beginning and ending slashes|| +This option allows you to enable or disable outbound auto-dialing within the system, setting this field to 0 will remove the LISTS and FILTERS sections and many fields from the Campaign Modification screens. Manual entry dialing will still be allowable from within the agent screen, but no list dialing will be possible. Default is 1 for active|| +This setting allows you to enable the User Territories settings from the user modification screen. This feature was added to allow for more integration with a customized Vtiger installation but can have applications in system by itself as well. Default is 0 for disabled|| +This setting enables the CallCard features to allow for callers to use pin numbers and card_ids that have a balance of minutes and those balances can have agent talk time on customer calls to in-groups deducted. Default is 0 for disabled|| +This option allows you to select the reports that you want to have use the MySQL slave database as defined in the option above instead of the master database that your live system is running on. You must set up the MySQL slave replication before you can enable this option. Default is empty for disabled|| +These 19 fields allow you to set the name as it will appear in the agent interface as well as the administrative modify lead page. Default is empty which will use the hard-coded defaults in the agent interface. You can also set a label to ---HIDE--- to hide both the label and the field|| +This setting allows you to define whether the system will insert log entries into the queue_log database table as Asterisk Queues activity does. QueueMetrics is a standalone, closed-source statistical analysis program. You must have QueueMetrics already installed and configured before enabling this feature. Default is 0|| +This is the server ID that all contact center logs going into the QueueMetrics database will use as an identifier for each record|| +This field is used to allow for prepending of one of the list data fields in front of the phone number of the customer for customized QueueMetrics reports. Default is NONE to not populate anything|| +This option affects how the system will log the logins and logouts of an agent in the queue_log. Default is STANDARD to use standard AGENTLOGIN AGENTLOGOFF, CALLBACK will use AGENTCALLBACKLOGIN and AGENTCALLBACKLOGOFF that QM will parse differently, NONE will not log any logins and logouts within queue_log|| +This setting allows you to enable Vtiger integration with the system. Currently links to Vtiger admin and search as well as user replication are the only integration features available. Default is 0|| +Through the use of system statuses, you can have statuses that exist for all campaigns and in-groups. The Status must be 1-6 characters in length, the description must be 2-30 characters in length and Selectable defines whether it shows up in the system as an agent disposition. The human_answered field is used when calculating the drop percentage, or abandon rate. Setting human_answered to Y will use this status when counting the human-answered calls. The Category option allows you to group several statuses into a category that can be used for statistical analysis. There are also 5 additional settings that will define the kind of status: sale, dnc, customer contact, not interested, unworkable, scheduled callback|| +These 19 fields allow you to set the name as it will appear in the agent interface as well as the administrative modify lead page. Default is empty which will use the hard-coded defaults in the agent interface. You can also set a label to ---HIDE--- to hide both the label and the field|| +The Email Accounts management section allows you to create, copy, and delete email account settings that will allow you to have email messages come into your system and be treated as if they were phone calls to agents. EMAIL ACCOUNTS MUST BE SET UP BY YOU AND AN EMAIL SERVICE PROVIDER - THAT IS NOT COVERED BY THIS MODULE|| +This is the action that will be taken when a new email is found in the account. EMAIL means all email messages will be inserted into the list table as a new lead. EMAILLOOKUP will search the entire list table for the email address in the email column - if the lead is found, that lead list ID will be used in the record that goes into the email_list table. EMAILLOOKUPRC does the same, but it will only search lists belonging to the campaign selected in the In-Group Campaign ID box below. EMAILLOOKUPRL will only search one particular list, which is the one entered into the In-Group List ID box below|| +The custom template maker allows you to define your own file layouts for use with the list loader and also delete them, if necessary. If you frequently upload files that are in a consistent layout other than the standard layout, you may find this tool helpful. The saved layout will work on any uploaded file it matches, regardless of file type or delimiter|| +Once you have loaded a sample lead file matching the layout you want to make into a template and select a list ID to load leads into, all of the available columns from the list table and the custom table for the list you selected (if any) will be displayed here. Columns highlighted in blue are standard columns from the list table. Columns highlighted in pink belong to the custom table for the selected list. Each column listed has a drop-down menu, which should be populated with the fields from the first row of the sample lead file you uploaded. Assign the appropriate fields to the appropriate columns and press SUBMIT TEMPLATE to create your template. You do not need to assign every field to a column, and you do not need to assign every column a field. For details on the standard list columns, click|| +The Quality Control - QC function has its own set of status codes separate from those within the call handling functions of the system. QC status codes must be between 2 and 8 characters in length and contain no special characters like a space or colon. The QC status code description must be between 2 and 30 characters in length. For these functions to work, you must have QC enabled in the System Settings|| ########################## CHANGES TO EXISTING PHRASES IN ADMIN TRANSLATION diff --git a/www/agc/active_list_refresh.php b/www/agc/active_list_refresh.php index 0deb5190..30e84af2 100644 --- a/www/agc/active_list_refresh.php +++ b/www/agc/active_list_refresh.php @@ -124,7 +124,7 @@ $NOW_TIME = date("Y-m-d H:i:s"); if (!isset($query_date)) {$query_date = $NOW_DATE;} $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/api.php b/www/agc/api.php index 6df4dcf3..fb1f66d1 100644 --- a/www/agc/api.php +++ b/www/agc/api.php @@ -66,10 +66,11 @@ # 121124-2354 - Added Other Campaign DNC option # 130328-0010 - Converted ereg to preg functions # 130603-2221 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-1526 - Added optional encrypted passwords compatibility # -$version = '2.8-32'; -$build = '130603-2221'; +$version = '2.8-33'; +$build = '130705-1526'; $startMS = microtime(); @@ -338,7 +339,7 @@ else else { $auth=0; - $auth_message = user_authorization($user,$pass,'',0); + $auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/astguiclient.php b/www/agc/astguiclient.php index 1b34504c..97cf2394 100644 --- a/www/agc/astguiclient.php +++ b/www/agc/astguiclient.php @@ -122,7 +122,7 @@ $month_old = mktime(0, 0, 0, date("m"), date("d")-7, date("Y")); $past_month_date = date("Y-m-d H:i:s",$month_old); $auth=0; -$auth_message = user_authorization($user,$pass,'',1); +$auth_message = user_authorization($user,$pass,'',1,0,0); if ($auth_message == 'GOOD') {$auth=1;} @@ -181,12 +181,10 @@ else { if($auth>0) { - $office_no=strtoupper($user); - $password=strtoupper($pass); - $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and pass='$pass' and active='Y';"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; + $stmt="SELECT full_name,user_level from vicidial_users where user='$user' and active='Y';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); diff --git a/www/agc/bp.pl b/www/agc/bp.pl new file mode 100644 index 00000000..32d9f69f --- /dev/null +++ b/www/agc/bp.pl @@ -0,0 +1,214 @@ +#!/usr/bin/perl +# +# bp.pl version 2.8 +# +# Bcrypt password hashing script to be used for authentication +# +# IMPORTANT !!!!!!!!!!!!! +# The Crypt::Eksblowfish::Bcrypt perl module is REQUIRED for this script +# +# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# +# +# CHANGES +# +# 130630-1044 - First build +# + +$DB=0; +$DBX=0; + +use DBI; +use Crypt::Eksblowfish::Bcrypt qw(en_base64); + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n"; + print " [--pass=XXX] = password input\n"; + print " [--salt=XXX] = overide the system salt\n"; + print " [--cost=XX] = overide the system cost\n"; + print " [--debug] = enable debugging output\n"; + print " [--debugX] = enable extra debugging output\n"; + print " [--help] = this help screen\n"; + print "\n"; + + exit; + } + else + { + if ($args =~ /--debug/i) + {$DB=1;} + if ($args =~ /--debugX/i) + {$DBX=1;} + if ($args =~ /--pass=/i) + { + @data_in = split(/--pass=/,$args); + $pass = $data_in[1]; + $pass =~ s/ .*//gi; + if ($DB > 0) + {print "\n----- PASS: $pass -----\n\n";} + } + if ($args =~ /--salt=/i) + { + @data_in = split(/--salt=/,$args); + $CLIsalt = $data_in[1]; + $CLIsalt =~ s/ .*//gi; + if (length($CLIsalt) eq 16) + { + $newCLIsalt = en_base64($CLIsalt); + if ($DB > 0) + {print "\n----- ENCRYPTING SALT OVERRIDE: $CLIsalt -----\n";} + $CLIsalt = $newCLIsalt; + } + if (length($CLIsalt) ne 22) + { + if ($DB > 0) + {print "\n----- INVALID SALT OVERRIDE, USING DEFAULT: $CLIsalt -----\n\n";} + $CLIsalt = ''; + } + else + { + if ($DB > 0) + {print "\n----- SALT OVERRIDE: $CLIsalt -----\n\n";} + } + } + if ($args =~ /--cost=/i) + { + @data_in = split(/--cost=/,$args); + $CLIcost = $data_in[1]; + $CLIcost =~ s/ .*//gi; + if ($DB > 0) + {print "\n----- COST OVERRIDE: $CLIcost -----\n\n";} + } + } + } +else + { + print "NO INPUT, NOTHING TO DO, EXITING...\n"; + exit; + } +if (length($pass) < 1) + { + print "NO PASSWORD INPUT, NOTHING TO DO, EXITING...\n"; + exit; + } +### end parsing run-time options ### + + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +if (!$VARDB_port) {$VARDB_port='3306';} + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +##### Get the settings from system_settings ##### +$stmtA = "SELECT pass_hash_enabled,pass_key,pass_cost FROM system_settings;"; +# print "$stmtA\n"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $pass_hash_enabled = $aryA[0]; + $pass_key = $aryA[1]; + $pass_cost = $aryA[2]; + if (length($pass_key) eq 16) + {$newpass_key = en_base64($pass_key);} + } +$sthA->finish(); +if ($DBX > 0) {print "SYSTEM SETTINGS: |$pass_hash_enabled|$pass_key|$newpass_key|$pass_cost|\n";} + +if (length($CLIsalt) > 0) + { + if ($DBX > 0) {print "SALT OVERRIDDEN: |$pass_key|$newpass_key|$CLIsalt|\n";} + $salt = $CLIsalt; + } +else + {$salt = $newpass_key;} + +if (length($CLIcost) > 0) + { + if ($DBX > 0) {print "COST OVERRIDDEN: |$pass_cost|$CLIcost|\n";} + $cost = $CLIcost; + } +else + {$cost = $pass_cost;} +while (length($cost) < 2) + {$cost = "0$cost";} + + +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl timing of less than one second +($START_s_hires, $START_usec) = gettimeofday(); + + +# Set the cost to $cost and append a NUL +$settings = '$2a$'.$cost.'$'.$salt; + +# Encrypt it +$pass_hash = Crypt::Eksblowfish::Bcrypt::bcrypt($pass, $settings); + +$pass_hash_length = length($pass_hash); + +$only_pass_hash = substr($pass_hash,29,31); + +if ($DB > 0) {print "PASS HASH: |$pass_hash_length|$pass_hash|$only_pass_hash|\n";} + +($END_s_hires, $END_usec) = gettimeofday(); +$START_time = $START_s_hires . '.' . sprintf("%06s", $START_usec); +$END_time = $END_s_hires . '.' . sprintf("%06s", $END_usec); +$RUN_time = ($END_time - $START_time); +$RUN_time = sprintf("%.6f", $RUN_time); +if ($DBX > 0) + {print "bcrypt time: |$RUN_time ($END_time - $START_time)|\n";} + +print "PHASH: $only_pass_hash\n"; + +exit; diff --git a/www/agc/call_log_display.php b/www/agc/call_log_display.php index 6adc9e0f..52b21bd0 100644 --- a/www/agc/call_log_display.php +++ b/www/agc/call_log_display.php @@ -31,6 +31,7 @@ # 90508-0727 - Changed to PHP long tags # 130328-0028 - Converted ereg to preg functions # 130603-2219 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-1524 - Added optional encrypted passwords compatibility # require("dbconnect.php"); @@ -72,7 +73,7 @@ $NOW_TIME = date("Y-m-d H:i:s"); if (!isset($query_date)) {$query_date = $NOW_DATE;} $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/conf_exten_check.php b/www/agc/conf_exten_check.php index bfb46a0a..2183e119 100644 --- a/www/agc/conf_exten_check.php +++ b/www/agc/conf_exten_check.php @@ -59,10 +59,11 @@ # 121028-2305 - Added extra check on session_name to validate agent screen requests # 130328-0011 - Converted ereg to preg functions # 130603-2218 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-1524 - Added optional encrypted passwords compatibility # -$version = '2.8-34'; -$build = '130603-2218'; +$version = '2.8-35'; +$build = '130705-1524'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=39; $one_mysql_log=0; @@ -120,12 +121,12 @@ if ($qm_conf_ct > 0) if ($non_latin < 1) { $user=preg_replace("/[^\-_0-9a-zA-Z]/i","",$user); - $pass=preg_replace("/[^\-_0-9a-zA-Z]/i","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); } else { $user = preg_replace("/\'|\"|\\\\|;/","",$user); - $pass = preg_replace("/\'|\"|\\\\|;/","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); } $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); @@ -149,7 +150,7 @@ $random = (rand(1000000, 9999999) + 10000000); $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,1,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/deactivate_lead.php b/www/agc/deactivate_lead.php index 8eae0b12..8d1908af 100644 --- a/www/agc/deactivate_lead.php +++ b/www/agc/deactivate_lead.php @@ -103,7 +103,7 @@ if (preg_match("/$TD$dispo$TD/",$sale_status)) } $auth=0; - $auth_message = user_authorization($user,$pass,'',0); + $auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/dispo_move_list.php b/www/agc/dispo_move_list.php index 31ef261a..0f5ae63c 100644 --- a/www/agc/dispo_move_list.php +++ b/www/agc/dispo_move_list.php @@ -147,7 +147,7 @@ if ($match_found > 0) $server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip); $auth=0; - $auth_message = user_authorization($user,$pass,'',0); + $auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/functions.php b/www/agc/functions.php index a03ab217..e0e36fb5 100644 --- a/www/agc/functions.php +++ b/www/agc/functions.php @@ -16,11 +16,12 @@ # 120213-1709 - Commented out default of READONLY fields since they cannot change # 130328-0018 - Converted ereg to preg functions # 130603-2208 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-2004 - Added optional encrypted passwords compatibility # ##### BEGIN validate user login credentials, check for failed lock out ##### -function user_authorization($user,$pass,$user_option,$user_update) +function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$return_hash) { require("dbconnect.php"); @@ -49,13 +50,28 @@ function user_authorization($user,$pass,$user_option,$user_update) $browser = getenv("HTTP_USER_AGENT"); $LOCK_over = ($STARTtime - 900); # failed login lockout time is 15 minutes(900 seconds) $LOCK_trigger_attempts = 10; + $pass_hash=''; - $user = preg_replace("/\'|\"|\\\\|;/","",$user); - $pass = preg_replace("/\'|\"|\\\\|;/","",$pass); + $user = preg_replace("/\'|\"|\\\\|;| /","",$user); + $pass = preg_replace("/\'|\"|\\\\|;| /","",$pass); - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );"; + $passSQL = "pass='$pass'"; + + if ($SSpass_hash_enabled > 0) + { + if ($bcrypt < 1) + { + $pass_hash = exec("./bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + } + else + {$pass_hash = $pass;} + $passSQL = "pass_hash='$pass_hash'"; + } + + $stmt="SELECT count(*) from vicidial_users where user='$user' and $passSQL and user_level > 0 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );"; if ($user_option == 'MGR') - {$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and manager_shift_enforcement_override='1' and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} + {$stmt="SELECT count(*) from vicidial_users where user='$user' and $passSQL and manager_shift_enforcement_override='1' and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); @@ -111,6 +127,8 @@ function user_authorization($user,$pass,$user_option,$user_update) if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05013',$user,$server_ip,$session_name,$one_mysql_log);} } $auth_key='GOOD'; + if ( ($return_hash == '1') and ($SSpass_hash_enabled > 0) and (strlen($pass_hash) > 12) ) + {$auth_key .= "|$pass_hash";} } return $auth_key; } diff --git a/www/agc/inbound_popup.php b/www/agc/inbound_popup.php index 84fa912b..8ee83a01 100644 --- a/www/agc/inbound_popup.php +++ b/www/agc/inbound_popup.php @@ -84,7 +84,7 @@ $DO = '-1'; if ( (preg_match("/^Zap/i",$channel)) and (!preg_match("/-/i",$channel)) ) {$channel = "$channel$DO";} $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/live_exten_check.php b/www/agc/live_exten_check.php index ccf5d226..f11aa1d5 100644 --- a/www/agc/live_exten_check.php +++ b/www/agc/live_exten_check.php @@ -32,6 +32,7 @@ # 90508-0727 - Changed to PHP long tags # 130328-0027 - Converted ereg to preg functions # 130603-2214 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-1522 - Added optional encrypted passwords compatibility # require("dbconnect.php"); @@ -58,7 +59,7 @@ if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"]; elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];} $user=preg_replace("/[^0-9a-zA-Z]/","",$user); -$pass=preg_replace("/[^0-9a-zA-Z]/","",$pass); +$pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); $server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip); @@ -73,7 +74,7 @@ $NOW_TIME = date("Y-m-d H:i:s"); if (!isset($query_date)) {$query_date = $NOW_DATE;} $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/manager_send.php b/www/agc/manager_send.php index 9f667e05..53c12e26 100644 --- a/www/agc/manager_send.php +++ b/www/agc/manager_send.php @@ -115,10 +115,11 @@ # 130108-1641 - Change for Asterisk 1.8 compatibility # 130328-0008 - Converted ereg to preg functions # 130603-2205 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-1521 - Added optional encrypted passwords compatibility # -$version = '2.8-62'; -$build = '130603-2205'; +$version = '2.8-63'; +$build = '130705-1521'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=119; $one_mysql_log=0; @@ -242,13 +243,13 @@ if ($qm_conf_ct > 0) if ($non_latin < 1) { $user=preg_replace("/[^-_0-9a-zA-Z]/","",$user); - $pass=preg_replace("/[^-_0-9a-zA-Z]/","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); $secondS = preg_replace("/[^0-9]/","",$secondS); } else { $user = preg_replace("/\'|\"|\\\\|;/","",$user); - $pass = preg_replace("/\'|\"|\\\\|;/","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); } $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); @@ -266,7 +267,7 @@ $NOWnum = date("YmdHis"); if (!isset($query_date)) {$query_date = $NOW_DATE;} $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,1,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/park_calls_display.php b/www/agc/park_calls_display.php index a6beb19d..eb82f4ae 100644 --- a/www/agc/park_calls_display.php +++ b/www/agc/park_calls_display.php @@ -63,7 +63,7 @@ $NOW_TIME = date("Y-m-d H:i:s"); if (!isset($query_date)) {$query_date = $NOW_DATE;} $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/phone_only.php b/www/agc/phone_only.php index 884a5fa7..13648a51 100644 --- a/www/agc/phone_only.php +++ b/www/agc/phone_only.php @@ -335,7 +335,7 @@ else else { $auth=0; - $auth_message = user_authorization($user,$pass,'',1); + $auth_message = user_authorization($user,$pass,'',1,0,0); if ($auth_message == 'GOOD') {$auth=1;} diff --git a/www/agc/timeclock.php b/www/agc/timeclock.php index 63170715..026d1ac5 100644 --- a/www/agc/timeclock.php +++ b/www/agc/timeclock.php @@ -12,6 +12,7 @@ # 100621-1023 - Added admin_web_directory variable # 130328-0021 - Converted ereg to preg functions # 130603-2211 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-2010 - Added optional encrypted passwords compatibility # $version = '2.8-8'; @@ -116,7 +117,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { ### see if user/pass exist for this user in vicidial_users table $valid_user=0; - $auth_message = user_authorization($user,$pass,'',1); + $auth_message = user_authorization($user,$pass,'',1,0,0); if ($auth_message == 'GOOD') {$valid_user=1;} @@ -164,7 +165,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) ### VALID USER/PASS, CONTINUE ### get name and group for this user - $stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass' and active='Y';"; + $stmt="SELECT full_name,user_group from vicidial_users where user='$user' and active='Y';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index db5c184f..4e899b56 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -332,10 +332,11 @@ # 130603-2207 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes # 130615-1126 - Added recording_id to dispo url # 130617-0805 - Fixed issue with scheduled callbacks and campaign presets -# +# 130705-1512 - Added optional encrypted passwords compatibility +# -$version = '2.8-230'; -$build = '130617-0805'; +$version = '2.8-231'; +$build = '130705-1512'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=533; $one_mysql_log=0; @@ -566,6 +567,8 @@ if (isset($_GET["inbound_email_groups"])) {$inbound_email_groups=$_GET["inboun elseif (isset($_POST["inbound_email_groups"])) {$inbound_email_groups=$_POST["inbound_email_groups"];} if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} +if (isset($_GET["orig_pass"])) {$orig_pass=$_GET["orig_pass"];} + elseif (isset($_POST["orig_pass"])) {$orig_pass=$_POST["orig_pass"];} header ("Content-type: text/html; charset=utf-8"); @@ -762,7 +765,8 @@ if ($qm_conf_ct > 0) if ($non_latin < 1) { $user=preg_replace("/[^-_0-9a-zA-Z]/","",$user); - $pass=preg_replace("/[^-_0-9a-zA-Z]/","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); + $orig_pass=preg_replace("/[^-_0-9a-zA-Z]/","",$orig_pass); $length_in_sec = preg_replace("/[^0-9]/","",$length_in_sec); $phone_code = preg_replace("/[^0-9]/","",$phone_code); $phone_number = preg_replace("/[^0-9a-zA-Z]/","",$phone_number); @@ -770,7 +774,8 @@ if ($non_latin < 1) else { $user = preg_replace("/\'|\"|\\\\|;/","",$user); - $pass = preg_replace("/\'|\"|\\\\|;/","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); + $orig_pass = preg_replace("/\'|\"|\\\\|;/","",$orig_pass); } $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); @@ -791,7 +796,7 @@ if ($ACTION == 'LogiNCamPaigns') else { $auth=0; - $auth_message = user_authorization($user,$pass,'',0); + $auth_message = user_authorization($user,$pass,'',0,1,0); if ($auth_message == 'GOOD') {$auth=1;} @@ -3039,7 +3044,7 @@ if ($ACTION == 'AlertControl') if (preg_match('/ON/',$stage)) {$stage = '1';} else {$stage = '0';} - $stmt = "UPDATE vicidial_users set alert_enabled='$stage' where user='$user' and pass='$pass';"; + $stmt = "UPDATE vicidial_users set alert_enabled='$stage' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'000185',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6012,7 +6017,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_start_call_url = preg_replace('/--A--security_phrase--B--/i',urlencode(trim($security_phrase)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--comments--B--/i',urlencode(trim($comments)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--user--B--/i',urlencode(trim($user)),$VDCL_start_call_url); - $VDCL_start_call_url = preg_replace('/--A--pass--B--/i',urlencode(trim($pass)),$VDCL_start_call_url); + $VDCL_start_call_url = preg_replace('/--A--pass--B--/i',urlencode(trim($orig_pass)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--campaign--B--/i',urlencode(trim($campaign)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--phone_login--B--/i',urlencode(trim($phone_login)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--original_phone_login--B--/i',urlencode(trim($original_phone_login)),$VDCL_start_call_url); @@ -6947,7 +6952,7 @@ if ($ACTION == 'VDADcheckINCOMINGemail') $VDCL_start_call_url = preg_replace('/--A--security_phrase--B--/i',urlencode(trim($security_phrase)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--comments--B--/i',urlencode(trim($comments)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--user--B--/i',urlencode(trim($user)),$VDCL_start_call_url); - $VDCL_start_call_url = preg_replace('/--A--pass--B--/i',urlencode(trim($pass)),$VDCL_start_call_url); + $VDCL_start_call_url = preg_replace('/--A--pass--B--/i',urlencode(trim($orig_pass)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--campaign--B--/i',urlencode(trim($campaign)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--phone_login--B--/i',urlencode(trim($phone_login)),$VDCL_start_call_url); $VDCL_start_call_url = preg_replace('/--A--original_phone_login--B--/i',urlencode(trim($original_phone_login)),$VDCL_start_call_url); @@ -9424,7 +9429,7 @@ if ($ACTION == 'updateDISPO') $dispo_call_url = preg_replace('/--A--security_phrase--B--/i',"$security_phrase",$dispo_call_url); $dispo_call_url = preg_replace('/--A--comments--B--/i',"$comments",$dispo_call_url); $dispo_call_url = preg_replace('/--A--user--B--/i',"$user",$dispo_call_url); - $dispo_call_url = preg_replace('/--A--pass--B--/i',"$pass",$dispo_call_url); + $dispo_call_url = preg_replace('/--A--pass--B--/i',"$orig_pass",$dispo_call_url); $dispo_call_url = preg_replace('/--A--campaign--B--/i',"$campaign",$dispo_call_url); $dispo_call_url = preg_replace('/--A--phone_login--B--/i',"$phone_login",$dispo_call_url); $dispo_call_url = preg_replace('/--A--original_phone_login--B--/i',"$original_phone_login",$dispo_call_url); @@ -10143,7 +10148,7 @@ if ($ACTION == 'PauseCodeSubmit') ################################################################################ if ($ACTION == 'AGENTSview') { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass'"; + $stmt="SELECT user_group from vicidial_users where user='$user';"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00225',$user,$server_ip,$session_name,$one_mysql_log);} diff --git a/www/agc/vdc_email_display.php b/www/agc/vdc_email_display.php index 85880a6b..662ff52f 100644 --- a/www/agc/vdc_email_display.php +++ b/www/agc/vdc_email_display.php @@ -14,6 +14,7 @@ # 130127-0027 - Better non-latin characters support # 130328-0007 - Converted ereg to preg functions # 130603-2210 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes +# 130705-1515 - Added optional encrypted passwords compatibility # require("dbconnect.php"); @@ -116,12 +117,12 @@ if ($allow_emails<1) if ($non_latin < 1) { $user=preg_replace("/[^-_0-9a-zA-Z]/","",$user); - $pass=preg_replace("/[^-_0-9a-zA-Z]/","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); } else { $user = preg_replace("/\'|\"|\\\\|;/","",$user); - $pass = preg_replace("/\'|\"|\\\\|;/","",$pass); + $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); } @@ -132,7 +133,7 @@ if (!isset($ACTION)) {$ACTION="refresh";} if (!isset($query_date)) {$query_date = $NOW_DATE;} $auth=0; -$auth_message = user_authorization($user,$pass,'',0); +$auth_message = user_authorization($user,$pass,'',0,0,0); if ($auth_message == 'GOOD') {$auth=1;} @@ -308,7 +309,7 @@ if ($lead_id) { ?> - VICIDIAL email frame + AGENT email frame \n"; +$HEADER.="\n"; +$HEADER.="\n"; +$HEADER.="\n"; +$HEADER.="\n"; +$HEADER.="\n"; +$HEADER.="\n"; +$HEADER.="$report_name\n"; + +$short_header=1; + +$MAIN.="
"; +$MAIN.="
\n"; +$MAIN.=""; + +$MAIN.=""; + +$MAIN.="
\n"; +$MAIN.="\n"; +$MAIN.="Date:\n"; +$MAIN.=""; +$MAIN.="\n"; + +$MAIN.="

"; + +$MAIN.="
to
"; + +$MAIN.="
Server IP:
\n"; +$MAIN.="
SIP Response:
"; +$MAIN.=""; +$MAIN.="
\n"; +$MAIN.="

\n"; +$MAIN.="
\n"; +$MAIN.="
\n";
+
+if ($SUBMIT && $query_date) {
+		$stmt="SELECT * From vicidial_dial_log where call_date>='$query_date $query_date_D' and call_date<='$query_date $query_date_T' $server_ip_SQL $sip_hangup_cause_SQL order by call_date asc";
+		$rslt=mysql_query($stmt, $link);
+
+		if (!$lower_limit) {$lower_limit=1;}
+		if ($lower_limit+999>=mysql_num_rows($rslt)) {$upper_limit=($lower_limit+mysql_num_rows($rslt)%1000)-1;} else {$upper_limit=$lower_limit+999;}
+		$MAIN.="--- DIAL LOG RECORDS FOR $query_date, $query_date_D TO $query_date_T $server_rpt_string, $HC_rpt_string\n --- RECORDS #$lower_limit-$upper_limit               [DOWNLOAD]\n";
+		$CSV_text="\"CALLER CODE\",\"LEAD ID\",\"SERVER IP\",\"CALL DATE\",\"EXTENSION\",\"CHANNEL\",\"CONTEXT\",\"TIMEOUT\",\"OUTBOUND CID\",\"SIP HANGUP CAUSE\",\"UNIQUE ID\",\"SIP HANGUP REASON\"\n";
+
+		$dial_log_rpt="+----------------------+-----------+-----------------+---------------------+----------------------+----------------------------------------------------+----------------------+---------+------------------------------------------+--------+----------------------+----------------------------------------------------+\n";
+		$dial_log_rpt.="|                      |           |                 |                     |                      |                                                    |                      |         |                                          | SIP    |                      |                                                    |\n";
+		$dial_log_rpt.="|                      |           |                 |                     |                      |                                                    |                      |         |                                          | HANGUP |                      |                                                    |\n";
+		$dial_log_rpt.="| CALLER CODE          | LEAD ID   | SERVER IP       | CALL DATE           | EXTENSION            | CHANNEL                                            | CONTEXT              | TIMEOUT | OUTBOUND CID                             | CAUSE  | UNIQUE ID            | SIP HANGUP REASON                                  |\n";
+		$dial_log_rpt.="+----------------------+-----------+-----------------+---------------------+----------------------+----------------------------------------------------+----------------------+---------+------------------------------------------+--------+----------------------+----------------------------------------------------+\n";
+		if ($DB) {$dial_log_rpt.=$stmt."\n";}
+
+		if(mysql_num_rows($rslt)>0) {
+			$i=0;
+			while($row=mysql_fetch_array($rslt)) {
+				$i++;
+				if (strlen($row["extension"])>20) {$row["extension"]=substr($row["extension"], 0, 17)."...";}
+				if (strlen($row["caller_code"])>20) {$row["caller_code"]=substr($row["caller_code"], 0, 17)."...";}
+				if (strlen($row["context"])>20) {$row["context"]=substr($row["context"], 0, 17)."...";}
+				if (strlen($row["outbound_cid"])>40) {$row["outbound_cid"]=substr($row["outbound_cid"], 0, 37)."...";}
+				if ($i>=$lower_limit && $i<=$upper_limit) {
+					if (strlen($row["channel"])>50) {
+						$dial_log_rpt.="| ";
+						$dial_log_rpt.=sprintf("%-20s",substr($row["caller_code"], 0, 20))." | ";
+						$dial_log_rpt.=sprintf("%-9s",$row["lead_id"])." | ";
+						$dial_log_rpt.=sprintf("%-15s",$row["server_ip"])." | ";
+						$dial_log_rpt.=sprintf("%-19s",$row["call_date"])." | ";
+						$dial_log_rpt.=sprintf("%-20s", substr($row["extension"], 0, 20))." | ";
+						$dial_log_rpt.=sprintf("%-50s", substr($row["channel"], 0, 50))." | ";
+						$dial_log_rpt.=sprintf("%-20s", substr($row["context"], 0, 20))." | ";
+						$dial_log_rpt.=sprintf("%-7s",$row["timeout"])." | ";
+						$dial_log_rpt.=sprintf("%-40s", substr($row["outbound_cid"], 0, 40))." | ";
+						$dial_log_rpt.=sprintf("%-6s",$row["sip_hangup_cause"])." | ";
+						$dial_log_rpt.=sprintf("%-20s",$row["uniqueid"])." | ";
+						$dial_log_rpt.=sprintf("%-50s",$row["sip_hangup_reason"])." |\n";
+
+						$dial_log_rpt.="| ";
+						$dial_log_rpt.=sprintf("%-20s","")." | ";
+						$dial_log_rpt.=sprintf("%-9s","")." | ";
+						$dial_log_rpt.=sprintf("%-15s","")." | ";
+						$dial_log_rpt.=sprintf("%-19s","")." | ";
+						$dial_log_rpt.=sprintf("%-20s", "")." | ";
+						$dial_log_rpt.=sprintf("%-50s", substr($row["channel"], 50))." | ";
+						$dial_log_rpt.=sprintf("%-20s", "")." | ";
+						$dial_log_rpt.=sprintf("%-7s","")." | ";
+						$dial_log_rpt.=sprintf("%-40s", "")." | ";
+						$dial_log_rpt.=sprintf("%-6s","")." | ";
+						$dial_log_rpt.=sprintf("%-20s","")." | ";
+						$dial_log_rpt.=sprintf("%-50s","")." |\n";
+					} else {
+						$dial_log_rpt.="| ";
+						$dial_log_rpt.=sprintf("%-20s",substr($row["caller_code"], 0, 20))." | ";
+						$dial_log_rpt.=sprintf("%-9s",$row["lead_id"])." | ";
+						$dial_log_rpt.=sprintf("%-15s",$row["server_ip"])." | ";
+						$dial_log_rpt.=sprintf("%-19s",$row["call_date"])." | ";
+						$dial_log_rpt.=sprintf("%-20s", substr($row["extension"], 0, 20))." | ";
+						$dial_log_rpt.=sprintf("%-50s", substr($row["channel"], 0, 50))." | ";
+						$dial_log_rpt.=sprintf("%-20s", substr($row["context"], 0, 20))." | ";
+						$dial_log_rpt.=sprintf("%-7s",$row["timeout"])." | ";
+						$dial_log_rpt.=sprintf("%-40s", substr($row["outbound_cid"], 0, 40))." | ";
+						$dial_log_rpt.=sprintf("%-6s",$row["sip_hangup_cause"])." | ";
+						$dial_log_rpt.=sprintf("%-20s",$row["uniqueid"])." | ";
+						$dial_log_rpt.=sprintf("%-50s",$row["sip_hangup_reason"])." |\n";
+					}
+				}
+				$CSV_text.="\"$row[caller_code]\",\"$row[lead_id]\",\"$row[server_ip]\",\"$row[call_date]\",\"$row[extension]\",\"$row[channel]\",\"$row[context]\",\"$row[timeout]\",\"$row[outbound_cid]\",\"$row[sip_hangup_cause]\",\"$row[uniqueid]\",\"$row[sip_hangup_reason]\"\n";
+			}
+		} else {
+			$dial_log_rpt.="*** NO RECORDS FOUND ***\n";
+		}
+		$dial_log_rpt.="+----------------------+-----------+-----------------+---------------------+----------------------+----------------------------------------------------+----------------------+---------+------------------------------------------+--------+----------------------+----------------------------------------------------+\n";
+
+		$dial_log_rpt_hf="";
+		$ll=$lower_limit-1000;
+		if ($ll>=1) {
+			$dial_log_rpt_hf.="[<<< PREV 1000 records]";
+		} else {
+			$dial_log_rpt_hf.=sprintf("%-23s", " ");
+		}
+		$dial_log_rpt_hf.=sprintf("%-145s", " ");
+
+		if (($lower_limit+1000)=mysql_num_rows($rslt)) {$max_limit=mysql_num_rows($rslt)-$upper_limit;} else {$max_limit=1000;}
+			$dial_log_rpt_hf.="[NEXT $max_limit records >>>]";
+		} else {
+			$dial_log_rpt_hf.=sprintf("%23s", " ");
+		}
+		$dial_log_rpt_hf.="\n";
+		$MAIN.=$dial_log_rpt_hf.$dial_log_rpt.$dial_log_rpt_hf;
+		
+		$MAIN.="
\n"; + +} + if ($file_download>0) { + $FILE_TIME = date("Ymd-His"); + $CSVfilename = "AST_dial_log_report_$US$FILE_TIME.csv"; + $CSV_text=preg_replace('/ +\"/', '"', $CSV_text); + $CSV_text=preg_replace('/\" +/', '"', $CSV_text); + // We'll be outputting a TXT file + header('Content-type: application/octet-stream'); + + // It will be called LIST_101_20090209-121212.txt + header("Content-Disposition: attachment; filename=\"$CSVfilename\""); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + ob_clean(); + flush(); + + echo "$CSV_text"; + + } else { + echo $HEADER; + require("admin_header.php"); + echo $MAIN; + } + +?> diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 18ca3c0e..7c5f6196 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1816,7 +1816,7 @@ if (strlen($dial_status) > 0) ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,enable_queuemetrics_logging,enable_vtiger_integration,qc_features_active,outbound_autodial_active,sounds_central_control_active,enable_second_webform,user_territories_active,custom_fields_enabled,admin_web_directory,webphone_url,first_login_trigger,hosted_settings,default_phone_registration_password,default_phone_login_password,default_server_password,test_campaign_calls,active_voicemail_server,voicemail_timezones,default_voicemail_timezone,default_local_gmt,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,allow_emails,level_8_disable_add,pass_key FROM system_settings;"; +$stmt = "SELECT use_non_latin,enable_queuemetrics_logging,enable_vtiger_integration,qc_features_active,outbound_autodial_active,sounds_central_control_active,enable_second_webform,user_territories_active,custom_fields_enabled,admin_web_directory,webphone_url,first_login_trigger,hosted_settings,default_phone_registration_password,default_phone_login_password,default_server_password,test_campaign_calls,active_voicemail_server,voicemail_timezones,default_voicemail_timezone,default_local_gmt,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,allow_emails,level_8_disable_add,pass_key,pass_hash_enabled,disable_auto_dial FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -1861,6 +1861,8 @@ if ($qm_conf_ct > 0) $SSallow_emails = $row[35]; $SSlevel_8_disable_add = $row[36]; $SSpass_key = $row[37]; + $SSpass_hash_enabled = $row[38]; + $SSdisable_auto_dial = $row[39]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -3217,12 +3219,13 @@ else # - Added display of agent login information on User Modify screen, and reset of failed_logins on update # 130615-2124 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes # 130627-0745 - Added url log, lagged log and user group login reports to admin utilities page +# 130709-1350 - Changes for encrypted password compatibility, added Dial Log Report # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.8-406a'; -$build = '130627-0745'; +$admin_version = '2.8-407a'; +$build = '130709-1350'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -3615,8 +3618,11 @@ if ( ($SSadmin_modify_refresh > 1) and (preg_match("/^3/",$ADD)) ) } echo "ADMINISTRATION: "; -if (!isset($ADD)) {$ADD=0;} +### set the default screen to the user list +if ( (!isset($ADD)) or (strlen($ADD)<1) ) {$ADD="0A";} +if ($ADD=='0') {$ADD="0A";} +### set the sections and headers if ($ADD=="1") {$hh='users'; echo "Add New User";} if ($ADD=="1A") {$hh='users'; echo "Copy User";} if ($ADD==11) {$hh='campaigns'; $sh='basic'; echo "Add New Campaign";} @@ -3904,7 +3910,7 @@ if ($ADD==730000000000000) {$hh='reports'; echo "DETAIL ADMIN CHANGE LOG";} if ($ADD==800000000000000) {$hh='reports'; echo "ADMIN REPORT LOG";} if ($ADD==810000000000000) {$hh='reports'; echo "USER ADMIN REPORT LOG";} if ($ADD==830000000000000) {$hh='reports'; echo "DETAIL ADMIN REPORT LOG";} -if ($ADD==0) {$hh='users'; echo "Users List";} +if ($ADD=="0A") {$hh='users'; echo "Users List";} if ($ADD==8) {$hh='users'; echo "CallBacks Within Agent";} if ($ADD==81) {$hh='campaigns'; $sh='list'; echo "CallBacks Within Campaign";} if ($ADD==811) {$hh='lists'; echo "CallBacks Within List";} @@ -8572,6 +8578,11 @@ if ($ADD==99999) <BR> <B>Outbound Auto-Dial Active -</B> This option allows you to enable or disable outbound auto-dialing within the system, setting this field to 0 will remove the LISTS and FILTERS sections and many fields from the Campaign Modification screens. Manual entry dialing will still be allowable from within the agent screen, but no list dialing will be possible. Default is 1 for active. + <BR> + <A NAME="settings-disable_auto_dial"> + <BR> + <B>Disable Auto-Dial -</B> This option is only editable by a system administrator. It will not remove any options from the management web interface, but it will prevent any auto-dialing of leads from happening on the system. Only Manual Dial outbound calls triggered directly by agents will function if this option is enabled. Default is 0 for inactive. + <BR> <A NAME="settings-auto_dial_limit"> <BR> @@ -11784,9 +11795,19 @@ if ($ADD=="2") $stmt="UPDATE system_settings SET auto_user_add_value='$user';"; $rslt=mysql_query($stmt, $link); } + + $pass_hash=''; + if ($SSpass_hash_enabled > 0) + { + $pass = preg_replace("/\'|\"|\\\\|;| /","",$pass); + $pass_hash = exec("../agc/bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $pass=''; + } + echo "<br><B>USER ADDED: $user</B>\n"; - $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,pass_hash) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass','$pass_hash');"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -12484,8 +12505,8 @@ if ($ADD==20) $stmtA="INSERT INTO vicidial_xfer_stats (campaign_id,preset_name) SELECT \"$campaign_id\",preset_name from vicidial_xfer_presets where campaign_id='$source_campaign_id';"; $rslt=mysql_query($stmtA, $link); - # $stmtA="INSERT INTO vicidial_campaign_cid_areacodes (areacode,outbound_cid,cid_description,active,cid_description,campaign_id) SELECT areacode,outbound_cid,cid_description,active,cid_description,\"$campaign_id\" from vicidial_campaign_cid_areacodes where campaign_id='$source_campaign_id';"; - # $rslt=mysql_query($stmtA, $link); + $stmtA="INSERT INTO vicidial_campaign_cid_areacodes (areacode,outbound_cid,active,cid_description,campaign_id) SELECT areacode,outbound_cid,active,cid_description,\"$campaign_id\" from vicidial_campaign_cid_areacodes where campaign_id='$source_campaign_id';"; + $rslt=mysql_query($stmtA, $link); ### LOG INSERTION Admin Log Table ### @@ -15158,10 +15179,10 @@ if ($ADD=="4A") { echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"; - if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + if ( ( (strlen($pass) < 2) and ($SSpass_hash_enabled < 1) ) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) { echo "<br>USER NOT MODIFIED - Please go back and look at the data you entered\n"; - echo "<br>Password and Full Name each need ot be at least 2 characters in length\n"; + echo "<br>Password and Full Name each need to be at least 2 characters in length\n"; } else { @@ -15171,9 +15192,23 @@ if ($ADD=="4A") $delete_filters = '0'; $load_leads = '0'; } + $pass_hash=''; + $pass_hashSQL=''; + if ($SSpass_hash_enabled > 0) + { + if (strlen($pass) > 1) + { + $pass = preg_replace("/\'|\"|\\\\|;| /","",$pass); + $pass_hash = exec("../agc/bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $pass_hashSQL = ",pass_hash='$pass_hash'"; + } + $pass=''; + } + echo "<br><B>USER MODIFIED - ADMIN: $user</B>\n"; - $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',add_timeclock_log='$add_timeclock_log',modify_timeclock_log='$modify_timeclock_log',delete_timeclock_log='$delete_timeclock_log',alter_custphone_override='$alter_custphone_override',vdc_agent_api_access='$vdc_agent_api_access',modify_inbound_dids='$modify_inbound_dids',delete_inbound_dids='$delete_inbound_dids',active='$active',download_lists='$download_lists',agent_shift_enforcement_override='$agent_shift_enforcement_override',manager_shift_enforcement_override='$manager_shift_enforcement_override',export_reports='$export_reports',delete_from_dnc='$delete_from_dnc',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override',callcard_admin='$callcard_admin',agent_choose_blended='$agent_choose_blended',realtime_block_user_info='$realtime_block_user_info',custom_fields_modify='$custom_fields_modify',force_change_password='$force_change_password',agent_lead_search_override='$agent_lead_search',modify_shifts='$modify_shifts',modify_phones='$modify_phones',modify_carriers='$modify_carriers',modify_labels='$modify_labels',modify_statuses='$modify_statuses',modify_voicemail='$modify_voicemail',modify_audiostore='$modify_audiostore',modify_moh='$modify_moh',modify_tts='$modify_tts',preset_contact_search='$preset_contact_search',modify_contacts='$modify_contacts',modify_same_user_level='$modify_same_user_level',admin_hide_lead_data='$admin_hide_lead_data',admin_hide_phone_data='$admin_hide_phone_data',agentcall_email='$agentcall_email',modify_email_accounts='$modify_email_accounts',failed_login_count=0 where user='$user' $LOGadmin_viewable_groupsSQL;"; + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',delete_users='$delete_users',delete_user_groups='$delete_user_groups',delete_lists='$delete_lists',delete_campaigns='$delete_campaigns',delete_ingroups='$delete_ingroups',delete_remote_agents='$delete_remote_agents',load_leads='$load_leads',campaign_detail='$campaign_detail',ast_admin_access='$ast_admin_access',ast_delete_phones='$ast_delete_phones',delete_scripts='$delete_scripts',modify_leads='$modify_leads',hotkeys_active='$hotkeys_active',change_agent_campaign='$change_agent_campaign',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',delete_filters='$delete_filters',alter_agent_interface_options='$alter_agent_interface_options',closer_default_blended='$closer_default_blended',delete_call_times='$delete_call_times',modify_call_times='$modify_call_times',modify_users='$modify_users',modify_campaigns='$modify_campaigns',modify_lists='$modify_lists',modify_scripts='$modify_scripts',modify_filters='$modify_filters',modify_ingroups='$modify_ingroups',modify_usergroups='$modify_usergroups',modify_remoteagents='$modify_remoteagents',modify_servers='$modify_servers',view_reports='$view_reports',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',add_timeclock_log='$add_timeclock_log',modify_timeclock_log='$modify_timeclock_log',delete_timeclock_log='$delete_timeclock_log',alter_custphone_override='$alter_custphone_override',vdc_agent_api_access='$vdc_agent_api_access',modify_inbound_dids='$modify_inbound_dids',delete_inbound_dids='$delete_inbound_dids',active='$active',download_lists='$download_lists',agent_shift_enforcement_override='$agent_shift_enforcement_override',manager_shift_enforcement_override='$manager_shift_enforcement_override',export_reports='$export_reports',delete_from_dnc='$delete_from_dnc',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override',callcard_admin='$callcard_admin',agent_choose_blended='$agent_choose_blended',realtime_block_user_info='$realtime_block_user_info',custom_fields_modify='$custom_fields_modify',force_change_password='$force_change_password',agent_lead_search_override='$agent_lead_search',modify_shifts='$modify_shifts',modify_phones='$modify_phones',modify_carriers='$modify_carriers',modify_labels='$modify_labels',modify_statuses='$modify_statuses',modify_voicemail='$modify_voicemail',modify_audiostore='$modify_audiostore',modify_moh='$modify_moh',modify_tts='$modify_tts',preset_contact_search='$preset_contact_search',modify_contacts='$modify_contacts',modify_same_user_level='$modify_same_user_level',admin_hide_lead_data='$admin_hide_lead_data',admin_hide_phone_data='$admin_hide_phone_data',agentcall_email='$agentcall_email',modify_email_accounts='$modify_email_accounts',failed_login_count=0 $pass_hashSQL where user='$user' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -15401,10 +15436,10 @@ if ($ADD=="4B") { echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"; - if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + if ( ( (strlen($pass) < 2) and ($SSpass_hash_enabled < 1) ) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) { echo "<br>USER NOT MODIFIED - Please go back and look at the data you entered\n"; - echo "<br>Password and Full Name each need ot be at least 2 characters in length\n"; + echo "<br>Password and Full Name each need to be at least 2 characters in length\n"; } else { @@ -15414,9 +15449,23 @@ if ($ADD=="4B") $delete_filters = '0'; $load_leads = '0'; } + $pass_hash=''; + $pass_hashSQL=''; + if ($SSpass_hash_enabled > 0) + { + if (strlen($pass) > 1) + { + $pass = preg_replace("/\'|\"|\\\\|;| /","",$pass); + $pass_hash = exec("../agc/bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $pass_hashSQL = ",pass_hash='$pass_hash'"; + } + $pass=''; + } + echo "<br><B>USER MODIFIED - ADMIN: $user</B>\n"; - $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',alter_custphone_override='$alter_custphone_override',active='$active',agent_shift_enforcement_override='$agent_shift_enforcement_override',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override',agent_choose_blended='$agent_choose_blended',agent_lead_search_override='$agent_lead_search',preset_contact_search='$preset_contact_search',failed_login_count=0 where user='$user' $LOGadmin_viewable_groupsSQL;"; + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',hotkeys_active='$hotkeys_active',agent_choose_ingroups='$agent_choose_ingroups',closer_campaigns='$groups_value',scheduled_callbacks='$scheduled_callbacks',agentonly_callbacks='$agentonly_callbacks',agentcall_manual='$agentcall_manual',vicidial_recording='$vicidial_recording',vicidial_transfers='$vicidial_transfers',closer_default_blended='$closer_default_blended',vicidial_recording_override='$vicidial_recording_override',alter_custdata_override='$alter_custdata_override',qc_enabled='$qc_enabled',qc_user_level='$qc_user_level',qc_pass='$qc_pass',qc_finish='$qc_finish',qc_commit='$qc_commit',alter_custphone_override='$alter_custphone_override',active='$active',agent_shift_enforcement_override='$agent_shift_enforcement_override',email='$email',user_code='$user_code',territory='$territory',allow_alerts='$allow_alerts',agent_choose_territories='$agent_choose_territories',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',voicemail_id='$voicemail_id',agent_call_log_view_override='$agent_call_log_view_override',agent_choose_blended='$agent_choose_blended',agent_lead_search_override='$agent_lead_search',preset_contact_search='$preset_contact_search',failed_login_count=0 $pass_hashSQL where user='$user' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -15644,16 +15693,30 @@ if ($ADD==4) { echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"; - if ( (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) + if ( ( (strlen($pass) < 2) and ($SSpass_hash_enabled < 1) ) or (strlen($full_name) < 2) or (strlen($user_level) < 1) ) { echo "<br>USER NOT MODIFIED - Please go back and look at the data you entered\n"; - echo "<br>Password and Full Name each need ot be at least 2 characters in length\n"; + echo "<br>Password and Full Name each need to be at least 2 characters in length\n"; } else { + $pass_hash=''; + $pass_hashSQL=''; + if ($SSpass_hash_enabled > 0) + { + if (strlen($pass) > 1) + { + $pass = preg_replace("/\'|\"|\\\\|;| /","",$pass); + $pass_hash = exec("../agc/bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $pass_hashSQL = ",pass_hash='$pass_hash'"; + } + $pass=''; + } + echo "<br><B>USER MODIFIED: $user</B>\n"; - $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',active='$active',email='$email',user_code='$user_code',territory='$territory',failed_login_count=0 where user='$user' $LOGadmin_viewable_groupsSQL;"; + $stmt="UPDATE vicidial_users set pass='$pass',full_name='$full_name',user_level='$user_level',user_group='$user_group',phone_login='$phone_login',phone_pass='$phone_pass',active='$active',email='$email',user_code='$user_code',territory='$territory',failed_login_count=0 $pass_hashSQL where user='$user' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -19802,6 +19865,9 @@ if ($ADD==61) $stmt="DELETE from vicidial_xfer_stats where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;"; $rslt=mysql_query($stmt, $link); + $stmt="DELETE from vicidial_campaign_cid_areacodes where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;"; + $rslt=mysql_query($stmt, $link); + echo "<br>REMOVING LIST HOPPER LEADS FROM OLD CAMPAIGN HOPPER ($campaign_id)\n"; $stmt="DELETE from vicidial_hopper where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;"; $rslt=mysql_query($stmt, $link); @@ -21621,6 +21687,10 @@ if ($ADD==3) echo "<center><TABLE width=$section_width cellspacing=3>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>User Number: </td><td align=left><b>$user</b>$NWB#users-user$NWE</td></tr>\n"; + if ($SSpass_hash_enabled > 0) + { + echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><b>PASSWORD IS ENCRYPTED, ONLY ENTER IN A PASSWORD BELOW IF YOU WANT TO CHANGE IT!</b></td></tr>\n"; + } echo "<tr bgcolor=#B6D3FC><td align=right>Password: </td><td align=left style=\"display:table-cell; vertical-align:middle;\"><input type=text id=reg_pass name=pass size=20 maxlength=20 value=\"$pass\" onkeyup=\"return pwdChanged('reg_pass','reg_pass_img');\">$NWB#users-pass$NWE     Strength: <IMG id=reg_pass_img src='images/pixel.gif' style=\"vertical-align:middle;\" onLoad=\"return pwdChanged('reg_pass','reg_pass_img');\"></td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Force Change Password: </td><td align=left><select size=1 name=force_change_password><option>Y</option><option>N</option><option SELECTED>$force_change_password</option></select>$NWB#users-force_change_password$NWE</td></tr>\n"; @@ -22701,6 +22771,10 @@ if ($ADD==31) echo "<tr bgcolor=#8EBCFD><td align=right>Force Reset of Hopper: </td><td align=left><select size=1 name=reset_hopper><option>Y</option><option SELECTED>N</option></select>$NWB#campaigns-force_reset_hopper$NWE</td></tr>\n"; + if ( (preg_match("/RATIO|ADAPT/",$dial_method)) and ($SSdisable_auto_dial > 0) ) + { + echo "<tr bgcolor=#BDFFBD><td align=center colspan=2><b>Auto-dialing has been disabled on this system</b></td></tr>\n"; + } echo "<tr bgcolor=#BDFFBD><td align=right>Dial Method: </td><td align=left><select size=1 name=dial_method><option >MANUAL</option><option>RATIO</option><option>ADAPT_HARD_LIMIT</option><option>ADAPT_TAPERED</option><option>ADAPT_AVERAGE</option><option>INBOUND_MAN</option><option SELECTED>$dial_method</option></select>$NWB#campaigns-dial_method$NWE</td></tr>\n"; echo "<tr bgcolor=#BDFFBD><td align=right>Auto Dial Level: </td><td align=left><select size=1 name=auto_dial_level><option selected>$auto_dial_level</option>\n"; @@ -24678,6 +24752,10 @@ if ($ADD==34) echo "<tr bgcolor=#B6D3FC><td align=right>Force Reset of Hopper: </td><td align=left><select size=1 name=reset_hopper><option>Y</option><option SELECTED>N</option></select>$NWB#campaigns-force_reset_hopper$NWE</td></tr>\n"; + if ( (preg_match("/RATIO|ADAPT/",$dial_method)) and ($SSdisable_auto_dial > 0) ) + { + echo "<tr bgcolor=#BDFFBD><td align=center colspan=2><b>Auto-dialing has been disabled on this system</b></td></tr>\n"; + } echo "<tr bgcolor=#BDFFBD><td align=right>Dial Method: </td><td align=left><select size=1 name=dial_method><option >MANUAL</option><option>RATIO</option><option>ADAPT_HARD_LIMIT</option><option>ADAPT_TAPERED</option><option>ADAPT_AVERAGE</option><option>INBOUND_MAN</option><option SELECTED>$dial_method</option></select>$NWB#campaigns-dial_method$NWE</td></tr>\n"; echo "<tr bgcolor=#BDFFBD><td align=right>Auto Dial Level: </td><td align=left><select size=1 name=auto_dial_level><option selected>$auto_dial_level</option>\n"; @@ -32483,7 +32561,7 @@ if ($ADD==311111111111111) $ALLagent_count = $rowx[2]; } - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_agent_log,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,queuemetrics_socket,queuemetrics_socket_url,enhanced_disconnect_logging,allow_emails,level_8_disable_add from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_agent_log,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,queuemetrics_socket,queuemetrics_socket_url,enhanced_disconnect_logging,allow_emails,level_8_disable_add,pass_hash_enabled,pass_key,pass_cost,disable_auto_dial from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $version = $row[0]; @@ -32600,6 +32678,17 @@ if ($ADD==311111111111111) $enhanced_disconnect_logging = $row[111]; $allow_emails = $row[112]; $level_8_disable_add = $row[113]; + $pass_hash_enabled = $row[114]; + $pass_key = $row[115]; + $pass_cost = $row[116]; + $disable_auto_dial = $row[117]; + + if ($pass_hash_enabled > 0) {$pass_hash_enabled = 'ENABLED';} + else {$pass_hash_enabled = 'DISABLED';} + if (strlen($pass_key) > 12) {$pass_key = 'S1';} + else {$pass_key = 'S0';} + if ($pass_cost > 0) {$pass_cost = 'C1';} + else {$pass_cost = 'C0';} echo "<br>MODIFY SYSTEM SETTINGS<form action=$PHP_SELF method=POST>\n"; echo "<input type=hidden name=ADD value=411111111111111>\n"; @@ -32609,6 +32698,7 @@ if ($ADD==311111111111111) echo "<tr bgcolor=#B6D3FC><td align=right>SVN Version: </td><td align=left> <a href=\"$PHP_SELF?ADD=999991\">$svn_revision</a></td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>DB Schema Version: </td><td align=left> $db_schema_version</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>DB Schema Update Date: </td><td align=left> $db_schema_update_date</td></tr>\n"; + echo "<tr bgcolor=#B6D3FC><td align=right>Password Encryption: </td><td align=left> $pass_hash_enabled - $pass_key - $pass_cost</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Auto User-add Value: </td><td align=left> $auto_user_add_value</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Install Date: </td><td align=left> $install_date</td></tr>\n"; $pcblinkB=''; $pcblinkE=''; @@ -32760,6 +32850,8 @@ if ($ADD==311111111111111) echo "<tr bgcolor=#B6D3FC><td align=right>Outbound Auto-Dial Active: </td><td align=left><select size=1 name=outbound_autodial_active><option>1</option><option>0</option><option selected>$outbound_autodial_active</option></select>$NWB#settings-outbound_autodial_active$NWE</td></tr>\n"; + echo "<tr bgcolor=#B6D3FC><td align=right>Disable Auto-Dial: </td><td align=left>$disable_auto_dial   $NWB#settings-disable_auto_dial$NWE</td></tr>\n"; + echo "<tr bgcolor=#B6D3FC><td align=right>Max FILL Calls per Second: </td><td align=left><input type=text name=outbound_calls_per_second size=4 maxlength=3 value=\"$outbound_calls_per_second\">$NWB#settings-outbound_calls_per_second$NWE</td></tr>\n"; echo "<tr bgcolor=#B6D3FC><td align=right>Allow Custom Dialplan Entries: </td><td align=left><select size=1 name=allow_custom_dialplan><option>1</option><option>0</option><option selected>$allow_custom_dialplan</option></select>$NWB#settings-allow_custom_dialplan$NWE</td></tr>\n"; @@ -33490,9 +33582,9 @@ if ($ADD==82) ###################################################################################################### ###################### -# ADD=0 display all active users +# ADD=0A display all active users ###################### -if ($ADD==0) +if ($ADD=="0A") { echo "<TABLE><TR><TD>\n"; echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"; @@ -33500,12 +33592,12 @@ if ($ADD==0) if (preg_match('/display_all/',$status)) { $SQLstatus = ''; - echo "   <a href=\"$PHP_SELF?ADD=0\"><font size=1 color=black>show only active users</a>\n"; + echo "   <a href=\"$PHP_SELF?ADD=0A\"><font size=1 color=black>show only active users</a>\n"; } else { $SQLstatus = "and active='Y'"; - echo "   <a href=\"$PHP_SELF?ADD=0&status=display_all\"><font size=1 color=black>show all users</a>\n"; + echo "   <a href=\"$PHP_SELF?ADD=0A&status=display_all\"><font size=1 color=black>show all users</a>\n"; } $USERlink='stage=USERIDDOWN'; @@ -33527,10 +33619,10 @@ if ($ADD==0) echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n"; echo "<tr bgcolor=black>"; - echo "<td><a href=\"$PHP_SELF?ADD=0&status=$status&$USERlink\"><font size=1 color=white><B>USER ID</B></a></td>"; - echo "<td><a href=\"$PHP_SELF?ADD=0&status=$status&$NAMElink\"><font size=1 color=white><B>FULL NAME</B></a></td>"; - echo "<td><a href=\"$PHP_SELF?ADD=0&status=$status&$LEVELlink\"><font size=1 color=white><B>LEVEL</B></a></td>"; - echo "<td><a href=\"$PHP_SELF?ADD=0&status=$status&$GROUPlink\"><font size=1 color=white><B>GROUP</B></a></td>"; + echo "<td><a href=\"$PHP_SELF?ADD=0A&status=$status&$USERlink\"><font size=1 color=white><B>USER ID</B></a></td>"; + echo "<td><a href=\"$PHP_SELF?ADD=0A&status=$status&$NAMElink\"><font size=1 color=white><B>FULL NAME</B></a></td>"; + echo "<td><a href=\"$PHP_SELF?ADD=0A&status=$status&$LEVELlink\"><font size=1 color=white><B>LEVEL</B></a></td>"; + echo "<td><a href=\"$PHP_SELF?ADD=0A&status=$status&$GROUPlink\"><font size=1 color=white><B>GROUP</B></a></td>"; echo "<td><font size=1 color=white><B>ACTIVE</B></td>"; echo "<td align=center><font size=1 color=white><B>LINKS</B></td></tr>\n"; @@ -35943,7 +36035,18 @@ if ($ADD==999997) {echo "Password has not been changed, please try again |1|" . strlen($pass);} else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$PHP_AUTH_PW' and force_change_password='Y' and active='Y' and user_level > 6;"; + $pass_hash=''; + $pass_checkSQL="pass='$pass'"; + if ( ($SSpass_hash_enabled > 0) and (strlen($pass) > 1) ) + { + $pass = preg_replace("/\'|\"|\\\\|;| /","",$pass); + $pass_hash = exec("../agc/bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $pass_checkSQL="pass_hash='$pass_hash'"; + $pass=''; + } + + $stmt="SELECT count(*) from vicidial_users where user='$user' and active='Y' and user_level > 1;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $userpass_to_print = mysql_num_rows($rslt); @@ -35958,7 +36061,7 @@ if ($ADD==999997) { $show_form=0; - $stmt="UPDATE vicidial_users SET pass='$pass',force_change_password='N',failed_login_count=0 where user='$user' and force_change_password='Y' and active='Y' and user_level > 6;"; + $stmt="UPDATE vicidial_users SET pass='$pass',pass_hash='$pass_hash',force_change_password='N',failed_login_count=0 where user='$user' and force_change_password='Y' and active='Y' and user_level > 6;"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -36011,7 +36114,17 @@ if ($ADD==999996) {echo "Password has not been changed, please try again |1|" . strlen($pass);} else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$PHP_AUTH_PW' and active='Y' and user_level > 6;"; + $pass_hash=''; + $pass_checkSQL="pass='$pass'"; + if ( ($SSpass_hash_enabled > 0) and (strlen($pass) > 1) ) + { + $pass = preg_replace("/\'|\"|\\\\|;| /","",$pass); + $pass_hash = exec("../agc/bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $pass_checkSQL="pass_hash='$pass_hash'"; + $pass=''; + } + $stmt="SELECT count(*) from vicidial_users where user='$user' and active='Y' and user_level > 6;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $userpass_to_print = mysql_num_rows($rslt); @@ -36032,7 +36145,7 @@ if ($ADD==999996) if (strlen($default_local_gmt) < 2) {$default_local_gmt = $SSdefault_local_gmt;} if (strlen($default_voicemail_timezone) < 2) {$default_voicemail_timezone = $SSdefault_voicemail_timezone;} - $stmt="UPDATE vicidial_users SET pass='$pass',force_change_password='N',failed_login_count=0 where user='$user' and active='Y' and user_level > 6;"; + $stmt="UPDATE vicidial_users SET pass='$pass',pass_hash='$pass_hash',force_change_password='N',failed_login_count=0 where user='$user' and active='Y' and user_level > 6;"; $rslt=mysql_query($stmt, $link); $stmtA="UPDATE system_settings SET first_login_trigger='N',default_phone_registration_password='$default_phone_registration_password',default_phone_login_password='$default_phone_login_password',default_server_password='$default_server_password',default_local_gmt='$default_local_gmt',default_voicemail_timezone='$default_voicemail_timezone';"; @@ -36164,6 +36277,7 @@ if ($ADD==999994) echo "<LI><a href=\"$PHP_SELF?ADD=999991\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Servers Versions</a></FONT>\n"; echo "<BR><BR>\n"; echo "<LI><a href=\"campaign_debug.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Campaign Debug Page</a></FONT>\n"; + echo "<LI><a href=\"AST_dial_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Dial Log Report</a></FONT>\n"; echo "<LI><a href=\"AST_carrier_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Carrier Log Report</a></FONT>\n"; echo "<LI><a href=\"AST_hangup_cause_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Hangup Cause Report</a></FONT>\n"; echo "<LI><a href=\"AST_url_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>URL Log Report</a></FONT>\n"; diff --git a/www/vicidial/admin_header.php b/www/vicidial/admin_header.php index d4e0d726..4fd1e4c2 100644 --- a/www/vicidial/admin_header.php +++ b/www/vicidial/admin_header.php @@ -1102,7 +1102,7 @@ $SSlevel_8_disable_add = $row[5]; ?> <!-- USERS NAVIGATION --> <TR WIDTH=160><TD <?php echo $users_hh ?> WIDTH=160> - <a href="<?php echo $ADMIN ?>?ADD=0"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $users_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $users_bold ?>Users</a> + <a href="<?php echo $ADMIN ?>?ADD=0A"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $users_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $users_bold ?>Users</a> </TD></TR> <?php if (strlen($users_hh) > 1) { ?> diff --git a/www/vicidial/admin_modify_lead.php b/www/vicidial/admin_modify_lead.php index 8661a168..3c8c8b45 100644 --- a/www/vicidial/admin_modify_lead.php +++ b/www/vicidial/admin_modify_lead.php @@ -54,6 +54,7 @@ # 130123-1940 - Added options.php option to allow display of non-selectable statuses # 130610-1049 - Finalized changing of all ereg instances to preg # 130621-1731 - Added filtering of input to prevent SQL injection attacks and new user auth +# 130705-1726 - Minor change for encrypted password compatibility # require("dbconnect.php"); @@ -1274,7 +1275,7 @@ else $custom_records_count = $rowx[0]; echo "<B>CUSTOM FIELDS FOR THIS LEAD:</B><BR>\n"; - echo "<iframe src=\"../agc/vdc_form_display.php?lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bgcolor=E6E6E6\" style=\"background-color:transparent;\" scrolling=\"auto\" frameborder=\"2\" allowtransparency=\"true\" id=\"vcFormIFrame\" name=\"vcFormIFrame\" width=\"740\" height=\"300\" STYLE=\"z-index:18\"> </iframe>\n"; + echo "<iframe src=\"../agc/vdc_form_display.php?lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bcrypt=OFF&bgcolor=E6E6E6\" style=\"background-color:transparent;\" scrolling=\"auto\" frameborder=\"2\" allowtransparency=\"true\" id=\"vcFormIFrame\" name=\"vcFormIFrame\" width=\"740\" height=\"300\" STYLE=\"z-index:18\"> </iframe>\n"; echo "<BR><BR>"; } } diff --git a/www/vicidial/functions.php b/www/vicidial/functions.php index cffb4446..5c92df10 100644 --- a/www/vicidial/functions.php +++ b/www/vicidial/functions.php @@ -15,6 +15,7 @@ # 120213-1417 - Changes to allow for ra stats # 120713-2137 - Added download function for max stats # 130615-2111 - Added user authentication function and login lockout for 15 minutes after 10 failed login +# 130705-1957 - Added password encryption compatibility # ##### BEGIN validate user login credentials, check for failed lock out ##### @@ -51,13 +52,22 @@ function user_authorization($user,$pass,$user_option,$user_update) $user = preg_replace("/\'|\"|\\\\|;/","",$user); $pass = preg_replace("/\'|\"|\\\\|;/","",$pass); - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 7 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );"; + $passSQL = "pass='$pass'"; + + if ($SSpass_hash_enabled > 0) + { + $pass_hash = exec("../agc/bp.pl --pass=$pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $passSQL = "pass_hash='$pass_hash'"; + } + + $stmt="SELECT count(*) from vicidial_users where user='$user' and $passSQL and user_level > 7 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );"; if ($user_option == 'REPORTS') - {$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 6 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} + {$stmt="SELECT count(*) from vicidial_users where user='$user' and $passSQL and user_level > 6 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} if ($user_option == 'REMOTE') - {$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 3 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} + {$stmt="SELECT count(*) from vicidial_users where user='$user' and $passSQL and user_level > 3 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} if ($user_option == 'QC') - {$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 1 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} + {$stmt="SELECT count(*) from vicidial_users where user='$user' and $passSQL and user_level > 1 and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";} if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); diff --git a/www/vicidial/non_agent_api.php b/www/vicidial/non_agent_api.php index 94f91fb0..702a7cfd 100644 --- a/www/vicidial/non_agent_api.php +++ b/www/vicidial/non_agent_api.php @@ -79,10 +79,11 @@ # - Added pause code to output of agent_status function # 130617-2232 - Added real-time sub-statuses to output of agent_status function # - Added user authentication process to eliminate brute force attacks +# 130705-1725 - Changes for encrypted password compatibility # -$version = '2.8-55'; -$build = '130617-2232'; +$version = '2.8-56'; +$build = '130705-1725'; $api_url_log = 0; $startMS = microtime(); @@ -343,7 +344,7 @@ header ("Pragma: no-cache"); // HTTP/1.0 ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled,pass_hash_enabled FROM system_settings;"; $rslt=mysql_query($stmt, $link); $qm_conf_ct = mysql_num_rows($rslt); if ($qm_conf_ct > 0) @@ -351,6 +352,7 @@ if ($qm_conf_ct > 0) $row=mysql_fetch_row($rslt); $non_latin = $row[0]; $custom_fields_enabled = $row[1]; + $SSpass_hash_enabled = $row[2]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -534,7 +536,7 @@ $pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; $inSD = $pulldate0; $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); -### Grab Server GMT value from the database +### Grab Server system settings from the database $stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); @@ -542,7 +544,7 @@ $gmt_recs = mysql_num_rows($rslt); if ($gmt_recs > 0) { $row=mysql_fetch_row($rslt); - $DBSERVER_GMT = $row[0]; + $DBSERVER_GMT = $row[0]; if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} if ($isdst) {$SERVER_GMT++;} } @@ -607,7 +609,7 @@ if ($auth < 1) ################################################################################ if ($function == 'sounds_list') { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and user_level > 6 and active='Y';"; if ($DB>0) {echo "DEBUG: sounds_list query - $stmt\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -776,7 +778,7 @@ if ($function == 'sounds_list') ################################################################################ if ($function == 'moh_list') { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -824,7 +826,7 @@ if ($function == 'moh_list') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level > 6;"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level > 6;"; if ($DB>0) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -942,7 +944,7 @@ if ($function == 'moh_list') ################################################################################ if ($function == 'vm_list') { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -957,7 +959,7 @@ if ($function == 'vm_list') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level > 6;"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level > 6;"; if ($DB>0) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -1094,7 +1096,7 @@ if ($function == 'agent_ingroup_info') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -1109,7 +1111,7 @@ if ($function == 'agent_ingroup_info') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level > 6;"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level > 6;"; if ($DB>0) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -1190,12 +1192,12 @@ if ($function == 'agent_ingroup_info') $row=mysql_fetch_row($rslt); $allowed_campaign_autodial=$row[0]; - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and change_agent_campaign='1' and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and change_agent_campaign='1' and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user_change_ingroups=$row[0]; - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and modify_users='1' and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and modify_users='1' and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user_modify_user=$row[0]; @@ -1420,7 +1422,7 @@ if ($function == 'blind_monitor') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -1591,7 +1593,7 @@ if ($function == 'add_user') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_users='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_users='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -1617,7 +1619,7 @@ if ($function == 'add_user') } else { - $stmt="SELECT user_level,user_group,modify_same_user_level from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_users='1' and user_level >= 8;"; + $stmt="SELECT user_level,user_group,modify_same_user_level from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_users='1' and user_level >= 8;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $user_level = $row[0]; @@ -1721,7 +1723,16 @@ if ($function == 'add_user') if (strlen($hotkeys_active)<1) {$hotkeys_active='0';} - $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,hotkeys_active,voicemail_id,email,custom_one,custom_two,custom_three,custom_four,custom_five) values('$agent_user','$agent_pass','$agent_full_name','$agent_user_level','$agent_user_group','$phone_login','$phone_pass','$hotkeys_active','$voicemail_id','$email','$custom_one','$custom_two','$custom_three','$custom_four','$custom_five');"; + $pass_hash=''; + if ( ($SSpass_hash_enabled > 0) and (strlen($agent_pass) > 1) ) + { + $agent_pass = preg_replace("/\'|\"|\\\\|;| /","",$agent_pass); + $pass_hash = exec("../agc/bp.pl --pass=$agent_pass"); + $pass_hash = preg_replace("/PHASH: |\n|\r|\t| /",'',$pass_hash); + $agent_pass=''; + } + + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,hotkeys_active,voicemail_id,email,custom_one,custom_two,custom_three,custom_four,custom_five,pass_hash) values('$agent_user','$agent_pass','$agent_full_name','$agent_user_level','$agent_user_group','$phone_login','$phone_pass','$hotkeys_active','$voicemail_id','$email','$custom_one','$custom_two','$custom_three','$custom_four','$custom_five','$pass_hash');"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -1767,7 +1778,7 @@ if ($function == 'add_group_alias') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -1859,7 +1870,7 @@ if ($function == 'add_phone') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -1997,7 +2008,7 @@ if ($function == 'update_phone') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -2023,7 +2034,7 @@ if ($function == 'update_phone') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level >= 8;"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level >= 8;"; if ($DB>0) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -2078,7 +2089,7 @@ if ($function == 'update_phone') { if ($delete_phone == 'Y') { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and ast_delete_phones='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_delete_phones='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -2408,7 +2419,7 @@ if ($function == 'add_phone_alias') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -2517,7 +2528,7 @@ if ($function == 'update_phone_alias') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_admin_access='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -2560,7 +2571,7 @@ if ($function == 'update_phone_alias') { if ($delete_alias == 'Y') { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and ast_delete_phones='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_delete_phones='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -2702,7 +2713,7 @@ if ($function == 'update_list') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_lists='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_lists='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -2728,7 +2739,7 @@ if ($function == 'update_list') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level >= 8;"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level >= 8;"; if ($DB>0) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -3046,7 +3057,7 @@ if ($function == 'update_list') if ($delete_list == 'Y') { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_lists='1' and delete_lists='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_lists='1' and delete_lists='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -3084,7 +3095,7 @@ if ($function == 'update_list') if ($delete_leads == 'Y') { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_lists='1' and delete_lists='1' and modify_leads='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_lists='1' and delete_lists='1' and modify_leads='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -3150,7 +3161,7 @@ if ($function == 'add_list') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_lists='1' and user_level >= 8 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_lists='1' and user_level >= 8 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -3176,7 +3187,7 @@ if ($function == 'add_list') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level >= 8;"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level >= 8;"; if ($DB>0) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -3337,7 +3348,7 @@ if ($function == 'recording_lookup') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -3509,7 +3520,7 @@ if ($function == 'did_log_export') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -3649,7 +3660,7 @@ if ($function == 'agent_stats_export') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -3865,7 +3876,7 @@ if ($function == 'user_group_status') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -3901,7 +3912,7 @@ if ($function == 'user_group_status') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level > 6 and view_reports='1' and active='Y';"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level > 6 and view_reports='1' and active='Y';"; if ($DB) {$MAIN.="|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -4081,7 +4092,7 @@ if ($function == 'in_group_status') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -4118,7 +4129,7 @@ if ($function == 'in_group_status') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level > 6 and view_reports='1' and active='Y';"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level > 6 and view_reports='1' and active='Y';"; if ($DB) {$MAIN.="|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -4297,7 +4308,7 @@ if ($function == 'agent_status') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and view_reports='1' and user_level > 6 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -4331,7 +4342,7 @@ if ($function == 'agent_status') } else { - $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass' and user_level > 6 and view_reports='1' and active='Y';"; + $stmt="SELECT user_group from vicidial_users where user='$user' and user_level > 6 and view_reports='1' and active='Y';"; if ($DB) {$MAIN.="|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -4497,7 +4508,7 @@ if ($function == 'update_log_entry') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $allowed_user=$row[0]; @@ -4638,7 +4649,7 @@ if ($function == 'add_lead') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $modify_leads=$row[0]; @@ -5379,7 +5390,7 @@ if ($function == 'update_lead') } else { - $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7 and active='Y';"; + $stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7 and active='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $modify_leads=$row[0]; diff --git a/www/vicidial/qc/QC_admin_include02.php b/www/vicidial/qc/QC_admin_include02.php index e9429160..c6943d28 100644 --- a/www/vicidial/qc/QC_admin_include02.php +++ b/www/vicidial/qc/QC_admin_include02.php @@ -9,7 +9,7 @@ # 121116-1333 - First build, added to vicidial codebase # //Get QC User permissions -$stmt="SELECT qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 1 and active='Y' and qc_enabled='1';"; +$stmt="SELECT qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit from vicidial_users where user='$PHP_AUTH_USER' and user_level > 1 and active='Y' and qc_enabled='1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt);